1 DESCRIPTION = "C library for embedded systems"
7 # For now, we will skip building of a gcc package if it is a uclibc one
8 # and our build is not a uclibc one, and we skip a glibc one if our build
11 # See the note in gcc/gcc_3.4.0.oe
14 python __anonymous () {
16 uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
18 raise bb.parse.SkipPackage("incompatible with target %s" %
19 bb.data.getVar('TARGET_OS', d, 1))
22 PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
23 PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}"
24 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
25 virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers"
26 INHIBIT_DEFAULT_DEPS = "1"
29 PACKAGES =+ "ldd uclibc-utils uclibc-gconv uclibc-thread-db"
31 uclibc_baselibs = "/lib/libcrypt*.so* /lib/libdl*.so \
32 /lib/libintl*.so* /lib/libm*.so \
33 /lib/libnsl*.so* /lib/libpthread*.so \
34 /lib/libresolv*.so* /lib/libutil*.so \
35 /lib/libuClibc*.so* /lib/ld*.so* \
36 /lib/libc*.so* /lib/libdl*.so* \
37 /lib/libm*.so* /lib/libutil*.so* \
38 /lib/libpthread*.so* /lib/librt*.so*"
39 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
40 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
41 FILES_ldd = "${bindir}/ldd"
42 FILES_uclibc-dev += "${libdir}/*.o"
43 FILES_uclibc-utils = "${bindir} ${sbindir}"
44 FILES_uclibc-gconv = "${libdir}/gconv"
45 FILES_uclibc-thread-db = "/lib/libthread_db*"
46 RPROVIDES_uclibc-dev += "libc-dev"
49 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
50 # build, it does not need to be unpacked, but we can't inhibit the unpacking
51 # in the current build system.
53 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
54 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
55 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
56 UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
58 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
59 file://uClibc.config \
60 file://uClibc.machine \
63 UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
64 UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
66 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
67 # the CFLAGS (for when building the utils).
68 OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
69 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
70 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'"
71 EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
72 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
74 KERNEL_SOURCE = "${CROSS_DIR}/${TARGET_SYS}/include"
76 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
77 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
78 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
79 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
80 s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \
81 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
82 ${@["s,.*UCLIBC_HAS_LOCALE.*,# UCLIBC_HAS_LOCALE is not set,;", ""][bb.data.getVar("USE_NLS", d, 1) == "yes"]}'
83 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
86 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
87 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
90 uclibcbuild_do_patch() {
91 ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
92 ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
94 ${@['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']}
98 bb.build.exec_func('base_do_patch', d)
99 bb.build.exec_func('uclibcbuild_do_patch', d)
104 # This stuff works like the standard OE OVERRIDES - keep the files
105 # in the same order as the default OVERRIDES (well, reverse order,
106 # because unlike overrides the last takes precedence)
107 cat ${WORKDIR}/uClibc.config ${WORKDIR}/uClibc.distro ${WORKDIR}/uClibc.machine >${S}/.config
109 perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
110 perl -i -p -e '${configmangle}' ${S}/.config
113 sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config
115 if [ "${TARGET_OS}" == "linux-gnueabi" -o "${TARGET_OS}" == "linux-uclibcgnueabi" ]; then
116 echo "CONFIG_ARM_EABI=y" >> ${S}/.config
118 echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config
125 # Install into the cross dir (this MUST be done first because we
126 # will install crt1.o in the install_dev stage and gcc needs it)
127 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
128 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
129 install_dev install_runtime
132 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
133 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
136 # We don't really need this
137 rm -f ${UCLIBC_PREFIX}/include/.cvsignore
139 # Fixup shared lib symlinks
140 ( cd ${UCLIBC_PREFIX}/lib
141 for f in c crypt dl m nsl pthread resolv thread_db util; do
142 ln -sf lib${f}.so.? lib${f}.so
146 # This conflicts with the c++ version of this header
147 rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h
149 # Install into the staging dir
150 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
151 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
152 install_dev install_runtime install_utils
154 # We don't really need this
155 rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
157 # Fixup shared lib symlinks
158 ( cd ${UCLIBC_STAGE_PREFIX}/lib
159 for f in c crypt dl m nsl pthread resolv thread_db util; do
160 ln -sf lib${f}.so.? lib${f}.so
164 # This conflicts with the c++ version of this header
165 rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
169 oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
170 install_dev install_runtime install_utils
172 # We don't really need this in ${includedir}
173 rm -f ${D}${prefix}/include/.cvsignore
175 # This conflicts with the c++ version of this header
176 rm -f ${D}${prefix}/include/bits/atomicity.h
178 # ugh.. uclibc doesn't like obeying our path variables.
179 if [ "${includedir}" != "${prefix}/include" ]; then
180 install -d ${D}${includedir}
181 mv ${D}${prefix}/include/* ${D}${includedir}/
182 rmdir ${D}${prefix}/include
185 if [ "${libdir}" != "${prefix}/lib" ]; then
186 install -d ${D}${libdir}
187 mv ${D}${prefix}/lib/* ${D}${libdir}/
188 rmdir ${D}${prefix}/lib
191 if [ "${bindir}" != "/usr/bin" ]; then
192 install -d ${D}${bindir}
193 mv ${D}/usr/bin/* ${D}${bindir}/