diff options
author | Changqing Li <changqing.li@windriver.com> | 2019-04-30 17:08:21 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-03 06:11:57 +0100 |
commit | 3418d1326ccd9253743acd3fc1ac5741125382c0 (patch) | |
tree | fc239d78a5c43035c53bec307c76f279a57610c2 /meta/classes/populate_sdk_base.bbclass | |
parent | 8216015a85812a225563ac85149ecaf37678d2c6 (diff) | |
download | poky-3418d1326ccd9253743acd3fc1ac5741125382c0.tar.gz |
populate_sdk_base: provide options to set sdk type
Current sdk type is tar.xz, but for mingw sdk, since we
have symlink under the sdk folder, 7zip which used to
extract tar.xz cannot handle it, refer 7zip upstream bug:
https://sourceforge.net/p/sevenzip/discussion/45797/thread/c71d6b96/
so add option for usr can select the sdk type.
Add override SDK_ARCHIVE_TYPE, default type is tar.xz, and also
support type zip. user want to use zip type can set SDK_ARCHIVE_TYPE
to zip.
(From OE-Core rev: 57a33048a89a422cfdc986d3489c67b2d297e1e7)
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/populate_sdk_base.bbclass')
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 29 |
1 files changed, 22 insertions, 7 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() { |