diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2011-01-30 15:56:51 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-01 23:59:38 +0000 |
commit | d22b4357c981dfd7b44dcaae59d276edc0f78dce (patch) | |
tree | 8091ab41fbae4084e7f59993fef4a5478ff2a730 | |
parent | 63e220c1e8e4bf94105372156cb1ef7a6d652682 (diff) | |
download | poky-d22b4357c981dfd7b44dcaae59d276edc0f78dce.tar.gz |
populate_sdk.bbclass/meta-toolchain: Made populate_sdk task more generic
Move the populate_sdk task out of meta-toolchain. Made it more generic
to support rpm/deb package format.
This commit is dependant on a series of commit:
2ea0406e4516fc59dff86cb4adc35c82cb774c2f
7ffa45b7cfea24dae1b51f40cfc807bf78b21b66
bf201a74c243942af3fcae6f174496bdd819dbc0
3d29933f2925efe8a84f10efdf50396031c33ae4
3d29933f2925efe8a84f10efdf50396031c33ae4
9c724dbf57e610a9e06bbdce38383dee3ac49281
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
-rw-r--r-- | meta/classes/populate_sdk.bbclass | 82 | ||||
-rw-r--r-- | meta/recipes-core/meta/meta-toolchain.bb | 103 |
2 files changed, 85 insertions, 100 deletions
diff --git a/meta/classes/populate_sdk.bbclass b/meta/classes/populate_sdk.bbclass new file mode 100644 index 0000000000..7e260ef38d --- /dev/null +++ b/meta/classes/populate_sdk.bbclass | |||
@@ -0,0 +1,82 @@ | |||
1 | inherit meta toolchain-scripts | ||
2 | inherit populate_sdk_${IMAGE_PKGTYPE} | ||
3 | |||
4 | SDK_DIR = "${WORKDIR}/sdk" | ||
5 | SDK_OUTPUT = "${SDK_DIR}/image" | ||
6 | SDK_DEPLOY = "${TMPDIR}/deploy/sdk" | ||
7 | |||
8 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${TARGET_SYS}" | ||
9 | |||
10 | TOOLCHAIN_HOST_TASK ?= "task-sdk-host task-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
11 | TOOLCHAIN_TARGET_TASK ?= "task-poky-standalone-sdk-target task-poky-standalone-sdk-target-dbg" | ||
12 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${DISTRO_VERSION}" | ||
13 | |||
14 | RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | ||
15 | DEPENDS = "virtual/fakeroot-native sed-native" | ||
16 | |||
17 | PID = "${@os.getpid()}" | ||
18 | |||
19 | EXCLUDE_FROM_WORLD = "1" | ||
20 | |||
21 | fakeroot do_populate_sdk() { | ||
22 | rm -rf ${SDK_OUTPUT} | ||
23 | mkdir -p ${SDK_OUTPUT} | ||
24 | |||
25 | populate_sdk_${IMAGE_PKGTYPE} | ||
26 | |||
27 | # Don't ship any libGL in the SDK | ||
28 | rm -rf ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/libGL* | ||
29 | |||
30 | # Can copy pstage files here | ||
31 | # target_pkgs=`cat ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/var/lib/opkg/status | grep Package: | cut -f 2 -d ' '` | ||
32 | |||
33 | # Fix or remove broken .la files | ||
34 | #rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}/lib/*.la | ||
35 | rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la | ||
36 | |||
37 | # Link the ld.so.cache file into the hosts filesystem | ||
38 | ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache | ||
39 | |||
40 | # Setup site file for external use | ||
41 | siteconfig=${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS} | ||
42 | touch $siteconfig | ||
43 | for sitefile in ${CONFIG_SITE} ; do | ||
44 | cat $sitefile >> $siteconfig | ||
45 | done | ||
46 | |||
47 | toolchain_create_sdk_env_script | ||
48 | |||
49 | # Add version information | ||
50 | versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} | ||
51 | touch $versionfile | ||
52 | echo 'Distro: ${DISTRO}' >> $versionfile | ||
53 | echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile | ||
54 | echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile | ||
55 | echo 'Timestamp: ${DATETIME}' >> $versionfile | ||
56 | |||
57 | # Package it up | ||
58 | mkdir -p ${SDK_DEPLOY} | ||
59 | cd ${SDK_OUTPUT} | ||
60 | tar --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 . | ||
61 | } | ||
62 | |||
63 | populate_sdk_log_check() { | ||
64 | for target in $* | ||
65 | do | ||
66 | lf_path="${WORKDIR}/temp/log.do_$target.${PID}" | ||
67 | |||
68 | echo "log_check: Using $lf_path as logfile" | ||
69 | |||
70 | if test -e "$lf_path" | ||
71 | then | ||
72 | ${IMAGE_PKGTYPE}_log_check $target $lf_path | ||
73 | else | ||
74 | echo "Cannot find logfile [$lf_path]" | ||
75 | fi | ||
76 | echo "Logfile is clean" | ||
77 | done | ||
78 | } | ||
79 | |||
80 | do_populate_sdk[nostamp] = "1" | ||
81 | do_populate_sdk[recrdeptask] = "do_package_write" | ||
82 | addtask populate_sdk before do_build after do_install | ||
diff --git a/meta/recipes-core/meta/meta-toolchain.bb b/meta/recipes-core/meta/meta-toolchain.bb index 4aed9c276e..feff9ac386 100644 --- a/meta/recipes-core/meta/meta-toolchain.bb +++ b/meta/recipes-core/meta/meta-toolchain.bb | |||
@@ -1,106 +1,9 @@ | |||
1 | DESCRIPTION = "Meta package for building a installable toolchain" | 1 | DESCRIPTION = "Meta package for building a installable toolchain" |
2 | LICENSE = "MIT" | 2 | LICENSE = "MIT" |
3 | DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native" | 3 | |
4 | PR = "r1" | ||
4 | 5 | ||
5 | LIC_FILES_CHKSUM = "file://${POKYBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ | 6 | LIC_FILES_CHKSUM = "file://${POKYBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ |
6 | file://${POKYBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | 7 | file://${POKYBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
7 | 8 | ||
8 | inherit meta toolchain-scripts | 9 | inherit populate_sdk |
9 | |||
10 | SDK_DIR = "${WORKDIR}/sdk" | ||
11 | SDK_OUTPUT = "${SDK_DIR}/image" | ||
12 | SDK_DEPLOY = "${TMPDIR}/deploy/sdk" | ||
13 | |||
14 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${TARGET_SYS}" | ||
15 | |||
16 | IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT} --force-overwrite" | ||
17 | IPKG_TARGET = "opkg-cl -f ${IPKGCONF_TARGET} -o ${SDK_OUTPUT}/${SDKTARGETSYSROOT} --force-overwrite" | ||
18 | |||
19 | TOOLCHAIN_HOST_TASK ?= "task-sdk-host task-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
20 | TOOLCHAIN_TARGET_TASK ?= "task-poky-standalone-sdk-target task-poky-standalone-sdk-target-dbg" | ||
21 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${DISTRO_VERSION}" | ||
22 | |||
23 | RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | ||
24 | |||
25 | EXCLUDE_FROM_WORLD = "1" | ||
26 | |||
27 | do_populate_sdk() { | ||
28 | rm -rf ${SDK_OUTPUT} | ||
29 | mkdir -p ${SDK_OUTPUT} | ||
30 | mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/ | ||
31 | mkdir -p ${SDK_OUTPUT}/${SDKTARGETSYSROOT}${localstatedir}/lib/opkg/ | ||
32 | |||
33 | rm -f ${IPKGCONF_TARGET} | ||
34 | touch ${IPKGCONF_TARGET} | ||
35 | rm -f ${IPKGCONF_SDK} | ||
36 | touch ${IPKGCONF_SDK} | ||
37 | |||
38 | package_update_index_ipk | ||
39 | package_generate_ipkg_conf | ||
40 | |||
41 | for arch in ${PACKAGE_ARCHS}; do | ||
42 | revipkgarchs="$arch $revipkgarchs" | ||
43 | done | ||
44 | |||
45 | ${IPKG_HOST} update | ||
46 | ${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK} | ||
47 | |||
48 | ${IPKG_TARGET} update | ||
49 | ${IPKG_TARGET} install ${TOOLCHAIN_TARGET_TASK} | ||
50 | |||
51 | install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg | ||
52 | mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/ | ||
53 | rm -Rf ${SDK_OUTPUT}/var | ||
54 | |||
55 | # Don't ship any libGL in the SDK | ||
56 | rm -rf ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/libGL* | ||
57 | |||
58 | install -d ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/${sysconfdir} | ||
59 | install -m 0644 ${IPKGCONF_TARGET} ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/${sysconfdir}/ | ||
60 | |||
61 | install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir} | ||
62 | install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/ | ||
63 | |||
64 | # Can copy pstage files here | ||
65 | # target_pkgs=`cat ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/var/lib/opkg/status | grep Package: | cut -f 2 -d ' '` | ||
66 | |||
67 | # Fix or remove broken .la files | ||
68 | for i in `find ${SDK_OUTPUT}/${SDKTARGETSYSROOT} -name \*.la`; do | ||
69 | sed -i -e "/^dependency_libs=/s,\([[:space:]']\)${base_libdir},\1${SDKTARGETSYSROOT}${base_libdir},g" \ | ||
70 | -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${SDKTARGETSYSROOT}${libdir},g" \ | ||
71 | -e "/^dependency_libs=/s,\-\([LR]\)${base_libdir},-\1${SDKTARGETSYSROOT}${base_libdir},g" \ | ||
72 | -e "/^dependency_libs=/s,\-\([LR]\)${libdir},-\1${SDKTARGETSYSROOT}${libdir},g" \ | ||
73 | -e 's/^installed=yes$/installed=no/' $i | ||
74 | done | ||
75 | #rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}/lib/*.la | ||
76 | rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la | ||
77 | |||
78 | # Link the ld.so.cache file into the hosts filesystem | ||
79 | ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache | ||
80 | |||
81 | # Setup site file for external use | ||
82 | siteconfig=${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS} | ||
83 | touch $siteconfig | ||
84 | for sitefile in ${CONFIG_SITE} ; do | ||
85 | cat $sitefile >> $siteconfig | ||
86 | done | ||
87 | |||
88 | toolchain_create_sdk_env_script | ||
89 | |||
90 | # Add version information | ||
91 | versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} | ||
92 | touch $versionfile | ||
93 | echo 'Distro: ${DISTRO}' >> $versionfile | ||
94 | echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile | ||
95 | echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile | ||
96 | echo 'Timestamp: ${DATETIME}' >> $versionfile | ||
97 | |||
98 | # Package it up | ||
99 | mkdir -p ${SDK_DEPLOY} | ||
100 | cd ${SDK_OUTPUT} | ||
101 | tar --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 . | ||
102 | } | ||
103 | |||
104 | do_populate_sdk[nostamp] = "1" | ||
105 | do_populate_sdk[recrdeptask] = "do_package_write" | ||
106 | addtask populate_sdk before do_build after do_install | ||