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 = "/lib/libcrypt*.so* /lib/libdl*.so \
39 /lib/libintl*.so* /lib/libm*.so \
40 /lib/libnsl*.so* /lib/libpthread*.so \
41 /lib/libresolv*.so* /lib/libutil*.so \
42 /lib/libuClibc*.so* /lib/ld*.so* \
43 /lib/libc*.so* /lib/libdl*.so* \
44 /lib/libm*.so* /lib/libutil*.so* \
45 /lib/libpthread*.so* /lib/librt*.so* \
46 /usr/lib/libc.gdb /usr/lib/libc /lib/lib1.so \
48 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
49 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
50 FILES_ldd = "${bindir}/ldd"
51 FILES_uclibc-dev += "${libdir}/*.o"
52 FILES_uclibc-utils = "${bindir} ${sbindir}"
53 FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
54 FILES_uclibc-gconv = "${libdir}/gconv"
55 FILES_uclibc-thread-db = "/lib/libthread_db*"
56 RPROVIDES_uclibc-dev += "libc-dev virtual-libc-dev"
59 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
60 # build, it does not need to be unpacked, but we can't inhibit the unpacking
61 # in the current build system.
63 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
64 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
65 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
66 UCLIBC_LOCALE_URI_arm = "http://wiki.openembedded.net/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
68 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
71 UCLIBC_STAGE_PREFIX = "${STAGING_DIR_HOST}${layout_prefix}"
73 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
74 # the CFLAGS (for when building the utils).
75 OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}' \
76 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
77 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}' \
78 'HOSTCFLAGS=-I${STAGING_INCDIR_NATIVE}'"
79 EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
80 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
82 KERNEL_SOURCE = "${STAGING_INCDIR}"
83 KERNEL_HEADERS = "${STAGING_INCDIR}"
85 # Lets munge this via siteinfo.bbclass as well:
87 # ARCH_WANTS_BIG_ENDIAN=y
88 # ARCH_WANTS_LITTLE_ENDIAN is not set
90 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
91 s,^KERNEL_HEADERS=.*,KERNEL_HEADERS="${KERNEL_HEADERS}",g; \
92 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
93 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
94 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
95 s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \
96 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
97 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \
98 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) == "avr32"]} \
101 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
104 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
105 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
108 uclibcbuild_do_patch() {
109 ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
110 ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
112 ${@['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']}
116 bb.build.exec_func('base_do_patch', d)
117 bb.build.exec_func('uclibcbuild_do_patch', d)
123 # For uClibc 0.9.29, OpenEmbedded splits the uClibc.config in two parts:
124 # uClibc.machine and uClibc.distro. So, if they exist use them, otherwise
125 # use a uClibc.config
126 if [ -f ${WORKDIR}/uClibc.machine -a -f ${WORKDIR}/uClibc.distro ]; then
127 echo "### uClibc.machine ###" >${S}/merged.config
128 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
129 echo "### uClibc.distro ###" >>${S}/merged.config
130 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
132 echo "### uClibc.config ###" >${S}/merged.config
133 cat ${WORKDIR}/uClibc.config >>${S}/merged.config
135 cp ${S}/merged.config ${S}/.config
137 # Mangle the resulting .config depending on OE variables
138 perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
139 sed -i -e s:'$(CROSS)strip':true: ${S}/Rules.mak
140 perl -i -p -e '${configmangle}' ${S}/.config
142 sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config
144 if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibcgnueabi" ]; then
145 echo "CONFIG_ARM_EABI=y" >> ${S}/.config
147 echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config
150 yes '' | oe_runmake oldconfig
154 # This MUST be done first because we
155 # will install crt1.o in the install_dev stage and gcc needs it
157 # Install into the staging dir
158 oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
159 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
160 install_dev install_runtime
162 # We don't really need this
163 rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
165 # Fixup shared lib symlinks
166 ( cd ${UCLIBC_STAGE_PREFIX}/lib
167 for f in c crypt dl m nsl pthread resolv thread_db util; do
168 ln -sf lib${f}.so.? lib${f}.so
172 # This conflicts with the c++ version of this header
173 rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
177 # Tis MUST be done first because we
178 # will install crt1.o in the install_dev stage and gcc needs it)
179 oe_runmake STRIPTOOL=true PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
180 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
181 install_dev install_runtime
183 oe_runmake STRIPTOOL=true PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
184 install_dev install_runtime
186 # We don't really need this in ${includedir}
187 rm -f ${D}${prefix}/include/.cvsignore
189 # This conflicts with the c++ version of this header
190 rm -f ${D}${prefix}/include/bits/atomicity.h
192 # ugh.. uclibc doesn't like obeying our path variables.
193 if [ "${includedir}" != "${prefix}/include" ]; then
194 install -d ${D}${includedir}
195 mv ${D}${prefix}/include/* ${D}${includedir}/
196 rmdir ${D}${prefix}/include
199 if [ "${libdir}" != "${prefix}/lib" ]; then
200 install -d ${D}${libdir}
201 mv ${D}${prefix}/lib/* ${D}${libdir}/
202 rmdir ${D}${prefix}/lib
205 if [ "${bindir}" != "/usr/bin" ]; then
206 install -d ${D}${bindir}
207 mv ${D}/usr/bin/* ${D}${bindir}/
211 oe_runmake "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" utils
212 oe_runmake STRIPTOOL=true PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
215 # oe_runstrip needs +x on files
216 chmod +x ${D}/${base_libdir}/*