summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/dietlibc.bbclass30
-rw-r--r--conf/checksums.ini4
-rw-r--r--packages/dietlibc/dietlibc_0.31.bb47
-rw-r--r--packages/dietlibc/files/ai_addrconfig.patch13
-rw-r--r--packages/dietlibc/files/ccache.patch74
-rw-r--r--packages/dietlibc/files/ceil.patch97
6 files changed, 265 insertions, 0 deletions
diff --git a/classes/dietlibc.bbclass b/classes/dietlibc.bbclass
new file mode 100644
index 0000000000..7c7b5fec81
--- /dev/null
+++ b/classes/dietlibc.bbclass
@@ -0,0 +1,30 @@
+DEPENDS =+ "dietlibc"
+
+def dietlibc_after_parse(d):
+ import bb
+ # Remove the NLS
+ cfg = oe_filter_out('--(dis|en)able-nls', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
+ # Remove shared and static and set it right
+ cfg += " --disable-nls --disbale-shared --enable-static"
+ bb.data.setVar('EXTRA_OECONF', cfg, d)
+ cfg = bb.data.getVar('EXTRA_OEMAKE', d, 1) or ""
+ cfg = oe_filter_out("\'CC=", bb.data.getVar('EXTRA_OEMAKE', d, 1) or "", d)
+ cfgtmp = "\'CC=diet ${CCACHE}"
+ cfgtmp += cfg
+ bb.data.setVar('EXTRA_OEMAKE', cfgtmp, d)
+
+python () {
+ dietlibc_after_parse(d)
+}
+
+set_dietlibc_env () {
+ export CC="diet ${CC}"
+}
+
+do_compile_prepend() {
+ set_dietlibc_env
+}
+
+do_configure_prepend() {
+ set_dietlibc_env
+}
diff --git a/conf/checksums.ini b/conf/checksums.ini
index c9d42b0dae..a486727fa8 100644
--- a/conf/checksums.ini
+++ b/conf/checksums.ini
@@ -4098,6 +4098,10 @@ sha256=31e8e536f5efd7d7d1d5f4e4458b42aa9cd7910acf3da933cb7fa3507cf7f752
md5=1fd89c902006271f00a774cc3183c15d
sha256=dcc1809e8477b95317a7ff503cdd8b6d3f85b8d83a3245252ff47cf631523620
+[http://kernel.org/pub/linux/libs/dietlibc/dietlibc-0.31.tar.bz2]
+md5=acb98d469ee932d902fdf6de07802b7c
+sha256=99613d6a67f747f52e4184c613f7cba5cbb76af237c9acd04742e3ca24cf56cd
+
[ftp://source.mvista.com/pub/xscale/pxa/diff-2.4.18-rmk7-pxa3.gz]
md5=249c7a63a506d302c96be26517a70298
sha256=ca569dfa1e5cfd2f4134f3f61f667bcfab5e15c7d43c8a6e835d384ac5b31a07
diff --git a/packages/dietlibc/dietlibc_0.31.bb b/packages/dietlibc/dietlibc_0.31.bb
new file mode 100644
index 0000000000..7720588b60
--- /dev/null
+++ b/packages/dietlibc/dietlibc_0.31.bb
@@ -0,0 +1,47 @@
+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"
+
+SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/dietlibc/dietlibc-${PV}.tar.bz2 \
+ file://ccache.patch;patch=1 \
+ file://ceil.patch;patch=1 \
+ file://ai_addrconfig.patch;patch=1 \
+ "
+
+#otherwise the whole run scripts got broken
+do_configure () {
+ echo "moo" > /dev/null 2>&1
+}
+
+do_compile () {
+ oe_runmake all CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" prefix=${STAGING_DIR_TARGET}/lib/dietlibc
+ oe_runmake all ARCH="${TARGET_ARCH}" CROSS=" " prefix=${STAGING_DIR_TARGET}/lib/dietlibc
+}
+
+#no packages needed, all binaries will be compiled with -static
+PACKAGES = " "
+
+#otherwise the whole run scripts got broken
+do_install () {
+ echo "moo" > /dev/null 2>&1
+}
+
+do_stage () {
+ DIETLIBC_BUILD_ARCH=`echo ${BUILD_ARCH} | sed -e s'/.86/386/'`
+ DIETLIBC_TARGET_ARCH=`echo ${TARGET_ARCH} | sed -e s'/.86/386/'`
+ rm -rf ${STAGING_DIR_TARGET}/lib/dietlibc || true
+ rm ${CROSS_DIR}/bin/diet || true
+ install -d ${STAGING_DIR_TARGET}/lib/dietlibc/lib-${DIETLIBC_TARGET_ARCH}
+ install -d ${STAGING_DIR_TARGET}/lib/dietlibc/include
+ for i in `find include -name \*.h`; do install -m 644 -D $i ${STAGING_DIR_TARGET}/lib/dietlibc/$i; done
+
+ install -m755 bin-${DIETLIBC_BUILD_ARCH}/diet-i ${CROSS_DIR}/bin/diet
+
+ cd bin-${DIETLIBC_TARGET_ARCH}
+ install -m 644 start.o libm.a libpthread.a librpc.a \
+ liblatin1.a libcompat.a libcrypt.a \
+ ${STAGING_DIR_TARGET}/lib/dietlibc/lib-${DIETLIBC_TARGET_ARCH}
+ install -m 644 dietlibc.a ${STAGING_DIR_TARGET}/lib/dietlibc/lib-${DIETLIBC_TARGET_ARCH}/libc.a
+}
+
diff --git a/packages/dietlibc/files/ai_addrconfig.patch b/packages/dietlibc/files/ai_addrconfig.patch
new file mode 100644
index 0000000000..5687e9f0f4
--- /dev/null
+++ b/packages/dietlibc/files/ai_addrconfig.patch
@@ -0,0 +1,13 @@
+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/packages/dietlibc/files/ccache.patch b/packages/dietlibc/files/ccache.patch
new file mode 100644
index 0000000000..f6d72f5370
--- /dev/null
+++ b/packages/dietlibc/files/ccache.patch
@@ -0,0 +1,74 @@
+Index: dietlibc-0.31/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 @@
+ }
+ }
+ {
+- 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 (tmp<cc) goto donttouch;
+@@ -139,7 +144,7 @@
+ if (tmp3<tmp2) tmp2=tmp3;
+ if (tmp2-cc>90) 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 {
+@@ -285,6 +290,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];
+@@ -294,9 +302,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
+@@ -314,7 +322,15 @@
+ #ifdef WANT_DYNAMIC
+ if (_link) { *dest++=d; }
+ #endif
+- for (i=2; i<argc; ++i) {
++ if (strcmp(argv[1],"ccache") == 0) {
++ i=3;
++ } else {
++ i=2;
++ }
++ for (i; i<argc; ++i) {
++ if (strstr(argv[i],"isystem") != NULL) {
++ continue;
++ }
+ if (mangleopts)
+ if (argv[i][0]=='-' && (argv[i][1]=='O' || argv[i][1]=='f' ||
+ (argv[i][1]=='m' && argv[i][2]!='3' && argv[i][2]!='6'))) {
+@@ -322,6 +338,8 @@
+ continue;
+ }
+ *dest++=argv[i];
++ *dest--;
++ *dest++;
+ }
+ #ifndef __DYN_LIB
+ if (compile || _link) {
diff --git a/packages/dietlibc/files/ceil.patch b/packages/dietlibc/files/ceil.patch
new file mode 100644
index 0000000000..e2295d27fa
--- /dev/null
+++ b/packages/dietlibc/files/ceil.patch
@@ -0,0 +1,97 @@
+Index: dietlibc-0.31/libm/ceil.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc-0.31/libm/ceil.c 2009-02-01 02:54:28.533109301 +0100
+@@ -0,0 +1,92 @@
++/* @(#)s_ceil.c 5.1 93/09/24 */
++/*
++ * ====================================================
++ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
++ *
++ * Developed at SunPro, a Sun Microsystems, Inc. business.
++ * Permission to use, copy, modify, and distribute this
++ * software is freely granted, provided that this notice
++ * is preserved.
++ * ====================================================
++ */
++
++/*
++ * ceil(x)
++ * Return x rounded toward -inf to integral value
++ * Method:
++ * Bit twiddling.
++ * Exception:
++ * Inexact flag raised if x not equal to ceil(x).
++ */
++
++#include <math.h>
++
++typedef union {
++ double value;
++ struct {
++ unsigned int lsw;
++ unsigned int msw;
++ } parts;
++} ieee_double_shape_type;
++
++/* Get two 32 bit ints from a double. */
++
++#define EXTRACT_WORDS(ix0,ix1,d) \
++do { \
++ ieee_double_shape_type ew_u; \
++ ew_u.value = (d); \
++ (ix0) = ew_u.parts.msw; \
++ (ix1) = ew_u.parts.lsw; \
++} while (0)
++
++#define INSERT_WORDS(d,ix0,ix1) \
++do { \
++ ieee_double_shape_type iw_u; \
++ iw_u.parts.msw = (ix0); \
++ iw_u.parts.lsw = (ix1); \
++ (d) = iw_u.value; \
++} while (0)
++
++static const double huge = 1.0e300;
++
++double ceil(double x)
++{
++ int i0,i1,j0;
++ unsigned int i,j;
++ EXTRACT_WORDS(i0,i1,x);
++ j0 = ((i0>>20)&0x7ff)-0x3ff;
++ if(j0<20) {
++ if(j0<0) { /* raise inexact if x != 0 */
++ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
++ if(i0<0) {i0=0x80000000;i1=0;}
++ else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
++ }
++ } else {
++ i = (0x000fffff)>>j0;
++ if(((i0&i)|i1)==0) return x; /* x is integral */
++ if(huge+x>0.0) { /* raise inexact flag */
++ if(i0>0) i0 += (0x00100000)>>j0;
++ i0 &= (~i); i1=0;
++ }
++ }
++ } else if (j0>51) {
++ if(j0==0x400) return x+x; /* inf or NaN */
++ else return x; /* x is integral */
++ } else {
++ i = ((unsigned int)(0xffffffff))>>(j0-20);
++ if((i1&i)==0) return x; /* x is integral */
++ if(huge+x>0.0) { /* raise inexact flag */
++ if(i0>0) {
++ if(j0==20) i0+=1;
++ else {
++ j = i1 + (1<<(52-j0));
++ if(j<i1) i0+=1; /* got a carry */
++ i1 = j;
++ }
++ }
++ i1 &= (~i);
++ }
++ }
++ INSERT_WORDS(x,i0,i1);
++ return x;
++}