1 DESCRIPTION = "C library for embedded systems"
6 # For now, we will skip building of a gcc package if it is a uclibc one
7 # and our build is not a uclibc one, and we skip a glibc one if our build
10 # See the note in gcc/gcc_3.4.0.oe
13 python __anonymous () {
15 uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
17 raise bb.parse.SkipPackage("incompatible with target %s" %
18 bb.data.getVar('TARGET_OS', d, 1))
21 PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
22 PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}"
23 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
24 virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers ncurses-native pax-utils-native"
25 RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
27 # Blackfin needs a wrapper around ld
28 #DEPENDS_append_bfin = " elf2flt "
30 INHIBIT_DEFAULT_DEPS = "1"
33 PACKAGES =+ "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db"
35 LEAD_SONAME = "libc.so"
37 # The last line (gdb and lib1) is for uclinux-uclibc builds
38 uclibc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so \
39 ${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so \
40 ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so \
41 ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so \
42 ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so \
43 ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \
44 ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so \
45 ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so \
46 ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so \
47 ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so \
48 ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so \
49 ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \
51 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
52 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
53 FILES_ldd = "${bindir}/ldd"
54 FILES_uclibc-dev += "${libdir}/*.o"
55 FILES_uclibc-utils = "${bindir} ${sbindir}"
56 FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
57 FILES_uclibc-gconv = "${libdir}/gconv"
58 FILES_uclibc-thread-db = "/lib/libthread_db*"
59 RPROVIDES_uclibc-dev += "libc-dev virtual-libc-dev"
62 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
63 # build, it does not need to be unpacked, but we can't inhibit the unpacking
64 # in the current build system.
66 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
67 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
68 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
69 UCLIBC_LOCALE_URI_arm = "http://wiki.openembedded.net/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
71 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
72 file://uClibc.config \
73 http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2 \
75 UCLIBC_STAGE_PREFIX = "${STAGING_DIR_HOST}${layout_prefix}"
77 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
78 # the CFLAGS (for when building the utils).
79 OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}' \
80 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
81 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}' \
82 'HOSTCFLAGS=-I${STAGING_INCDIR_NATIVE}'"
83 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
85 KERNEL_SOURCE = "${STAGING_INCDIR}"
86 KERNEL_HEADERS = "${STAGING_INCDIR}"
88 # Lets munge this via siteinfo.bbclass as well:
90 # ARCH_WANTS_BIG_ENDIAN=y
91 # ARCH_WANTS_LITTLE_ENDIAN is not set
93 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
94 s,^KERNEL_HEADERS=.*,KERNEL_HEADERS="${KERNEL_HEADERS}",g; \
95 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
96 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
97 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
98 s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \
99 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
100 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \
101 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) in ['mips', 'mipsel', 'avr32']]} \
104 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
107 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
108 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
111 uclibcbuild_do_patch() {
112 ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
113 ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
115 ${@['cp %s/%s extra/locale' % (bb.data.getVar('DL_DIR', d, 1) or '', bb.data.getVar('UCLIBC_LOCALE_FILE', d, 1) or ''), ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}
119 bb.build.exec_func('base_do_patch', d)
120 bb.build.exec_func('uclibcbuild_do_patch', d)
126 # For uClibc 0.9.29, OpenEmbedded splits the uClibc.config in two parts:
127 # uClibc.machine and uClibc.distro. So, if they exist use them, otherwise
128 # use a uClibc.config
129 if [ -f ${WORKDIR}/uClibc.machine -a -f ${WORKDIR}/uClibc.distro ]; then
130 echo "### uClibc.machine ###" >${S}/merged.config
131 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
132 echo "### uClibc.distro ###" >>${S}/merged.config
133 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
135 echo "### uClibc.config ###" >${S}/merged.config
136 cat ${WORKDIR}/uClibc.config >>${S}/merged.config
138 cp ${S}/merged.config ${S}/.config
140 # Mangle the resulting .config depending on OE variables
141 perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
142 sed -i -e s:'$(CROSS)strip':true: ${S}/Rules.mak
143 perl -i -p -e '${configmangle}' ${S}/.config
145 sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config
147 if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibcgnueabi" ]; then
148 echo "CONFIG_ARM_EABI=y" >> ${S}/.config
150 echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config
153 yes '' | oe_runmake oldconfig
157 # This MUST be done first because we
158 # will install crt1.o in the install_dev stage and gcc needs it
160 # Install into the staging dir
161 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
162 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
163 install_dev install_runtime
165 # We don't really need this
166 rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
168 # Fixup shared lib symlinks
169 ( cd ${UCLIBC_STAGE_PREFIX}/lib
170 for f in c crypt dl m nsl pthread resolv thread_db util; do
171 ln -sf lib${f}.so.? lib${f}.so
175 # This conflicts with the c++ version of this header
176 rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
180 # Tis MUST be done first because we
181 # will install crt1.o in the install_dev stage and gcc needs it)
182 oe_runmake STRIPTOOL=true PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
183 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
184 install_dev install_runtime
186 oe_runmake STRIPTOOL=true PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
187 install_dev install_runtime
189 # We don't really need this in ${includedir}
190 rm -f ${D}${prefix}/include/.cvsignore
192 # This conflicts with the c++ version of this header
193 rm -f ${D}${prefix}/include/bits/atomicity.h
195 # ugh.. uclibc doesn't like obeying our path variables.
196 if [ "${includedir}" != "${prefix}/include" ]; then
197 install -d ${D}${includedir}
198 mv ${D}${prefix}/include/* ${D}${includedir}/
199 rmdir ${D}${prefix}/include
202 if [ "${libdir}" != "${prefix}/lib" ]; then
203 install -d ${D}${libdir}
204 mv ${D}${prefix}/lib/* ${D}${libdir}/
205 rmdir ${D}${prefix}/lib
208 oe_runmake "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" utils
209 oe_runmake STRIPTOOL=true PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
212 # oe_runstrip needs +x on files
213 chmod +x ${D}/${base_libdir}/*
215 if [ "${bindir}" != "/usr/bin" ]; then
216 install -d ${D}${bindir}
217 mv ${D}/usr/bin/* ${D}${bindir}/