diff options
-rw-r--r-- | meta/classes/toolchain-scripts.bbclass | 51 | ||||
-rw-r--r-- | meta/packages/meta/meta-ide-support.bb | 15 | ||||
-rw-r--r-- | meta/packages/meta/meta-toolchain.bb | 24 |
3 files changed, 68 insertions, 22 deletions
diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass new file mode 100644 index 0000000000..8934e0bc56 --- /dev/null +++ b/meta/classes/toolchain-scripts.bbclass | |||
@@ -0,0 +1,51 @@ | |||
1 | # This function creates an environment-setup-script for use in a deployable SDK | ||
2 | toolchain_create_sdk_env_script () { | ||
3 | # Create environment setup script | ||
4 | script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${MULTIMACH_TARGET_SYS} | ||
5 | rm -f $script | ||
6 | touch $script | ||
7 | echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${bindir_nativesdk}/${MULTIMACH_TARGET_SYS}:$PATH' >> $script | ||
8 | echo 'export PKG_CONFIG_SYSROOT_DIR=${SDKTARGETSYSROOT}' >> $script | ||
9 | echo 'export PKG_CONFIG_PATH=${SDKTARGETSYSROOT}${libdir}/pkgconfig' >> $script | ||
10 | echo 'export CONFIG_SITE=${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS}' >> $script | ||
11 | echo 'export CC=${TARGET_PREFIX}gcc' >> $script | ||
12 | echo 'export CXX=${TARGET_PREFIX}g++' >> $script | ||
13 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux"' >> $script | ||
14 | if [ "${TARGET_OS}" = "darwin8" ]; then | ||
15 | echo 'export TARGET_CFLAGS="-I${SDKTARGETSYSROOT}${includedir}"' >> $script | ||
16 | echo 'export TARGET_LDFLAGS="-L${SDKTARGETSYSROOT}${libdir}"' >> $script | ||
17 | # Workaround darwin toolchain sysroot path problems | ||
18 | cd ${SDK_OUTPUT}${SDKTARGETSYSROOT}/usr | ||
19 | ln -s /usr/local local | ||
20 | fi | ||
21 | echo 'export CFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
22 | echo 'export CXXFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
23 | echo "alias opkg='LD_LIBRARY_PATH=${SDKPATHNATIVE}${libdir_nativesdk} ${SDKPATHNATIVE}${bindir_nativesdk}/opkg-cl -f ${SDKPATHNATIVE}/${sysconfdir}/opkg-sdk.conf -o ${SDKPATHNATIVE}'" >> $script | ||
24 | echo "alias opkg-target='LD_LIBRARY_PATH=${SDKPATHNATIVE}${libdir_nativesdk} ${SDKPATHNATIVE}${bindir_nativesdk}/opkg-cl -f ${SDKTARGETSYSROOT}${sysconfdir}/opkg.conf -o ${SDKTARGETSYSROOT}'" >> $script | ||
25 | } | ||
26 | |||
27 | # This function creates an environment-setup-script in the TMPDIR which enables a Poky IDE to integrate with the | ||
28 | # build tree | ||
29 | toolchain_create_tree_env_script () { | ||
30 | script=${TMPDIR}/environment-setup-${MULTIMACH_TARGET_SYS} | ||
31 | rm -f $script | ||
32 | touch $script | ||
33 | echo 'export PATH=${PATH}' >> $script | ||
34 | echo 'export PKG_CONFIG_SYSROOT_DIR=${STAGING_DIR}/${TARGET_SYS}' >> $script | ||
35 | echo 'export PKG_CONFIG_PATH=${STAGING_DIR}/${TARGET_SYS}${libdir}/pkgconfig' >> $script | ||
36 | |||
37 | echo 'export CONFIG_SITE="${@siteinfo_get_files(d)}"' >> $script | ||
38 | |||
39 | echo 'export CC=${TARGET_PREFIX}gcc' >> $script | ||
40 | echo 'export CXX=${TARGET_PREFIX}g++' >> $script | ||
41 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${BUILD_SYS}"' >> $script | ||
42 | if [ "${TARGET_OS}" = "darwin8" ]; then | ||
43 | echo 'export TARGET_CFLAGS="-I${STAGING_DIR}${TARGET_SYS}${includedir}"' >> $script | ||
44 | echo 'export TARGET_LDFLAGS="-L${STAGING_DIR}${TARGET_SYS}${libdir}"' >> $script | ||
45 | # Workaround darwin toolchain sysroot path problems | ||
46 | cd ${SDK_OUTPUT}${SDKTARGETSYSROOT}/usr | ||
47 | ln -s /usr/local local | ||
48 | fi | ||
49 | echo 'export CFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
50 | echo 'export CXXFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
51 | } | ||
diff --git a/meta/packages/meta/meta-ide-support.bb b/meta/packages/meta/meta-ide-support.bb new file mode 100644 index 0000000000..0d564baa5c --- /dev/null +++ b/meta/packages/meta/meta-ide-support.bb | |||
@@ -0,0 +1,15 @@ | |||
1 | DESCRIPTION = "Meta package for ensuring the build directory contains all appropriate toolchain packages for using an IDE" | ||
2 | LICENSE = "MIT" | ||
3 | DEPENDS = "virtual/libc" | ||
4 | RDEPENDS = "task-sdk-host" | ||
5 | PR = "r0" | ||
6 | |||
7 | inherit meta toolchain-scripts | ||
8 | |||
9 | do_populate_ide_support () { | ||
10 | toolchain_create_tree_env_script | ||
11 | } | ||
12 | |||
13 | do_populate_ide_support[nostamp] = "1" | ||
14 | do_populate_ide_support[recrdeptask] = "do_package_write" | ||
15 | addtask populate_ide_support before do_build after do_install | ||
diff --git a/meta/packages/meta/meta-toolchain.bb b/meta/packages/meta/meta-toolchain.bb index a53569b55b..585adb4e13 100644 --- a/meta/packages/meta/meta-toolchain.bb +++ b/meta/packages/meta/meta-toolchain.bb | |||
@@ -2,7 +2,7 @@ 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 | DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native" |
4 | 4 | ||
5 | inherit meta | 5 | inherit meta toolchain-scripts |
6 | 6 | ||
7 | SDK_DIR = "${WORKDIR}/sdk" | 7 | SDK_DIR = "${WORKDIR}/sdk" |
8 | SDK_OUTPUT = "${SDK_DIR}/image" | 8 | SDK_OUTPUT = "${SDK_DIR}/image" |
@@ -79,27 +79,7 @@ do_populate_sdk() { | |||
79 | cat $sitefile >> $siteconfig | 79 | cat $sitefile >> $siteconfig |
80 | done | 80 | done |
81 | 81 | ||
82 | # Create environment setup script | 82 | toolchain_create_sdk_env_script |
83 | script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${MULTIMACH_TARGET_SYS} | ||
84 | touch $script | ||
85 | echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${bindir_nativesdk}/${MULTIMACH_TARGET_SYS}:$PATH' >> $script | ||
86 | echo 'export PKG_CONFIG_SYSROOT_DIR=${SDKTARGETSYSROOT}' >> $script | ||
87 | echo 'export PKG_CONFIG_PATH=${SDKTARGETSYSROOT}${libdir}/pkgconfig' >> $script | ||
88 | echo 'export CONFIG_SITE=${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS}' >> $script | ||
89 | echo 'export CC=${TARGET_PREFIX}gcc' >> $script | ||
90 | echo 'export CXX=${TARGET_PREFIX}g++' >> $script | ||
91 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux"' >> $script | ||
92 | if [ "${TARGET_OS}" = "darwin8" ]; then | ||
93 | echo 'export TARGET_CFLAGS="-I${SDKTARGETSYSROOT}${includedir}"' >> $script | ||
94 | echo 'export TARGET_LDFLAGS="-L${SDKTARGETSYSROOT}${libdir}"' >> $script | ||
95 | # Workaround darwin toolchain sysroot path problems | ||
96 | cd ${SDK_OUTPUT}${SDKTARGETSYSROOT}/usr | ||
97 | ln -s /usr/local local | ||
98 | fi | ||
99 | echo 'export CFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
100 | echo 'export CXXFLAGS="${TARGET_CC_ARCH}"' >> $script | ||
101 | echo "alias opkg='LD_LIBRARY_PATH=${SDKPATHNATIVE}${libdir_nativesdk} ${SDKPATHNATIVE}${bindir_nativesdk}/opkg-cl -f ${SDKPATHNATIVE}/${sysconfdir}/opkg-sdk.conf -o ${SDKPATHNATIVE}'" >> $script | ||
102 | echo "alias opkg-target='LD_LIBRARY_PATH=${SDKPATHNATIVE}${libdir_nativesdk} ${SDKPATHNATIVE}${bindir_nativesdk}/opkg-cl -f ${SDKTARGETSYSROOT}${sysconfdir}/opkg.conf -o ${SDKTARGETSYSROOT}'" >> $script | ||
103 | 83 | ||
104 | # Add version information | 84 | # Add version information |
105 | versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} | 85 | versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} |