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"
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 # The last line (gdb and lib1) is for uclinux-uclibc builds
36 uclibc_baselibs = "/lib/libcrypt*.so* /lib/libdl*.so \
37 /lib/libintl*.so* /lib/libm*.so \
38 /lib/libnsl*.so* /lib/libpthread*.so \
39 /lib/libresolv*.so* /lib/libutil*.so \
40 /lib/libuClibc*.so* /lib/ld*.so* \
41 /lib/libc*.so* /lib/libdl*.so* \
42 /lib/libm*.so* /lib/libutil*.so* \
43 /lib/libpthread*.so* /lib/librt*.so* \
44 /usr/lib/libc.gdb /usr/lib/libc /lib/lib1.so \
46 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
47 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
48 FILES_ldd = "${bindir}/ldd"
49 FILES_uclibc-dev += "${libdir}/*.o"
50 FILES_uclibc-utils = "${bindir} ${sbindir}"
51 FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
52 FILES_uclibc-gconv = "${libdir}/gconv"
53 FILES_uclibc-thread-db = "/lib/libthread_db*"
54 RPROVIDES_uclibc-dev += "libc-dev"
57 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
58 # build, it does not need to be unpacked, but we can't inhibit the unpacking
59 # in the current build system.
61 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
62 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
63 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
64 UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
66 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
69 UCLIBC_STAGE_PREFIX = "${STAGING_DIR_HOST}${layout_prefix}"
71 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
72 # the CFLAGS (for when building the utils).
73 OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
74 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
75 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'"
76 EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
77 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
79 KERNEL_SOURCE = "${STAGING_INCDIR}"
80 KERNEL_HEADERS = "${STAGING_INCDIR}"
82 # Lets munge this via siteinfo.bbclass as well:
84 # ARCH_WANTS_BIG_ENDIAN=y
85 # ARCH_WANTS_LITTLE_ENDIAN is not set
87 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
88 s,^KERNEL_HEADERS=.*,KERNEL_HEADERS="${KERNEL_HEADERS}",g; \
89 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
90 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
91 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
92 s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \
93 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
94 ${@["s,.*UCLIBC_HAS_LOCALE.*,# UCLIBC_HAS_LOCALE is not set,;", ""][bb.data.getVar("USE_NLS", d, 1) == "yes"]}'
95 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
98 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
99 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
102 uclibcbuild_do_patch() {
103 ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
104 ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
106 ${@['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']}
110 bb.build.exec_func('base_do_patch', d)
111 bb.build.exec_func('uclibcbuild_do_patch', d)
117 # For uClibc 0.9.29, OpenEmbedded splits the uClibc.config in two parts:
118 # uClibc.machine and uClibc.distro. So, if they exist use them, otherwise
119 # use a uClibc.config
120 if [ -f ${WORKDIR}/uClibc.machine -a -f ${WORKDIR}/uClibc.distro ]; then
121 echo "### uClibc.machine ###" >${S}/merged.config
122 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
123 echo "### uClibc.distro ###" >>${S}/merged.config
124 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
126 echo "### uClibc.config ###" >${S}/merged.config
127 cat ${WORKDIR}/uClibc.config >>${S}/merged.config
129 cp ${S}/merged.config ${S}/.config
131 # Mangle the resulting .config depending on OE variables
132 perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
133 perl -i -p -e '${configmangle}' ${S}/.config
135 sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config
137 if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibcgnueabi" ]; then
138 echo "CONFIG_ARM_EABI=y" >> ${S}/.config
140 echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config
143 yes '' | oe_runmake oldconfig
147 # This MUST be done first because we
148 # will install crt1.o in the install_dev stage and gcc needs it
150 # Install into the staging dir
151 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
152 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
153 install_dev install_runtime
155 # Install into the staging dir
156 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
157 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
160 # We don't really need this
161 rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
163 # Fixup shared lib symlinks
164 ( cd ${UCLIBC_STAGE_PREFIX}/lib
165 for f in c crypt dl m nsl pthread resolv thread_db util; do
166 ln -sf lib${f}.so.? lib${f}.so
170 # This conflicts with the c++ version of this header
171 rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
175 # This MUST be done first because we
176 # will install crt1.o in the install_dev stage and gcc needs it)
177 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
178 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
179 install_dev install_runtime
181 oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
182 install_dev install_runtime
184 # We don't really need this in ${includedir}
185 rm -f ${D}${prefix}/include/.cvsignore
187 # This conflicts with the c++ version of this header
188 rm -f ${D}${prefix}/include/bits/atomicity.h
190 # ugh.. uclibc doesn't like obeying our path variables.
191 if [ "${includedir}" != "${prefix}/include" ]; then
192 install -d ${D}${includedir}
193 mv ${D}${prefix}/include/* ${D}${includedir}/
194 rmdir ${D}${prefix}/include
197 if [ "${libdir}" != "${prefix}/lib" ]; then
198 install -d ${D}${libdir}
199 mv ${D}${prefix}/lib/* ${D}${libdir}/
200 rmdir ${D}${prefix}/lib
203 if [ "${bindir}" != "/usr/bin" ]; then
204 install -d ${D}${bindir}
205 mv ${D}/usr/bin/* ${D}${bindir}/
210 oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \