summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/populate_sdk_base.bbclass29
-rw-r--r--meta/files/toolchain-shar-extract.sh22
2 files changed, 42 insertions, 9 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index efaa5b99e9..a7f0fe7439 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -45,8 +45,23 @@ TOOLCHAIN_TARGET_TASK ?= "${@multilib_pkg_extend(d, 'packagegroup-core-standalon
45TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" 45TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
46TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" 46TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
47 47
48# Default archived SDK's suffix
49SDK_ARCHIVE_TYPE ?= "tar.xz"
50
51# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
52python () {
53 if d.getVar('SDK_ARCHIVE_TYPE') == 'zip':
54 d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
55 # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
56 # recommand to cd into input dir first to avoid archive with buildpath
57 d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
58 else:
59 d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native')
60 d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz -T 0 > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
61}
62
48SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" 63SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
49SDK_DEPENDS = "virtual/fakeroot-native xz-native cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross" 64SDK_DEPENDS = "virtual/fakeroot-native ${SDK_ARCHIVE_DEPENDS} cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross"
50PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" 65PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
51SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale" 66SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale"
52 67
@@ -104,7 +119,7 @@ POPULATE_SDK_POST_TARGET_COMMAND_append = " write_sdk_test_data ; "
104POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; " 119POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; "
105POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; " 120POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; "
106SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" 121SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}"
107SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; tar_sdk; ${SDK_PACKAGING_COMMAND} " 122SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} "
108 123
109def populate_sdk_common(d): 124def populate_sdk_common(d):
110 from oe.sdk import populate_sdk 125 from oe.sdk import populate_sdk
@@ -222,11 +237,10 @@ python check_sdk_sysroots() {
222 237
223SDKTAROPTS = "--owner=root --group=root" 238SDKTAROPTS = "--owner=root --group=root"
224 239
225fakeroot tar_sdk() { 240fakeroot archive_sdk() {
226 # Package it up 241 # Package it up
227 mkdir -p ${SDKDEPLOYDIR} 242 mkdir -p ${SDKDEPLOYDIR}
228 cd ${SDK_OUTPUT}/${SDKPATH} 243 ${SDK_ARCHIVE_CMD}
229 tar ${SDKTAROPTS} -cf - . | xz -9 ${XZ_DEFAULTS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz
230} 244}
231 245
232TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh" 246TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh"
@@ -263,16 +277,17 @@ EOF
263 -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ 277 -e '/@SDK_PRE_INSTALL_COMMAND@/d' \
264 -e '/@SDK_POST_INSTALL_COMMAND@/d' \ 278 -e '/@SDK_POST_INSTALL_COMMAND@/d' \
265 -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \ 279 -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \
280 -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \
266 ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh 281 ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
267 282
268 # add execution permission 283 # add execution permission
269 chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh 284 chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
270 285
271 # append the SDK tarball 286 # append the SDK tarball
272 cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh 287 cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
273 288
274 # delete the old tarball, we don't need it anymore 289 # delete the old tarball, we don't need it anymore
275 rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz 290 rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}
276} 291}
277 292
278populate_sdk_log_check() { 293populate_sdk_log_check() {
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 156085b500..ccc4f4e1ac 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -113,7 +113,16 @@ done
113 113
114payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) 114payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
115if [ "$listcontents" = "1" ] ; then 115if [ "$listcontents" = "1" ] ; then
116 tail -n +$payload_offset $0| tar tvJ || exit 1 116 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
117 tail -n +$payload_offset $0 > sdk.zip
118 if unzip -l sdk.zip;then
119 rm sdk.zip
120 else
121 rm sdk.zip && exit 1
122 fi
123 else
124 tail -n +$payload_offset $0| tar tvJ || exit 1
125 fi
117 exit 126 exit
118fi 127fi
119 128
@@ -232,7 +241,16 @@ if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the
232fi 241fi
233 242
234printf "Extracting SDK..." 243printf "Extracting SDK..."
235tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 244if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
245 tail -n +$payload_offset $0 > sdk.zip
246 if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
247 rm sdk.zip
248 else
249 rm sdk.zip && exit 1
250 fi
251else
252 tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
253fi
236echo "done" 254echo "done"
237 255
238printf "Setting it up..." 256printf "Setting it up..."