From 6d7d5df79ae7a3d2fc1443c23d6dec2c49a31491 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Tue, 22 Feb 2011 10:02:50 +0100 Subject: dietlibc: rewrote recipes dietlibc was splitted into target and cross recipes. These recipes build now the latest stable version, from upstream CVS or from a github repository with lot of fixes. Signed-off-by: Enrico Scholz --- recipes/dietlibc/dietlibc-0.32.inc | 24 +++++++ recipes/dietlibc/dietlibc-0.32/ccache.patch | 74 -------------------- recipes/dietlibc/dietlibc-0.32/diethome.patch | 24 ------- recipes/dietlibc/dietlibc-0.32/getrlimit.patch | 12 ---- recipes/dietlibc/dietlibc-common.inc | 81 ++++++++++++++++++++++ recipes/dietlibc/dietlibc-cross.inc | 20 ++++++ recipes/dietlibc/dietlibc-cross_0.32.bb | 2 + recipes/dietlibc/dietlibc-cross_cvs.bb | 2 + recipes/dietlibc/dietlibc-cross_git.bb | 2 + recipes/dietlibc/dietlibc-cvs.inc | 27 ++++++++ recipes/dietlibc/dietlibc-git.inc | 15 +++++ recipes/dietlibc/dietlibc.inc | 79 +++++++++++++--------- recipes/dietlibc/dietlibc_0.31.bb | 11 --- recipes/dietlibc/dietlibc_0.32.bb | 16 ++--- recipes/dietlibc/dietlibc_cvs.bb | 9 +++ recipes/dietlibc/dietlibc_git.bb | 8 +++ recipes/dietlibc/files/ai_addrconfig.patch | 13 ---- recipes/dietlibc/files/ccache.patch | 36 +++++----- recipes/dietlibc/files/getrlimit.patch | 12 ++++ recipes/dietlibc/files/runtests-X.sh | 93 ++++++++++++++++++++++++++ 20 files changed, 367 insertions(+), 193 deletions(-) create mode 100644 recipes/dietlibc/dietlibc-0.32.inc delete mode 100644 recipes/dietlibc/dietlibc-0.32/ccache.patch delete mode 100644 recipes/dietlibc/dietlibc-0.32/diethome.patch delete mode 100644 recipes/dietlibc/dietlibc-0.32/getrlimit.patch create mode 100644 recipes/dietlibc/dietlibc-common.inc create mode 100644 recipes/dietlibc/dietlibc-cross.inc create mode 100644 recipes/dietlibc/dietlibc-cross_0.32.bb create mode 100644 recipes/dietlibc/dietlibc-cross_cvs.bb create mode 100644 recipes/dietlibc/dietlibc-cross_git.bb create mode 100644 recipes/dietlibc/dietlibc-cvs.inc create mode 100644 recipes/dietlibc/dietlibc-git.inc delete mode 100644 recipes/dietlibc/dietlibc_0.31.bb create mode 100644 recipes/dietlibc/dietlibc_cvs.bb create mode 100644 recipes/dietlibc/dietlibc_git.bb delete mode 100644 recipes/dietlibc/files/ai_addrconfig.patch create mode 100644 recipes/dietlibc/files/getrlimit.patch create mode 100644 recipes/dietlibc/files/runtests-X.sh diff --git a/recipes/dietlibc/dietlibc-0.32.inc b/recipes/dietlibc/dietlibc-0.32.inc new file mode 100644 index 0000000000..df94324b4a --- /dev/null +++ b/recipes/dietlibc/dietlibc-0.32.inc @@ -0,0 +1,24 @@ +SRC_URI = " \ + http://www.kernel.org/pub/linux/libs/dietlibc/dietlibc-${PV}.tar.bz2 \ + file://ccache.patch \ + file://ceil.patch \ + file://getrlimit.patch \ +" +SRC_URI[md5sum] = "0098761c17924c15e21d25acdda4a8b5" +SRC_URI[sha256sum] = "6613a2cae3b39e340779735d7500d284f5a691c5ed67e59a6057e0888726e458" + +# SMP build is broken +PARALLEL_MAKE = "" + +# prefer the 'git' version which fixes lot of issues +DEFAULT_PREFERENCE = "-2" + +# ARM EABI not fixable without complex patches +DEFAULT_PREFERENCE_arm = "-99" + +do_configure_append () { + install -d -m 0755 bin-${DIETLIBC_BUILD_ARCH} + install -d -m 0755 bin-${DIETLIBC_TARGET_ARCH} + + sed -i -e 's!\$(CROSS)strip!$(STRIP)!g' Makefile +} diff --git a/recipes/dietlibc/dietlibc-0.32/ccache.patch b/recipes/dietlibc/dietlibc-0.32/ccache.patch deleted file mode 100644 index fb067f038f..0000000000 --- a/recipes/dietlibc/dietlibc-0.32/ccache.patch +++ /dev/null @@ -1,74 +0,0 @@ -Index: dietlibc-0.32/diet.c -=================================================================== ---- dietlibc-0.32.orig/diet.c 2009-03-17 00:17:58.000000000 +0100 -+++ dietlibc-0.32/diet.c 2009-10-02 14:12:14.306929201 +0200 -@@ -132,7 +132,12 @@ - } - } - { -- char *cc=argv[1]; -+ char *cc; -+ if (!strcmp(argv[1],"ccache")) { -+ cc=argv[2]; -+ } else { -+ cc=argv[1]; -+ } - char *tmp=strchr(cc,0)-2; - char *tmp2,*tmp3; - if (tmp90) error("platform name too long!\n"); - shortplatform=platform+len; -- memmove(shortplatform,argv[1],(size_t)(tmp2-cc)); -+ memmove(shortplatform,cc,(size_t)(tmp2-cc)); - platform[tmp2-cc+len]=0; - if (shortplatform[0]=='i' && shortplatform[2]=='8' && shortplatform[3]=='6') shortplatform[1]='3'; - } else { -@@ -291,6 +296,9 @@ - - dest=newargv; - *dest++=argv[1]; -+ if (strcmp(argv[1],"ccache") == 0) { -+ *dest++=argv[2]; -+ } - if (argv[2]) { - if (!strcmp(argv[2],"-V")) { - *dest++=argv[2]; -@@ -300,9 +308,9 @@ - } else if (!memcmp(argv[2],"-V",2)) { - *dest++=argv[2]; - ++argv; -- --argc; - } - } -+ - #ifndef __DYN_LIB - if (_link) { *dest++=(char*)nostdlib; *dest++=dashstatic; *dest++=dashL; } - #else -@@ -320,7 +328,15 @@ - #ifdef WANT_DYNAMIC - if (_link) { *dest++=d; } - #endif -- for (i=2; i "$dst" +} + +dietlibc_install_dev () { + install -d -m 0755 ${D}${pkgarchdir} + install -d -m 0755 ${D}${pkglibdir}/include + + for i in `find include -name \*.h`; do + install -D -p -m 0644 $i ${D}${pkglibdir}/$i + done + + cd bin-${DIETLIBC_TARGET_ARCH} + install -p -m 0644 \ + start.o libm.a libpthread.a librpc.a liblatin1.a libcompat.a libcrypt.a \ + pstart.o libgmon.a \ + ${D}${pkgarchdir}/ + + # extra step because 'dietlibc.a' must be renamed to 'libc.a' + install -D -p -m 0644 dietlibc.a ${D}${pkgarchdir}/libc.a + cd - +} diff --git a/recipes/dietlibc/dietlibc-cross.inc b/recipes/dietlibc/dietlibc-cross.inc new file mode 100644 index 0000000000..25319f3b83 --- /dev/null +++ b/recipes/dietlibc/dietlibc-cross.inc @@ -0,0 +1,20 @@ +require dietlibc-common.inc + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS += "dietlibc" +RDEPENDS_${PN} += "dietlibc-dev dietlibc-headers" + +inherit cross + +libdir := "${STAGING_DIR_TARGET}${target_libdir}" + +do_compile () { + ln -sf dietfeatures-build.h dietfeatures.h + oe_runmake all ARCH="${DIETLIBC_BUILD_ARCH}" \ + CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}" \ + WHAT='$(OBJDIR)/diet-i' +} + +do_install() { + install -D -p -m 0755 bin-${DIETLIBC_BUILD_ARCH}/diet-i ${D}${bindir}/diet +} diff --git a/recipes/dietlibc/dietlibc-cross_0.32.bb b/recipes/dietlibc/dietlibc-cross_0.32.bb new file mode 100644 index 0000000000..2d8eee6398 --- /dev/null +++ b/recipes/dietlibc/dietlibc-cross_0.32.bb @@ -0,0 +1,2 @@ +require dietlibc-${PV}.inc +require dietlibc-cross.inc diff --git a/recipes/dietlibc/dietlibc-cross_cvs.bb b/recipes/dietlibc/dietlibc-cross_cvs.bb new file mode 100644 index 0000000000..14ab2c193d --- /dev/null +++ b/recipes/dietlibc/dietlibc-cross_cvs.bb @@ -0,0 +1,2 @@ +require dietlibc-cvs.inc +require dietlibc-cross.inc diff --git a/recipes/dietlibc/dietlibc-cross_git.bb b/recipes/dietlibc/dietlibc-cross_git.bb new file mode 100644 index 0000000000..f478db65c6 --- /dev/null +++ b/recipes/dietlibc/dietlibc-cross_git.bb @@ -0,0 +1,2 @@ +require dietlibc-git.inc +require dietlibc-cross.inc diff --git a/recipes/dietlibc/dietlibc-cvs.inc b/recipes/dietlibc/dietlibc-cvs.inc new file mode 100644 index 0000000000..c83b223140 --- /dev/null +++ b/recipes/dietlibc/dietlibc-cvs.inc @@ -0,0 +1,27 @@ +SRCDATE = "20110311" +PV = "0.32+cvs${SRCDATE}" + +SRC_URI = " \ + cvs://cvs@cvs.fefe.de/cvs;method=pserver;module=dietlibc;date=${SRCDATE} \ + file://ccache.patch \ + file://ceil.patch \ + file://getrlimit.patch \ +" + +S = "${WORKDIR}/dietlibc" + +# SMP build is broken +PARALLEL_MAKE = "" + +# prefer the 'git' version which fixes lot of issues +DEFAULT_PREFERENCE = "-1" + +# ARM EABI not fixable without complex patches +DEFAULT_PREFERENCE_arm = "-99" + +do_configure_append () { + install -d -m 0755 bin-${DIETLIBC_BUILD_ARCH} + install -d -m 0755 bin-${DIETLIBC_TARGET_ARCH} + + sed -i -e 's!\$(CROSS)strip!$(STRIP)!g' Makefile +} diff --git a/recipes/dietlibc/dietlibc-git.inc b/recipes/dietlibc/dietlibc-git.inc new file mode 100644 index 0000000000..e2e4595428 --- /dev/null +++ b/recipes/dietlibc/dietlibc-git.inc @@ -0,0 +1,15 @@ +SRCREV = "e1910c6289f754dcbf863d309ed8b72452a5de74" +_pv = "0.32" +PR = "r0" + +inherit gitpkgv + +PV = "${_pv}+gitr${SRCPV}" +PKGV = "${_pv}+gitr${GITPKGV}" + +SRC_URI = " \ + git://github.com/ensc/dietlibc.git;protocol=git;branch=master \ + file://ccache.patch \ + file://runtests-X.sh \ +" +S = "${WORKDIR}/git" diff --git a/recipes/dietlibc/dietlibc.inc b/recipes/dietlibc/dietlibc.inc index 5532648418..b1e3daf00c 100644 --- a/recipes/dietlibc/dietlibc.inc +++ b/recipes/dietlibc/dietlibc.inc @@ -1,42 +1,59 @@ -SECTION = "libs" -DESCRIPTION = "The diet libc is a libc that is optimized for small size. \ -It can be used to create small statically linked binaries" -LICENSE = "GPLv2" +require dietlibc-common.inc -INC_PR = "r3" +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS += "gcc-native virtual/${TARGET_PREFIX}gcc \ + virtual/${TARGET_PREFIX}binutils" -SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/dietlibc/dietlibc-${PV}.tar.bz2" +CFLAGS += "-fno-exceptions -std=gnu99 -Os -Wall -Wmissing-prototypes" +_target_test_cflags = "${CFLAGS} -L ${S}/bin-${DIETLIBC_TARGET_ARCH} \ + -fno-builtin" -#otherwise the whole run scripts got broken -do_configure () { -: +do_compile () { + ln -sf dietfeatures-build.h dietfeatures.h + oe_runmake all ARCH="${DIETLIBC_BUILD_ARCH}" \ + CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}" \ + WHAT='$(OBJDIR)/diet' + + ln -sf dietfeatures-target.h dietfeatures.h + oe_runmake all profiling ARCH="${DIETLIBC_TARGET_ARCH}" \ + CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" } -do_compile () { - oe_runmake all CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" prefix=${STAGING_DIR_TARGET}/lib/dietlibc - oe_runmake all ARCH="${TARGET_ARCH}" CC="${BUILD_CC}" CROSS="${HOST_PREFIX}" prefix=${STAGING_DIR_TARGET}/lib/dietlibc +do_install () { + dietlibc_install_dev + install -D -p -m 0755 bin-${DIETLIBC_TARGET_ARCH}/diet-i ${D}${bindir}/diet } -#no packages needed, all binaries will be compiled with -static -PACKAGES = "" +dietlibc_build_tests () { + rc=0 + # Allow to build as much as possible and return an error code when + # something went wrong + ( oe_runmake -C test all test DIET=${S}/bin-${DIETLIBC_BUILD_ARCH}/diet \ + CC="${CC}" CFLAGS="${_target_test_cflags}" LDFLAGS="${LDFLAGS}" \ + "$@" ) || rc=$? -#otherwise the whole run scripts got broken + ( oe_runmake -C test/inet all DIET=${S}/bin-${DIETLIBC_BUILD_ARCH}/diet \ + CC="${CC}" CFLAGS="${_target_test_cflags}" LDFLAGS="${LDFLAGS}" \ + "$@" ) || rc=$? -do_install () { - DIETLIBC_BUILD_ARCH=`echo ${BUILD_ARCH} | sed -e s'/.86/386/'` - DIETLIBC_TARGET_ARCH=`echo ${TARGET_ARCH} | sed -e s'/.86/386/'` - - install -d ${D}${libdir}/dietlibc/include - for i in `find include -name \*.h`; do install -m 644 -D $i ${D}${libdir}/dietlibc/$i; done - - install -d ${D}${bindir} - install -m755 bin-${DIETLIBC_BUILD_ARCH}/diet-i ${D}${bindir}/diet - - cd bin-${DIETLIBC_TARGET_ARCH} - install -d ${D}${libdir}/dietlibc/lib-${DIETLIBC_TARGET_ARCH} - install -m 644 start.o libm.a libpthread.a librpc.a \ - liblatin1.a libcompat.a libcrypt.a \ - ${D}${libdir}/dietlibc/lib-${DIETLIBC_TARGET_ARCH} - install -m 644 dietlibc.a ${D}${libdir}/dietlibc/lib-${DIETLIBC_TARGET_ARCH}/libc.a + return $rc } +dietlibc_do_full_test () { + ## Check for references to __NR_ symbols which indicates missing + ## syscall implementations + if ${TARGET_PREFIX}nm bin-${DIETLIBC_TARGET_ARCH}/*.a | grep 'U __NR_' >&2; then + echo "ERROR: unimplemented syscalls found" >&2 + exit 1 + fi + + + ## Build and run the testsuite (when emulator is available) + dietlibc_build_tests + + if type -p "$QEMU" && test x"$QEMU" != x"false"; then + cd test + env EMULATOR="${QEMU} ${QEMU_OPTIONS}" bash ${WORKDIR}/runtests-X.sh + cd - + fi +} diff --git a/recipes/dietlibc/dietlibc_0.31.bb b/recipes/dietlibc/dietlibc_0.31.bb deleted file mode 100644 index b5da9ec70c..0000000000 --- a/recipes/dietlibc/dietlibc_0.31.bb +++ /dev/null @@ -1,11 +0,0 @@ -require dietlibc.inc - -PR = "${INC_PR}.1" - -SRC_URI += "file://ccache.patch \ - file://ceil.patch \ - file://ai_addrconfig.patch \ - " - -SRC_URI[md5sum] = "acb98d469ee932d902fdf6de07802b7c" -SRC_URI[sha256sum] = "99613d6a67f747f52e4184c613f7cba5cbb76af237c9acd04742e3ca24cf56cd" diff --git a/recipes/dietlibc/dietlibc_0.32.bb b/recipes/dietlibc/dietlibc_0.32.bb index ce6c53fdb2..5654085549 100644 --- a/recipes/dietlibc/dietlibc_0.32.bb +++ b/recipes/dietlibc/dietlibc_0.32.bb @@ -1,13 +1,9 @@ +require dietlibc-${PV}.inc require dietlibc.inc -PR = "${INC_PR}.2" +inherit test -SRC_URI += "file://ccache.patch \ - file://ceil.patch \ - file://diethome.patch \ - file://getrlimit.patch \ - " - - -SRC_URI[md5sum] = "0098761c17924c15e21d25acdda4a8b5" -SRC_URI[sha256sum] = "6613a2cae3b39e340779735d7500d284f5a691c5ed67e59a6057e0888726e458" +do_test() { + # Testsuite does not build for ARM; try it nevertheless but ignore errors + dietlibc_build_tests -k || : +} diff --git a/recipes/dietlibc/dietlibc_cvs.bb b/recipes/dietlibc/dietlibc_cvs.bb new file mode 100644 index 0000000000..2b9a8170ff --- /dev/null +++ b/recipes/dietlibc/dietlibc_cvs.bb @@ -0,0 +1,9 @@ +require dietlibc-cvs.inc +require dietlibc.inc + +inherit test + +do_test() { + # Testsuite does not build for ARM; try it nevertheless but ignore errors + dietlibc_build_tests -k || : +} diff --git a/recipes/dietlibc/dietlibc_git.bb b/recipes/dietlibc/dietlibc_git.bb new file mode 100644 index 0000000000..14657297d6 --- /dev/null +++ b/recipes/dietlibc/dietlibc_git.bb @@ -0,0 +1,8 @@ +require dietlibc-git.inc +require dietlibc.inc + +inherit qemu test + +do_test() { + dietlibc_do_full_test +} diff --git a/recipes/dietlibc/files/ai_addrconfig.patch b/recipes/dietlibc/files/ai_addrconfig.patch deleted file mode 100644 index 5687e9f0f4..0000000000 --- a/recipes/dietlibc/files/ai_addrconfig.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: dietlibc-0.31/include/sys/socket.h -=================================================================== ---- dietlibc-0.31.orig/include/sys/socket.h 2009-02-03 13:39:38.475445568 +0100 -+++ dietlibc-0.31/include/sys/socket.h 2009-02-03 13:39:55.742105983 +0100 -@@ -439,6 +439,8 @@ - #define EAI_AGAIN -10 - #define EAI_SYSTEM -11 - -+#define AI_ADDRCONFIG 0 -+ - #define AI_NUMERICHOST 1 - #define AI_CANONNAME 2 - #define AI_PASSIVE 4 diff --git a/recipes/dietlibc/files/ccache.patch b/recipes/dietlibc/files/ccache.patch index 839b5b99a0..fb067f038f 100644 --- a/recipes/dietlibc/files/ccache.patch +++ b/recipes/dietlibc/files/ccache.patch @@ -1,8 +1,8 @@ -Index: dietlibc-0.31/diet.c +Index: dietlibc-0.32/diet.c =================================================================== ---- dietlibc-0.31.orig/diet.c 2006-08-27 15:49:00.000000000 +0200 -+++ dietlibc-0.31/diet.c 2009-01-31 22:56:06.828080683 +0100 -@@ -127,7 +127,12 @@ +--- dietlibc-0.32.orig/diet.c 2009-03-17 00:17:58.000000000 +0100 ++++ dietlibc-0.32/diet.c 2009-10-02 14:12:14.306929201 +0200 +@@ -132,7 +132,12 @@ } } { @@ -16,7 +16,7 @@ Index: dietlibc-0.31/diet.c char *tmp=strchr(cc,0)-2; char *tmp2,*tmp3; if (tmp90) error("platform name too long!\n"); shortplatform=platform+len; @@ -25,8 +25,8 @@ Index: dietlibc-0.31/diet.c platform[tmp2-cc+len]=0; if (shortplatform[0]=='i' && shortplatform[2]=='8' && shortplatform[3]=='6') shortplatform[1]='3'; } else { -@@ -285,6 +290,9 @@ - +@@ -291,6 +296,9 @@ + dest=newargv; *dest++=argv[1]; + if (strcmp(argv[1],"ccache") == 0) { @@ -35,7 +35,7 @@ Index: dietlibc-0.31/diet.c if (argv[2]) { if (!strcmp(argv[2],"-V")) { *dest++=argv[2]; -@@ -294,9 +302,9 @@ +@@ -300,9 +308,9 @@ } else if (!memcmp(argv[2],"-V",2)) { *dest++=argv[2]; ++argv; @@ -46,24 +46,24 @@ Index: dietlibc-0.31/diet.c #ifndef __DYN_LIB if (_link) { *dest++=(char*)nostdlib; *dest++=dashstatic; *dest++=dashL; } #else -@@ -314,7 +322,15 @@ +@@ -320,7 +328,15 @@ #ifdef WANT_DYNAMIC if (_link) { *dest++=d; } #endif - for (i=2; i/dev/null && failed=false || failed=true + + case $failed:$fail_known:$fail_bogus in + (false:false:*) res='OK';; + (false:true:true) res='OK (bogus)';; + (false:true:false) res="OK (unexpected)"; let ++rc;; + (true:*:true) res='FAIL (bogus)';; + (true:true:*) res="FAIL (known)";; + (true:false:*) res='FAIL'; let ++rc;; + esac + + ! tty -s || printf '\r' + + printf '%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" +done + +test $rc -eq 0 || \ + printf "%*s--> %u tests failed\n" $RUNTEST_INDENT '' $rc + +for d in $SUBDIRS; do + echo "--- entering directory $d ---" + let RUNTEST_INDENT+=2 + old_ns=$RUNTEST_NS + RUNTEST_NS=$RUNTEST_NS:$d + + cd $d && bash ./runtests-X.sh || let ++rc + + RUNTEST_NS=$old_ns + let RUNTEST_INDENT-=2 + + cd $OLDPWD || exit 1 +done + +test $rc -eq 0 && exit 0 || exit 1 -- cgit 1.2.3-korg