Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit meta |
| 2 | |
| 3 | # Wildcards specifying complementary packages to install for every package that has been explicitly |
| 4 | # installed into the rootfs |
| 5 | COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev' |
| 6 | COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev' |
| 7 | COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc' |
| 8 | COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg' |
| 9 | COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest' |
| 10 | |
| 11 | def complementary_globs(featurevar, d): |
| 12 | all_globs = d.getVarFlags('COMPLEMENTARY_GLOB') |
| 13 | globs = [] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | features = set((d.getVar(featurevar) or '').split()) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | for name, glob in all_globs.items(): |
| 16 | if name in features: |
| 17 | globs.append(glob) |
| 18 | return ' '.join(globs) |
| 19 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 20 | SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}' |
| 22 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | PACKAGE_ARCHS_append_task-populate-sdk = " sdk-provides-dummy-target" |
| 24 | SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}" |
| 25 | |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 26 | # List of locales to install, or "all" for all of them, or unset for none. |
| 27 | SDKIMAGE_LINGUAS ?= "all" |
| 28 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | inherit rootfs_${IMAGE_PKGTYPE} |
| 30 | |
| 31 | SDK_DIR = "${WORKDIR}/sdk" |
| 32 | SDK_OUTPUT = "${SDK_DIR}/image" |
| 33 | SDK_DEPLOY = "${DEPLOY_DIR}/sdk" |
| 34 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 35 | SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk" |
| 36 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | B_task-populate-sdk = "${SDK_DIR}" |
| 38 | |
| 39 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}" |
| 40 | |
| 41 | TOOLCHAIN_HOST_TASK ?= "nativesdk-packagegroup-sdk-host packagegroup-cross-canadian-${MACHINE}" |
| 42 | TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= "" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 43 | TOOLCHAIN_TARGET_TASK ?= "${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \ |
| 44 | ${@multilib_pkg_extend(d, 'target-sdk-provides-dummy')}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" |
| 46 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" |
| 47 | |
| 48 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 49 | SDK_DEPENDS = "virtual/fakeroot-native xz-native cross-localedef-native ${MLPREFIX}qemuwrapper-cross" |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 50 | SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | |
| 52 | # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it |
| 53 | # could be set to the MACHINE_ARCH |
| 54 | REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}" |
| 55 | |
| 56 | PID = "${@os.getpid()}" |
| 57 | |
| 58 | EXCLUDE_FROM_WORLD = "1" |
| 59 | |
| 60 | SDK_PACKAGING_FUNC ?= "create_shar" |
| 61 | SDK_PRE_INSTALL_COMMAND ?= "" |
| 62 | SDK_POST_INSTALL_COMMAND ?= "" |
| 63 | SDK_RELOCATE_AFTER_INSTALL ?= "1" |
| 64 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 65 | SDKEXTPATH ?= "~/${@d.getVar('DISTRO')}_sdk" |
| 66 | SDK_TITLE ?= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 68 | SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest" |
| 69 | SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 70 | SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest" |
| 71 | SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest" |
| 72 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 73 | python write_target_sdk_manifest () { |
| 74 | from oe.sdk import sdk_list_installed_packages |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 75 | from oe.utils import format_pkg_list |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 76 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST")) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 77 | pkgs = sdk_list_installed_packages(d, True) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 78 | if not os.path.exists(sdkmanifestdir): |
| 79 | bb.utils.mkdirhier(sdkmanifestdir) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 80 | with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 81 | output.write(format_pkg_list(pkgs, 'ver')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 82 | } |
| 83 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 84 | python write_sdk_test_data() { |
| 85 | from oe.data import export2json |
| 86 | testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME')) |
| 87 | bb.utils.mkdirhier(os.path.dirname(testdata)) |
| 88 | export2json(d, testdata) |
| 89 | } |
| 90 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 91 | python write_host_sdk_manifest () { |
| 92 | from oe.sdk import sdk_list_installed_packages |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 93 | from oe.utils import format_pkg_list |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 94 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST")) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 95 | pkgs = sdk_list_installed_packages(d, False) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | if not os.path.exists(sdkmanifestdir): |
| 97 | bb.utils.mkdirhier(sdkmanifestdir) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 98 | with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 99 | output.write(format_pkg_list(pkgs, 'ver')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 100 | } |
| 101 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 102 | POPULATE_SDK_POST_TARGET_COMMAND_append = " write_sdk_test_data ; " |
| 103 | POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; " |
| 104 | POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; " |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 105 | SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" |
| 106 | SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; tar_sdk; ${SDK_PACKAGING_COMMAND} " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 107 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 108 | def populate_sdk_common(d): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 109 | from oe.sdk import populate_sdk |
| 110 | from oe.manifest import create_manifest, Manifest |
| 111 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 112 | # Handle package exclusions |
| 113 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() |
| 114 | inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split() |
| 115 | inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split() |
| 116 | |
| 117 | d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) |
| 118 | d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) |
| 119 | |
| 120 | for pkg in excl_pkgs: |
| 121 | if pkg in inst_pkgs: |
| 122 | bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) |
| 123 | inst_pkgs.remove(pkg) |
| 124 | |
| 125 | if pkg in inst_attempt_pkgs: |
| 126 | bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) |
| 127 | inst_attempt_pkgs.remove(pkg) |
| 128 | |
| 129 | d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) |
| 130 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) |
| 131 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 132 | pn = d.getVar('PN') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 133 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) |
| 134 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) |
| 135 | |
| 136 | ld = bb.data.createCopy(d) |
| 137 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") |
| 138 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) |
| 139 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 140 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) |
| 141 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 142 | |
| 143 | # create target/host SDK manifests |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 144 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 146 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 147 | manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET) |
| 148 | |
| 149 | populate_sdk(d) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 150 | |
| 151 | fakeroot python do_populate_sdk() { |
| 152 | populate_sdk_common(d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 153 | } |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 154 | SSTATETASKS += "do_populate_sdk" |
| 155 | SSTATE_SKIP_CREATION_task-populate-sdk = '1' |
| 156 | do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}" |
| 157 | do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}" |
| 158 | do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 159 | do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 160 | |
| 161 | fakeroot create_sdk_files() { |
| 162 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ |
| 163 | |
| 164 | # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern. |
| 165 | # Escape special characters like '+' and '.' in the SDKPATH |
| 166 | escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g") |
| 167 | sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py |
| 168 | } |
| 169 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 170 | python check_sdk_sysroots() { |
| 171 | # Fails build if there are broken or dangling symlinks in SDK sysroots |
| 172 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 173 | if d.getVar('CHECK_SDK_SYSROOTS') != '1': |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 174 | # disabled, bail out |
| 175 | return |
| 176 | |
| 177 | def norm_path(path): |
| 178 | return os.path.abspath(path) |
| 179 | |
| 180 | # Get scan root |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 181 | SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'), |
| 182 | d.getVar('SDKPATH'))) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 183 | |
| 184 | bb.note('Checking SDK sysroots at ' + SCAN_ROOT) |
| 185 | |
| 186 | def check_symlink(linkPath): |
| 187 | if not os.path.islink(linkPath): |
| 188 | return |
| 189 | |
| 190 | linkDirPath = os.path.dirname(linkPath) |
| 191 | |
| 192 | targetPath = os.readlink(linkPath) |
| 193 | if not os.path.isabs(targetPath): |
| 194 | targetPath = os.path.join(linkDirPath, targetPath) |
| 195 | targetPath = norm_path(targetPath) |
| 196 | |
| 197 | if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ): |
| 198 | bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 199 | return |
| 200 | |
| 201 | if not os.path.exists(targetPath): |
| 202 | bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 203 | return |
| 204 | |
| 205 | if os.path.isdir(targetPath): |
| 206 | dir_walk(targetPath) |
| 207 | |
| 208 | def walk_error_handler(e): |
| 209 | bb.error(str(e)) |
| 210 | |
| 211 | def dir_walk(rootDir): |
| 212 | for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler): |
| 213 | entries = subDirEntries + fileEntries |
| 214 | for e in entries: |
| 215 | ePath = os.path.join(dirPath, e) |
| 216 | check_symlink(ePath) |
| 217 | |
| 218 | # start |
| 219 | dir_walk(SCAN_ROOT) |
| 220 | } |
| 221 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 222 | SDKTAROPTS = "--owner=root --group=root" |
| 223 | |
| 224 | fakeroot tar_sdk() { |
| 225 | # Package it up |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 226 | mkdir -p ${SDKDEPLOYDIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 227 | cd ${SDK_OUTPUT}/${SDKPATH} |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 228 | tar ${SDKTAROPTS} -cf - . | xz -T 0 > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | fakeroot create_shar() { |
| 232 | # copy in the template shar extractor script |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 233 | cp ${COREBASE}/meta/files/toolchain-shar-extract.sh ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 234 | |
| 235 | rm -f ${T}/pre_install_command ${T}/post_install_command |
| 236 | |
| 237 | if [ ${SDK_RELOCATE_AFTER_INSTALL} -eq 1 ] ; then |
| 238 | cp ${COREBASE}/meta/files/toolchain-shar-relocate.sh ${T}/post_install_command |
| 239 | fi |
| 240 | cat << "EOF" >> ${T}/pre_install_command |
| 241 | ${SDK_PRE_INSTALL_COMMAND} |
| 242 | EOF |
| 243 | |
| 244 | cat << "EOF" >> ${T}/post_install_command |
| 245 | ${SDK_POST_INSTALL_COMMAND} |
| 246 | EOF |
| 247 | sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \ |
| 248 | -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 249 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 250 | |
| 251 | # substitute variables |
| 252 | sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \ |
| 253 | -e 's#@SDKPATH@#${SDKPATH}#g' \ |
| 254 | -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \ |
| 255 | -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \ |
| 256 | -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 257 | -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\&')}#g' \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 258 | -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \ |
| 259 | -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ |
| 260 | -e '/@SDK_POST_INSTALL_COMMAND@/d' \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 261 | -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 262 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 263 | |
| 264 | # add execution permission |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 265 | chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 266 | |
| 267 | # append the SDK tarball |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 268 | cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 269 | |
| 270 | # delete the old tarball, we don't need it anymore |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 271 | rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.tar.xz |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | populate_sdk_log_check() { |
| 275 | for target in $* |
| 276 | do |
| 277 | lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}" |
| 278 | |
| 279 | echo "log_check: Using $lf_path as logfile" |
| 280 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 281 | if [ -e "$lf_path" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 282 | ${IMAGE_PKGTYPE}_log_check $target $lf_path |
| 283 | else |
| 284 | echo "Cannot find logfile [$lf_path]" |
| 285 | fi |
| 286 | echo "Logfile is clean" |
| 287 | done |
| 288 | } |
| 289 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 290 | def sdk_command_variables(d): |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 291 | return ['OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','POPULATE_SDK_POST_HOST_COMMAND','POPULATE_SDK_PRE_TARGET_COMMAND','POPULATE_SDK_POST_TARGET_COMMAND','SDK_POSTPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS'] |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 292 | |
| 293 | def sdk_variables(d): |
| 294 | variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT', |
| 295 | 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 296 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY'] |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 297 | variables.extend(sdk_command_variables(d)) |
| 298 | return " ".join(variables) |
| 299 | |
| 300 | do_populate_sdk[vardeps] += "${@sdk_variables(d)}" |
| 301 | |
| 302 | do_populate_sdk[file-checksums] += "${COREBASE}/meta/files/toolchain-shar-relocate.sh:True \ |
| 303 | ${COREBASE}/meta/files/toolchain-shar-extract.sh:True" |
| 304 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 305 | do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 306 | do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}" |
| 307 | do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 308 | do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb" |
| 309 | addtask populate_sdk |