1 DESCRIPTION = "C library for embedded systems"
5 MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
8 # For now, we will skip building of a gcc package if it is a uclibc one
9 # and our build is not a uclibc one, and we skip a glibc one if our build
12 # See the note in gcc/gcc_3.4.0.oe
15 python __anonymous () {
17 uc_os = (re.match('.*uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None)
19 raise bb.parse.SkipPackage("incompatible with target %s" %
20 bb.data.getVar('TARGET_OS', d, 1))
23 PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
24 PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}"
25 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
26 virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers"
27 INHIBIT_DEFAULT_DEPS = "1"
30 PACKAGES = "uclibc ldd uclibc-utils uclibc-gconv uclibc-dev uclibc-doc uclibc-thread-db"
32 uclibc_baselibs = "/lib/libcrypt*.so* /lib/libdl*.so \
33 /lib/libintl*.so* /lib/libm*.so \
34 /lib/libnsl*.so* /lib/libpthread*.so \
35 /lib/libresolv*.so* /lib/libutil*.so \
36 /lib/libuClibc*.so* /lib/ld*.so* \
37 /lib/libc*.so* /lib/libdl*.so* \
38 /lib/libm*.so* /lib/libutil*.so* \
39 /lib/libpthread*.so* /lib/librt*.so*"
40 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
41 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
42 FILES_ldd = "${bindir}/ldd"
43 FILES_uclibc-dev += "${libdir}/*.o"
44 FILES_uclibc-utils = "${bindir} ${sbindir}"
45 FILES_uclibc-gconv = "${libdir}/gconv"
46 FILES_uclibc-thread-db = "/lib/libthread_db*"
47 RPROVIDES_uclibc-dev += "libc-dev"
50 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
51 # build, it does not need to be unpacked, but we can't inhibit the unpacking
52 # in the current build system.
54 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
55 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
56 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
57 UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
59 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
62 UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
63 UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
65 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
66 # the CFLAGS (for when building the utils).
67 OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
68 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
69 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'"
70 EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
71 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
73 KERNEL_SOURCE = "${CROSS_DIR}/${TARGET_SYS}/include"
75 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
76 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
77 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
78 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
79 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
80 ${@["s,.*UCLIBC_HAS_LOCALE.*,# UCLIBC_HAS_LOCALE is not set,;", ""][bb.data.getVar("USE_NLS", d, 1) == "yes"]}'
81 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
84 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
85 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
88 uclibcbuild_do_patch() {
89 ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
90 ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
92 ${@['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']}
96 bb.build.exec_func('base_do_patch', d)
97 bb.build.exec_func('uclibcbuild_do_patch', d)
101 cp ${WORKDIR}/uClibc.config ${S}/.config
103 perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
104 perl -i -p -e '${configmangle}' ${S}/.config
110 # Install into the cross dir (this MUST be done first because we
111 # will install crt1.o in the install_dev stage and gcc needs it)
112 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
113 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
114 install_dev install_runtime
117 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
118 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
121 # We don't really need this
122 rm -f ${UCLIBC_PREFIX}/include/.cvsignore
124 # Fixup shared lib symlinks
125 ( cd ${UCLIBC_PREFIX}/lib
126 for f in c crypt dl m nsl pthread resolv thread_db util; do
127 ln -sf lib${f}.so.? lib${f}.so
131 # This conflicts with the c++ version of this header
132 rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h
134 # Install into the staging dir
135 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
136 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
137 install_dev install_runtime install_utils
139 # We don't really need this
140 rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
142 # Fixup shared lib symlinks
143 ( cd ${UCLIBC_STAGE_PREFIX}/lib
144 for f in c crypt dl m nsl pthread resolv thread_db util; do
145 ln -sf lib${f}.so.? lib${f}.so
149 # This conflicts with the c++ version of this header
150 rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
154 oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
155 install_dev install_runtime install_utils
157 # We don't really need this in ${includedir}
158 rm -f ${D}${prefix}/include/.cvsignore
160 # This conflicts with the c++ version of this header
161 rm -f ${D}${prefix}/include/bits/atomicity.h
163 # ugh.. uclibc doesn't like obeying our path variables.
164 if [ "${includedir}" != "${prefix}/include" ]; then
165 install -d ${D}${includedir}
166 mv ${D}${prefix}/include/* ${D}${includedir}/
167 rmdir ${D}${prefix}/include
170 if [ "${libdir}" != "${prefix}/lib" ]; then
171 install -d ${D}${libdir}
172 mv ${D}${prefix}/lib/* ${D}${libdir}/
173 rmdir ${D}${prefix}/lib
176 if [ "${bindir}" != "/usr/bin" ]; then
177 install -d ${D}${bindir}
178 mv ${D}/usr/bin/* ${D}${bindir}/