diff options
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 29 | ||||
-rw-r--r-- | meta/files/toolchain-shar-extract.sh | 22 |
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 | |||
45 | TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" | 45 | TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" |
46 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" | 46 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" |
47 | 47 | ||
48 | # Default archived SDK's suffix | ||
49 | SDK_ARCHIVE_TYPE ?= "tar.xz" | ||
50 | |||
51 | # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz | ||
52 | python () { | ||
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 | |||
48 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | 63 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" |
49 | SDK_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" | 64 | SDK_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" |
50 | PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" | 65 | PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" |
51 | SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale" | 66 | SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale" |
52 | 67 | ||
@@ -104,7 +119,7 @@ POPULATE_SDK_POST_TARGET_COMMAND_append = " write_sdk_test_data ; " | |||
104 | POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; " | 119 | POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; " |
105 | POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; " | 120 | POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; " |
106 | SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" | 121 | SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" |
107 | SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; tar_sdk; ${SDK_PACKAGING_COMMAND} " | 122 | SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} " |
108 | 123 | ||
109 | def populate_sdk_common(d): | 124 | def 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 | ||
223 | SDKTAROPTS = "--owner=root --group=root" | 238 | SDKTAROPTS = "--owner=root --group=root" |
224 | 239 | ||
225 | fakeroot tar_sdk() { | 240 | fakeroot 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 | ||
232 | TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh" | 246 | TOOLCHAIN_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 | ||
278 | populate_sdk_log_check() { | 293 | populate_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 | ||
114 | payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) | 114 | payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) |
115 | if [ "$listcontents" = "1" ] ; then | 115 | if [ "$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 |
118 | fi | 127 | fi |
119 | 128 | ||
@@ -232,7 +241,16 @@ if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the | |||
232 | fi | 241 | fi |
233 | 242 | ||
234 | printf "Extracting SDK..." | 243 | printf "Extracting SDK..." |
235 | tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 | 244 | if [ @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 | ||
251 | else | ||
252 | tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 | ||
253 | fi | ||
236 | echo "done" | 254 | echo "done" |
237 | 255 | ||
238 | printf "Setting it up..." | 256 | printf "Setting it up..." |