diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-05 22:09:51 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-06 11:02:26 +0000 |
commit | e52020ed1792f955bdaa4d26d69a49aadb7962aa (patch) | |
tree | 708e06604b3b8ffcf5f4d7e1844624752c278fb2 /meta | |
parent | 5810d54756159f181e0e95122bfbcca451fe7665 (diff) | |
download | poky-e52020ed1792f955bdaa4d26d69a49aadb7962aa.tar.gz |
toolchain-scripts/meta-environment: Merge toolchain_create_sdk_env_script and the for_installer variant
Having two scripts which do basically the same thing is a nightmare. This merges
them together. It also makes the sysroot location a variable in its own right
which may be more useful for end users wanting to change sysroot.
(From OE-Core rev: 213e0c67e938b802e6bb2246f00b7343a6f77b99)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/toolchain-scripts.bbclass | 77 | ||||
-rw-r--r-- | meta/recipes-core/meta/meta-environment.bb | 2 |
2 files changed, 19 insertions, 60 deletions
diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass index 614f1c0ffd..db0ae1762b 100644 --- a/meta/classes/toolchain-scripts.bbclass +++ b/meta/classes/toolchain-scripts.bbclass | |||
@@ -7,18 +7,23 @@ REAL_MULTIMACH_TARGET_SYS ?= "${MULTIMACH_TARGET_SYS}" | |||
7 | # This function creates an environment-setup-script for use in a deployable SDK | 7 | # This function creates an environment-setup-script for use in a deployable SDK |
8 | toolchain_create_sdk_env_script () { | 8 | toolchain_create_sdk_env_script () { |
9 | # Create environment setup script | 9 | # Create environment setup script |
10 | script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}} | 10 | includedir=${5:-${includedir}} |
11 | libdir=${4:-${libdir}} | ||
12 | sysroot=${3:-${SDKTARGETSYSROOT}} | ||
13 | multimach_target_sys=${2:-${REAL_MULTIMACH_TARGET_SYS}} | ||
14 | script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-$multimach_target_sys} | ||
11 | rm -f $script | 15 | rm -f $script |
12 | touch $script | 16 | touch $script |
17 | echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script | ||
13 | echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${bindir_nativesdk}/${TARGET_SYS}:$PATH' >> $script | 18 | echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${bindir_nativesdk}/${TARGET_SYS}:$PATH' >> $script |
14 | echo 'export PKG_CONFIG_SYSROOT_DIR=${SDKTARGETSYSROOT}' >> $script | 19 | echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script |
15 | echo 'export PKG_CONFIG_PATH=${SDKTARGETSYSROOT}${libdir}/pkgconfig' >> $script | 20 | echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig' >> $script |
16 | echo 'export CONFIG_SITE=${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}' >> $script | 21 | echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script |
17 | echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT}"' >> $script | 22 | echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script |
18 | echo 'export CXX="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT}"' >> $script | 23 | echo 'export CXX="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script |
19 | echo 'export CPP="${TARGET_PREFIX}gcc -E ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT}"' >> $script | 24 | echo 'export CPP="${TARGET_PREFIX}gcc -E ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script |
20 | echo 'export AS="${TARGET_PREFIX}as ${TARGET_AS_ARCH}"' >> $script | 25 | echo 'export AS="${TARGET_PREFIX}as ${TARGET_AS_ARCH}"' >> $script |
21 | echo 'export LD="${TARGET_PREFIX}ld ${TARGET_LD_ARCH} --sysroot=${SDKTARGETSYSROOT}"' >> $script | 26 | echo 'export LD="${TARGET_PREFIX}ld ${TARGET_LD_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script |
22 | echo 'export GDB=${TARGET_PREFIX}gdb' >> $script | 27 | echo 'export GDB=${TARGET_PREFIX}gdb' >> $script |
23 | echo 'export STRIP=${TARGET_PREFIX}strip' >> $script | 28 | echo 'export STRIP=${TARGET_PREFIX}strip' >> $script |
24 | echo 'export RANLIB=${TARGET_PREFIX}ranlib' >> $script | 29 | echo 'export RANLIB=${TARGET_PREFIX}ranlib' >> $script |
@@ -28,12 +33,12 @@ toolchain_create_sdk_env_script () { | |||
28 | echo 'export NM=${TARGET_PREFIX}nm' >> $script | 33 | echo 'export NM=${TARGET_PREFIX}nm' >> $script |
29 | echo 'export M4=m4' >> $script | 34 | echo 'export M4=m4' >> $script |
30 | echo 'export TARGET_PREFIX=${TARGET_PREFIX}' >> $script | 35 | echo 'export TARGET_PREFIX=${TARGET_PREFIX}' >> $script |
31 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux --with-libtool-sysroot=${SDKTARGETSYSROOT}"' >> $script | 36 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"' >> $script |
32 | if [ "${TARGET_OS}" = "darwin8" ]; then | 37 | if [ "${TARGET_OS}" = "darwin8" ]; then |
33 | echo 'export TARGET_CFLAGS="-I${SDKTARGETSYSROOT}${includedir}"' >> $script | 38 | echo 'export TARGET_CFLAGS="-I$SDKTARGETSYSROOT'"$includedir"'"' >> $script |
34 | echo 'export TARGET_LDFLAGS="-L${SDKTARGETSYSROOT}${libdir}"' >> $script | 39 | echo 'export TARGET_LDFLAGS="-L$SDKTARGETSYSROOT'"$libdir"'"' >> $script |
35 | # Workaround darwin toolchain sysroot path problems | 40 | # Workaround darwin toolchain sysroot path problems |
36 | cd ${SDK_OUTPUT}${SDKTARGETSYSROOT}/usr | 41 | cd ${SDK_OUTPUT}$SDKTARGETSYSROOT/usr |
37 | ln -s /usr/local local | 42 | ln -s /usr/local local |
38 | fi | 43 | fi |
39 | echo 'export CFLAGS="${TARGET_CFLAGS}"' >> $script | 44 | echo 'export CFLAGS="${TARGET_CFLAGS}"' >> $script |
@@ -41,7 +46,7 @@ toolchain_create_sdk_env_script () { | |||
41 | echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script | 46 | echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script |
42 | echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script | 47 | echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script |
43 | echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script | 48 | echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script |
44 | echo 'export OECORE_TARGET_SYSROOT="${SDKTARGETSYSROOT}"' >> $script | 49 | echo 'export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"' >> $script |
45 | echo 'export OECORE_ACLOCAL_OPTS="-I ${SDKPATHNATIVE}/usr/share/aclocal"' >> $script | 50 | echo 'export OECORE_ACLOCAL_OPTS="-I ${SDKPATHNATIVE}/usr/share/aclocal"' >> $script |
46 | echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script | 51 | echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script |
47 | echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script | 52 | echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script |
@@ -96,52 +101,6 @@ toolchain_create_tree_env_script () { | |||
96 | echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script | 101 | echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script |
97 | } | 102 | } |
98 | 103 | ||
99 | # This function creates an environment-setup-script for use by the ADT installer | ||
100 | toolchain_create_sdk_env_script_for_installer () { | ||
101 | # Create environment setup script | ||
102 | local multimach_target_sys=$1 | ||
103 | script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${multimach_target_sys} | ||
104 | rm -f $script | ||
105 | touch $script | ||
106 | echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${bindir_nativesdk}/${TARGET_SYS}:$PATH' >> $script | ||
107 | echo 'export PKG_CONFIG_SYSROOT_DIR=##SDKTARGETSYSROOT##' >> $script | ||
108 | echo 'export PKG_CONFIG_PATH=##SDKTARGETSYSROOT##${target_libdir}/pkgconfig' >> $script | ||
109 | echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script | ||
110 | echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=##SDKTARGETSYSROOT##"' >> $script | ||
111 | echo 'export CXX="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=##SDKTARGETSYSROOT##"' >> $script | ||
112 | echo 'export CPP="${TARGET_PREFIX}gcc -E ${TARGET_CC_ARCH} --sysroot=##SDKTARGETSYSROOT##"' >> $script | ||
113 | echo 'export AS="${TARGET_PREFIX}as ${TARGET_AS_ARCH}"' >> $script | ||
114 | echo 'export LD="${TARGET_PREFIX}ld ${TARGET_LD_ARCH} --sysroot=##SDKTARGETSYSROOT##"' >> $script | ||
115 | echo 'export GDB=${TARGET_PREFIX}gdb' >> $script | ||
116 | echo 'export STRIP=${TARGET_PREFIX}strip' >> $script | ||
117 | echo 'export RANLIB=${TARGET_PREFIX}ranlib' >> $script | ||
118 | echo 'export OBJCOPY=${TARGET_PREFIX}objcopy' >> $script | ||
119 | echo 'export OBJDUMP=${TARGET_PREFIX}objdump' >> $script | ||
120 | echo 'export AR=${TARGET_PREFIX}ar' >> $script | ||
121 | echo 'export NM=${TARGET_PREFIX}nm' >> $script | ||
122 | echo 'export TARGET_PREFIX=${TARGET_PREFIX}' >> $script | ||
123 | echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux --with-libtool-sysroot=##SDKTARGETSYSROOT##"' >> $script | ||
124 | if [ "${TARGET_OS}" = "darwin8" ]; then | ||
125 | echo 'export TARGET_CFLAGS="-I##SDKTARGETSYSROOT##${target_includedir}"' >> $script | ||
126 | echo 'export TARGET_LDFLAGS="-L##SDKTARGETSYSROOT##{target_libdir}"' >> $script | ||
127 | # Workaround darwin toolchain sysroot path problems | ||
128 | cd ${SDK_OUTPUT}${SDKTARGETSYSROOT}/usr | ||
129 | ln -s /usr/local local | ||
130 | fi | ||
131 | echo 'export CFLAGS="${TARGET_CFLAGS}"' >> $script | ||
132 | echo 'export CXXFLAGS="${TARGET_CXXFLAGS}"' >> $script | ||
133 | echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script | ||
134 | echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script | ||
135 | echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script | ||
136 | echo 'export OECORE_TARGET_SYSROOT="##SDKTARGETSYSROOT##"' >> $script | ||
137 | echo 'export OECORE_ACLOCAL_OPTS="-I ${SDKPATHNATIVE}/usr/share/aclocal"' >> $script | ||
138 | echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script | ||
139 | echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script | ||
140 | echo 'export PYTHONHOME=${SDKPATHNATIVE}${prefix_nativesdk}' >> $script | ||
141 | echo 'export ARCH=${ARCH}' >> $script | ||
142 | echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script | ||
143 | } | ||
144 | |||
145 | #we get the cached site config in the runtime | 104 | #we get the cached site config in the runtime |
146 | TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d, True)}" | 105 | TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d, True)}" |
147 | TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d" | 106 | TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d" |
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb index 3a71a9bb2e..c7be404ffe 100644 --- a/meta/recipes-core/meta/meta-environment.bb +++ b/meta/recipes-core/meta/meta-environment.bb | |||
@@ -24,7 +24,7 @@ do_generate_content() { | |||
24 | 24 | ||
25 | toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS} | 25 | toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS} |
26 | 26 | ||
27 | toolchain_create_sdk_env_script_for_installer ${REAL_MULTIMACH_TARGET_SYS} | 27 | toolchain_create_sdk_env_script ${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${REAL_MULTIMACH_TARGET_SYS} '##SDKTARGETSYSROOT##' ${target_libdir} ${target_includedir} |
28 | 28 | ||
29 | # Add version information | 29 | # Add version information |
30 | toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS} | 30 | toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS} |