2010-09-27 14:44:05 +00:00
SUMMARY = " C library for embedded systems "
2011-05-22 19:02:12 +00:00
DESCRIPTION = " The name uClibc is an abbreviation for 'the \
microcontroller C library ' . For simplicity , uClibc is pronounced \
2010-09-27 14:44:05 +00:00
'yew-see-lib-see' . The goal of uClibc is to provide as much \
functionality as possible in a small amount of space , and it is intended \
primarily for embedded use . It is also highly configurable in supported \
features , at the cost of ABI differences for different configurations . \
uClibc has been designed from the ground up to be a C library for \
embedded Linux . It is NOT compatible with binaries linked against glibc . "
2012-01-18 07:06:08 +00:00
LICENSE = " LGPLv2.1+ "
2007-05-28 22:46:34 +00:00
SECTION = " libs "
2011-05-22 19:02:12 +00:00
LIC_FILES_CHKSUM = " file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
file :// COPYING . LIB . boilerplate ; md5 = aaddeadcddeb918297e0e4afc52ce46f \
2012-11-30 15:15:42 +00:00
file :// $ { S } / test / regex / testregex . c ; beginline = 1 ; endline = 31 ; md5 = 234 efb227d0a40677f895e4a1e26e960 "
2012-06-21 22:43:28 +00:00
INC_PR = " r8 "
2011-05-22 19:02:12 +00:00
require uclibc - config . inc
2012-06-28 21:36:53 +00:00
PATH_prepend = " ${ STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC } : "
2011-05-22 19:02:12 +00:00
TOOLCHAIN_OPTIONS = " --sysroot= ${ STAGING_DIR_TCBOOTSTRAP } "
# siteconfig.bbclass runs configure which needs a working compiler
# For the compiler to work we need a working libc yet libc isn't
# in the sysroots directory at this point. This means the libc.so
# linker script won't work as the --sysroot setting isn't correct.
# Here we create a hacked up libc linker script and pass in the right
# flags to let configure work. Ugly.
EXTRASITECONFIG = " CFLAGS=' ${ CFLAGS } -Wl,-L ${ WORKDIR } /site_config_libc -L ${ WORKDIR } /site_config_libc -L ${ SYSROOT_DESTDIR}${libdir } -L ${ SYSROOT_DESTDIR}${base_libdir } -Wl,-L ${ SYSROOT_DESTDIR}${libdir } -Wl,-L ${ SYSROOT_DESTDIR}${base_libdir } ' "
siteconfig_do_siteconfig_gencache_prepend = " \
mkdir - p $ { WORKDIR } / site_config_libc ; \
cp $ { SYSROOT_DESTDIR } $ { libdir } / libc . so $ { WORKDIR } / site_config_libc ; \
sed - i - e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' - e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' $ { WORKDIR } / site_config_libc / libc . so ; \
"
2007-05-28 22:46:34 +00:00
# For now, we will skip building of a gcc package if it is a uclibc one
# and our build is not a uclibc one, and we skip a glibc one if our build
# is a uclibc build.
2011-06-10 22:01:40 +00:00
COMPATIBLE_HOST = " .*-uclibc.* "
2007-05-28 22:46:34 +00:00
INHIBIT_DEFAULT_DEPS = " 1 "
2011-05-22 19:02:12 +00:00
# do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in
# the CFLAGS (when building the utils).
OEMAKE_NO_CC = " 'STRIPTOOL=true' 'LD= ${ LD } ' "
EXTRA_OEMAKE = " ${ OEMAKE_NO_CC } \
'HOSTCC=${BUILD_CC}' \
'HOST_CFLAGS=${BUILD_CFLAGS}' \
'CC=${CC}' \
ARCH = $ { UCLIBC_ARCH } "
2007-05-28 22:46:34 +00:00
EXTRA_OEMAKE_task_do_package = " ${ OEMAKE_NO_CC } "
2011-05-22 19:02:12 +00:00
# enable verbose output:
export V = " 2 "
2007-05-28 22:46:34 +00:00
2011-05-22 19:02:12 +00:00
# -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
#
CFLAGS_arm := " $ { @oe_filter_out('-fno-omit-frame-pointer', ' ${ CFLAGS } ', d)} "
UCLIBC_EXTRA_CFLAGS := " $ { @oe_filter_out('(-I \ S+|-i \ S+)', ' ${ CFLAGS } ', d)} "
UCLIBC_EXTRA_LDFLAGS := " $ { @oe_filter_out('(-L \ S+|-l \ S+)', ' ${ LDFLAGS } ', d)} "
2013-06-26 21:01:27 +00:00
2011-05-22 19:02:12 +00:00
do_compile_prepend () {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
2013-06-26 21:01:27 +00:00
oe_runmake pregen
2007-05-28 22:46:34 +00:00
}
2011-05-22 19:02:12 +00:00
configmangle = ' /^ KERNEL_HEADERS / d ; \
/^ RUNTIME_PREFIX / d ; \
/^ DEVEL_PREFIX / d ; \
/^ SHARED_LIB_LOADER_PREFIX / d ; \
/^ UCLIBC_EXTRA_CFLAGS / d ; \
s , .* UCLIBC_HAS_WCHAR .* , UCLIBC_HAS_WCHAR = y , g ; \
2012-03-03 10:59:25 +00:00
$ { @ [ " " , " s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,; " ][ d . getVar ( " ARM_INSTRUCTION_SET " , True ) != " arm " ]} \
$ { @ [ " " , " s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,; " ][ d . getVar ( " USE_NLS " , True ) == " yes " ]} \
$ { @ [ " " , " s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,; " ][ d . getVar ( " TARGET_ARCH " , True ) in [ 'mips' , 'mipsel' , 'mips64' , 'mips64el' , 'avr32' ]]} \
2011-05-22 19:02:12 +00:00
/^ CROSS / d ; \
/^ TARGET_ARCH =/ d ; \
/^ TARGET_ / s , ^ \ ([ ^= ] * \ ) .* , # \1 is not set,g; \
s , ^ DOSTRIP .* , # DOSTRIP is not set,g; \
/ _ [ EO ] * ABI / d ; \
/ HAS_FPU / d ; \
'
OE_FEATURES := " ${ @features_to_uclibc_conf(d) } "
OE_DEL := " ${ @features_to_uclibc_del(d) } "
python () {
2012-08-16 06:18:55 +00:00
if " ${ OE_DEL } " :
d . setVar ( 'configmangle_append' , " ${ OE_DEL } " + " \n " )
2012-10-20 02:57:07 +00:00
# by default uclibc uses mips1 ISA for o32 ABI
# if we use TARGET_CC_ARCH="-march=mips32" we end up
# with conflicting march options to gcc. Here we
# ask for MIPS32 ISA to match the chosen arch
if " mips32 " in d . getVar ( " TUNE_FEATURES " , True ) :
d . setVar ( 'configmangle_append' ,
" /^### MIPS32_CHECK $ /a \\ \n CONFIG_MIPS_ISA_MIPS32=y \n \n " )
2012-08-16 06:18:55 +00:00
if " ${ OE_FEATURES } " :
d . setVar ( 'configmangle_append' ,
2011-05-22 19:02:12 +00:00
" /^### DISTRO FEATURES $ /a \\ \n %s \n \n " %
2012-03-03 11:21:22 +00:00
( " \\ n " . join (( d . expand ( " ${ OE_FEATURES } " ) . split ( " \n " )))))
2012-08-16 06:18:55 +00:00
d . setVar ( 'configmangle_append' ,
2011-05-22 19:02:12 +00:00
" /^### CROSS $ /a \\ \n %s \n " %
( " \\ n " . join ([ " CROSS_COMPILER_PREFIX= \" ${ TARGET_PREFIX } \" " ,
" UCLIBC_EXTRA_CFLAGS= \" ${ UCLIBC_EXTRA_CFLAGS } \" " ,
" KERNEL_HEADERS= \" ${ STAGING_INCDIR } \" " ,
" RUNTIME_PREFIX= \" / \" " ,
" DEVEL_PREFIX= \" / ${ prefix } \" " ,
" SHARED_LIB_LOADER_PREFIX= \" /lib \" " ,
])
2011-11-25 14:25:16 +00:00
))
2012-08-16 06:18:55 +00:00
d . setVar ( 'configmangle_append' ,
2011-05-22 19:02:12 +00:00
" /^### TGT $ /a \\ \n TARGET_ARCH= \" %s \" \\ nTARGET_%s=y \n " %
2011-11-25 14:25:16 +00:00
( " ${ UCLIBC_ARCH } " , " ${ UCLIBC_ARCH } " ))
d . setVar ( 'configmangle_append' ,
2012-08-16 06:18:55 +00:00
" /^### FPU $ /a \\ \n %s \n \n " % ([ " UCLIBC_HAS_FPU=y " , " # UCLIBC_HAS_FPU is not set " ][ d . getVar ( 'TARGET_FPU' , True ) in [ 'soft' ]]))
if " ${ UCLIBC_ENDIAN } " :
d . setVar ( 'configmangle_append' ,
2011-11-25 14:25:16 +00:00
" /^### ABI $ /a \\ \n ARCH_WANTS_%s_ENDIAN=y \n \n " % ( " ${ UCLIBC_ENDIAN } " ))
2012-08-16 06:18:55 +00:00
if " ${ UCLIBC_ABI } " :
d . setVar ( 'configmangle_append' ,
2011-11-25 14:25:16 +00:00
" /^### ABI $ /a \\ \n CONFIG_%s=y \n \n " % ( " ${ UCLIBC_ABI } " ))
2007-05-28 22:46:34 +00:00
}
2012-05-29 14:53:06 +00:00
python do_patch_append () {
2012-08-16 06:18:55 +00:00
import subprocess
subprocess . call ( " ln -sf ${ STAGING_INCDIR } /linux ${ S } /include/linux " , shell = True )
subprocess . call ( " ln -sf ${ STAGING_INCDIR } /asm ${ S } /include/asm " , shell = True )
2007-05-28 22:46:34 +00:00
}
do_configure () {
2011-05-22 19:02:12 +00:00
rm - f $ { S } /. config
# OpenEmbedded splits the uClibc.config in two parts:
# uClibc.machine, uClibc.distro
echo " ### uClibc.machine ### " > $ { S } / merged . config
cat $ { WORKDIR } / uClibc . machine >> $ { S } / merged . config
echo " ### uClibc.distro ### " >> $ { S } / merged . config
cat $ { WORKDIR } / uClibc . distro >> $ { S } / merged . config
echo " ### CROSS " >> $ { S } / merged . config
echo " ### TGT " >> $ { S } / merged . config
echo " ### MMU " >> $ { S } / merged . config
echo " ### FPU " >> $ { S } / merged . config
echo " ### ABI " >> $ { S } / merged . config
echo " ### DISTRO FEATURES " >> $ { S } / merged . config
2012-10-20 02:57:07 +00:00
echo " ### MIPS32_CHECK " >> $ { S } / merged . config
2011-05-22 19:02:12 +00:00
# Mangle the resulting .config depending on OE variables
2011-06-11 09:09:00 +00:00
sed - i - e '${configmangle}' $ { S } / merged . config
2013-06-26 21:01:27 +00:00
cp $ { S } / merged . config . config
merge_config . sh - r - n - m . config $ { @ " " . join ( find_cfgs ( d ))}
cml1_do_configure
2011-05-22 19:02:12 +00:00
2007-05-28 22:46:34 +00:00
}
do_install () {
2011-05-22 19:02:12 +00:00
oe_runmake PREFIX = $ { D } install
2007-05-28 22:46:34 +00:00
}
2013-07-17 15:17:42 +00:00
# build ldd, ldconfig and friends but only for full uclibc
do_install_append_pn - uclibc () {
oe_runmake PREFIX = $ { D } " SSP_ALL_CFLAGS= ${ TARGET_LINK_HASH_STYLE } " - C utils utils_install
}