summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/uclibc/uclibc.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc.inc')
-rw-r--r--meta/recipes-core/uclibc/uclibc.inc166
1 files changed, 166 insertions, 0 deletions
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
new file mode 100644
index 0000000..e00de62
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc.inc
@@ -0,0 +1,166 @@
1SUMMARY = "C library for embedded systems"
2DESCRIPTION = "The name uClibc is an abbreviation for 'the \
3microcontroller C library'. For simplicity, uClibc is pronounced \
4'yew-see-lib-see'. The goal of uClibc is to provide as much \
5functionality as possible in a small amount of space, and it is intended \
6primarily for embedded use. It is also highly configurable in supported \
7features, at the cost of ABI differences for different configurations. \
8uClibc has been designed from the ground up to be a C library for \
9embedded Linux. It is NOT compatible with binaries linked against glibc."
10
11LICENSE = "LGPLv2.1+"
12SECTION = "libs"
13LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
14 file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \
15file://${S}/test/regex/testregex.c;beginline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960"
16PR = "r9"
17
18require uclibc-config.inc
19
20PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
21TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
22
23# siteconfig.bbclass runs configure which needs a working compiler
24# For the compiler to work we need a working libc yet libc isn't
25# in the sysroots directory at this point. This means the libc.so
26# linker script won't work as the --sysroot setting isn't correct.
27# Here we create a hacked up libc linker script and pass in the right
28# flags to let configure work. Ugly.
29EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
30siteconfig_do_siteconfig_gencache_prepend = " \
31mkdir -p ${WORKDIR}/site_config_libc; \
32cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
33sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
34"
35
36# For now, we will skip building of a gcc package if it is a uclibc one
37# and our build is not a uclibc one, and we skip a glibc one if our build
38# is a uclibc build.
39COMPATIBLE_HOST = ".*-uclibc.*"
40
41INHIBIT_DEFAULT_DEPS = "1"
42
43# do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in
44# the CFLAGS (when building the utils).
45OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}'"
46EXTRA_OEMAKE = "${OEMAKE_NO_CC} \
47 'HOSTCC=${BUILD_CC}' \
48 'HOST_CFLAGS=${BUILD_CFLAGS}' \
49 'CC=${CC}' \
50 ARCH=${UCLIBC_ARCH}"
51
52EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
53
54# enable verbose output:
55export V="2"
56
57# -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
58# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
59#
60CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
61UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
62UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}', d)}"
63
64do_compile_prepend () {
65 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
66 oe_runmake pregen
67}
68
69configmangle = '/^KERNEL_HEADERS/d; \
70 /^RUNTIME_PREFIX/d; \
71 /^DEVEL_PREFIX/d; \
72 /^SHARED_LIB_LOADER_PREFIX/d; \
73 /^UCLIBC_EXTRA_CFLAGS/d; \
74 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
75 ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][d.getVar("ARM_INSTRUCTION_SET", True) != "arm"]} \
76 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][d.getVar("USE_NLS", True) == "yes"]} \
77 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][d.getVar("TARGET_ARCH", True) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
78 /^CROSS/d; \
79 /^TARGET_ARCH=/d; \
80 /^TARGET_/s,^\([^=]*\).*,# \1 is not set,g; \
81 s,^DOSTRIP.*,# DOSTRIP is not set,g; \
82 /_[EO]*ABI/d; \
83 /HAS_FPU/d; \
84 '
85OE_FEATURES := "${@features_to_uclibc_conf(d)}"
86OE_DEL := "${@features_to_uclibc_del(d)}"
87python () {
88 if "${OE_DEL}":
89 d.setVar('configmangle_append', "${OE_DEL}" + "\n")
90
91 # by default uclibc uses mips1 ISA for o32 ABI
92 # if we use TARGET_CC_ARCH="-march=mips32" we end up
93 # with conflicting march options to gcc. Here we
94 # ask for MIPS32 ISA to match the chosen arch
95
96 if "mips32" in d.getVar("TUNE_FEATURES",True):
97 d.setVar('configmangle_append',
98 "/^### MIPS32_CHECK$/a\\\nCONFIG_MIPS_ISA_MIPS32=y\n\n")
99 if "${OE_FEATURES}":
100 d.setVar('configmangle_append',
101 "/^### DISTRO FEATURES$/a\\\n%s\n\n" %
102 ("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
103 d.setVar('configmangle_append',
104 "/^### CROSS$/a\\\n%s\n" %
105 ("\\n".join(["CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
106 "UCLIBC_EXTRA_CFLAGS=\"${UCLIBC_EXTRA_CFLAGS}\"",
107 "KERNEL_HEADERS=\"${STAGING_INCDIR}\"",
108 "RUNTIME_PREFIX=\"/\"",
109 "DEVEL_PREFIX=\"/${prefix}\"",
110 "SHARED_LIB_LOADER_PREFIX=\"/lib\"",
111 ])
112 ))
113 d.setVar('configmangle_append',
114 "/^### TGT$/a\\\nTARGET_ARCH=\"%s\"\\nTARGET_%s=y\n" %
115 ("${UCLIBC_ARCH}", "${UCLIBC_ARCH}"))
116 d.setVar('configmangle_append',
117 "/^### FPU$/a\\\n%s\n\n" % (["UCLIBC_HAS_FPU=y","# UCLIBC_HAS_FPU is not set"][d.getVar('TARGET_FPU', True) in [ 'soft' ]]))
118 if "${UCLIBC_ENDIAN}":
119 d.setVar('configmangle_append',
120 "/^### ABI$/a\\\nARCH_WANTS_%s_ENDIAN=y\n\n" % ("${UCLIBC_ENDIAN}"))
121 if "${UCLIBC_ABI}":
122 d.setVar('configmangle_append',
123 "/^### ABI$/a\\\nCONFIG_%s=y\n\n" % ("${UCLIBC_ABI}"))
124}
125
126python do_patch_append() {
127 import subprocess
128 subprocess.call("ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux", shell=True)
129 subprocess.call("ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm", shell=True)
130}
131
132do_configure() {
133 rm -f ${S}/.config
134
135 # OpenEmbedded splits the uClibc.config in two parts:
136 # uClibc.machine, uClibc.distro
137 echo "### uClibc.machine ###" >${S}/merged.config
138 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
139 echo "### uClibc.distro ###" >>${S}/merged.config
140 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
141 echo "### CROSS" >>${S}/merged.config
142 echo "### TGT" >>${S}/merged.config
143 echo "### MMU" >>${S}/merged.config
144 echo "### FPU" >>${S}/merged.config
145 echo "### ABI" >>${S}/merged.config
146 echo "### DISTRO FEATURES" >>${S}/merged.config
147 echo "### MIPS32_CHECK" >>${S}/merged.config
148
149 # Mangle the resulting .config depending on OE variables
150 sed -i -e '${configmangle}' ${S}/merged.config
151 cp ${S}/merged.config .config
152 merge_config.sh -r -n -m .config ${@" ".join(find_cfgs(d))}
153 cml1_do_configure
154
155}
156
157do_install() {
158 oe_runmake PREFIX=${D} install
159 rm -rf ${D}${includedir}/iconv.h
160}
161
162# build ldd, ldconfig and friends but only for full uclibc
163do_install_append_pn-uclibc () {
164 oe_runmake PREFIX=${D} "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" -C utils utils_install
165}
166