summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/packages/meta/meta-toolchain.bb93
1 files changed, 93 insertions, 0 deletions
diff --git a/meta/packages/meta/meta-toolchain.bb b/meta/packages/meta/meta-toolchain.bb
new file mode 100644
index 0000000000..d81140413e
--- /dev/null
+++ b/meta/packages/meta/meta-toolchain.bb
@@ -0,0 +1,93 @@
1DESCRIPTION = "Meta package for building a installable toolchain"
2LICENSE = "MIT"
3DEPENDS = "ipkg-native ipkg-utils-native fakeroot-native sed-native"
4PR = "r0"
5
6inherit sdk
7
8PACKAGES = ""
9
10BUILD_ALL_DEPS = "1"
11do_build[recrdeptask] = "do_build"
12
13SDK_DIR = "${WORKDIR}/sdk"
14SDK_OUTPUT = "${SDK_DIR}/image"
15SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
16
17IPKG_HOST = "ipkg-cl -f ${SDK_DIR}/ipkg-host.conf -o ${SDK_OUTPUT}"
18IPKG_TARGET = "ipkg-cl -f ${SDK_DIR}/ipkg-target.conf -o ${SDK_OUTPUT}/${prefix}"
19
20HOST_INSTALL = "\
21 binutils-cross-sdk \
22 gcc-cross-sdk \
23 gdb-cross"
24TARGET_INSTALL = "\
25 task-sdk-bare \
26 "
27
28RDEPENDS = "${TARGET_INSTALL} ${HOST_INSTALL}"
29
30do_populate_sdk() {
31 touch ${DEPLOY_DIR_IPK}/Packages
32 ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK}
33
34 rm -rf ${SDK_OUTPUT}
35 mkdir -p ${SDK_OUTPUT}
36
37 cat <<EOF >${SDK_DIR}/ipkg-host.conf
38src oe file:${DEPLOY_DIR_IPK}
39arch ${BUILD_ARCH} 1
40EOF
41 cat <<EOF >${SDK_DIR}/ipkg-target.conf
42src oe file:${DEPLOY_DIR_IPK}
43EOF
44 ipkgarchs="${PACKAGE_ARCHS}"
45 priority=1
46 for arch in $ipkgarchs; do
47 echo "arch $arch $priority" >> ${SDK_DIR}/ipkg-target.conf
48 priority=$(expr $priority + 5)
49 done
50
51 rm -r ${SDK_OUTPUT}
52 mkdir -p ${SDK_OUTPUT}
53
54 ${IPKG_HOST} update
55 ${IPKG_HOST} -nodeps install ${HOST_INSTALL}
56
57 ${IPKG_TARGET} update
58 ${IPKG_TARGET} install ${TARGET_INSTALL}
59
60 mkdir -p ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}
61 cp -pPR ${SDK_OUTPUT}/${prefix}/usr/* ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}
62 rm -rf ${SDK_OUTPUT}/${prefix}/usr/
63
64 cp -pPR ${SDK_OUTPUT}/${prefix}/lib/* ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/lib
65 rm -rf ${SDK_OUTPUT}/${prefix}/lib/*
66
67 mv ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/lib/gcc* ${SDK_OUTPUT}/${prefix}/lib
68
69 cp -pPR ${TMPDIR}/cross/${TARGET_SYS}/include/linux/ ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/include/
70 cp -pPR ${TMPDIR}/cross/${TARGET_SYS}/include/asm/ ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/include/
71 chmod -R a+r ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/include/
72 find ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/include/ -type d | xargs chmod +x
73
74 echo 'GROUP ( libpthread.so.0 libpthread_nonshared.a )' > ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/lib/libpthread.so
75 echo 'GROUP ( libc.so.6 libc_nonshared.a )' > ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/lib/libc.so
76 # remove unwanted housekeeping files
77 mv ${SDK_OUTPUT}${libdir}/../${TARGET_SYS}/lib/ipkg/status ${SDK_OUTPUT}/${prefix}/package-status
78 rm -rf ${SDK_OUTPUT}${libdir}/ipkg
79
80 # remove unwanted executables
81 rm -rf ${SDK_OUTPUT}/${prefix}/sbin ${SDK_OUTPUT}/${prefix}/etc
82
83 # remove broken .la files
84 rm ${SDK_OUTPUT}/${prefix}/${TARGET_SYS}/lib/*.la
85
86 mkdir -p ${SDK_DEPLOY}
87 cd ${SDK_OUTPUT}
88 fakeroot tar cfj ${SDK_DEPLOY}/${DISTRO}-${DISTRO_VERSION}-${TARGET_ARCH}-oe-toolchain.tar.bz2 .
89}
90
91do_populate_sdk[nostamp] = "1"
92do_populate_sdk[recrdeptask] = "do_package_write"
93addtask populate_sdk before do_build after do_install