summaryrefslogtreecommitdiff
path: root/recipes/dietlibc/dietlibc.inc
blob: 64bc6be96d1de7d79e5580e3037e440c4ac3afe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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"

INC_PR = "r2"

SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/dietlibc/dietlibc-${PV}.tar.bz2" 

#otherwise the whole run scripts got broken
do_configure () {
:
}

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
}

#no packages needed, all binaries will be compiled with -static
PACKAGES = " "

#otherwise the whole run scripts got broken
do_install () {
:
}

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 ${TOOLCHAIN_PATH}/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 ${TOOLCHAIN_PATH}/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
}