Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | PACKAGES = "" |
| 8 | |
| 9 | inherit image-postinst-intercepts image-artifact-names |
| 10 | |
| 11 | # Wildcards specifying complementary packages to install for every package that has been explicitly |
| 12 | # installed into the rootfs |
| 13 | COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev' |
| 14 | COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev' |
| 15 | COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc' |
| 16 | COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg' |
| 17 | COMPLEMENTARY_GLOB[src-pkgs] = '*-src' |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 18 | COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest ${MLPREFIX}ptest-runner' |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 19 | COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion' |
| 20 | |
| 21 | def complementary_globs(featurevar, d): |
| 22 | all_globs = d.getVarFlags('COMPLEMENTARY_GLOB') |
| 23 | globs = [] |
| 24 | features = set((d.getVar(featurevar) or '').split()) |
| 25 | for name, glob in all_globs.items(): |
| 26 | if name in features: |
| 27 | globs.append(glob) |
| 28 | return ' '.join(globs) |
| 29 | |
| 30 | SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}" |
| 31 | SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}' |
| 32 | SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES" |
| 33 | |
| 34 | PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target" |
| 35 | SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}" |
| 36 | |
| 37 | # List of locales to install, or "all" for all of them, or unset for none. |
| 38 | SDKIMAGE_LINGUAS ?= "all" |
| 39 | |
| 40 | inherit rootfs_${IMAGE_PKGTYPE} |
| 41 | |
| 42 | SDK_DIR = "${WORKDIR}/sdk" |
| 43 | SDK_OUTPUT = "${SDK_DIR}/image" |
| 44 | SDK_DEPLOY = "${DEPLOY_DIR}/sdk" |
| 45 | |
| 46 | SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk" |
| 47 | |
| 48 | B:task-populate-sdk = "${SDK_DIR}" |
| 49 | |
| 50 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}" |
| 51 | |
| 52 | SDK_TOOLCHAIN_LANGS ??= "" |
| 53 | SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" |
| 54 | # libstd-rs doesn't build for mips n32 with compiler constraint errors |
| 55 | SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" |
| 56 | |
| 57 | TOOLCHAIN_HOST_TASK ?= " \ |
| 58 | nativesdk-packagegroup-sdk-host \ |
| 59 | packagegroup-cross-canadian-${MACHINE} \ |
| 60 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \ |
| 61 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \ |
| 62 | " |
| 63 | TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= "" |
| 64 | TOOLCHAIN_TARGET_TASK ?= " \ |
| 65 | ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \ |
| 66 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \ |
| 67 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \ |
| 68 | target-sdk-provides-dummy \ |
| 69 | " |
| 70 | TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" |
| 71 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" |
| 72 | |
| 73 | # Default archived SDK's suffix |
| 74 | SDK_ARCHIVE_TYPE ?= "tar.xz" |
| 75 | SDK_XZ_COMPRESSION_LEVEL ?= "-9" |
| 76 | SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}" |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 77 | SDK_ZIP_OPTIONS ?= "-y" |
| 78 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 79 | |
| 80 | # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz |
| 81 | python () { |
| 82 | if d.getVar('SDK_ARCHIVE_TYPE') == 'zip': |
| 83 | d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native') |
| 84 | # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR} |
| 85 | # recommand to cd into input dir first to avoid archive with buildpath |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 86 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDK_ZIP_OPTIONS} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .') |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 87 | else: |
| 88 | d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native') |
| 89 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') |
| 90 | } |
| 91 | |
| 92 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" |
| 93 | 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" |
| 94 | PATH:prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" |
| 95 | SDK_DEPENDS += "nativesdk-glibc-locale" |
| 96 | |
| 97 | # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it |
| 98 | # could be set to the MACHINE_ARCH |
| 99 | REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}" |
| 100 | |
| 101 | PID = "${@os.getpid()}" |
| 102 | |
| 103 | EXCLUDE_FROM_WORLD = "1" |
| 104 | |
| 105 | SDK_PACKAGING_FUNC ?= "create_shar" |
| 106 | SDK_PRE_INSTALL_COMMAND ?= "" |
| 107 | SDK_POST_INSTALL_COMMAND ?= "" |
| 108 | SDK_RELOCATE_AFTER_INSTALL ?= "1" |
| 109 | |
| 110 | SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk" |
| 111 | SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK" |
| 112 | |
| 113 | SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest" |
| 114 | SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest" |
| 115 | SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest" |
| 116 | SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest" |
| 117 | |
| 118 | SDK_PRUNE_SYSROOT_DIRS ?= "/dev" |
| 119 | |
| 120 | python write_target_sdk_manifest () { |
| 121 | from oe.sdk import sdk_list_installed_packages |
| 122 | from oe.utils import format_pkg_list |
| 123 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST")) |
| 124 | pkgs = sdk_list_installed_packages(d, True) |
| 125 | if not os.path.exists(sdkmanifestdir): |
| 126 | bb.utils.mkdirhier(sdkmanifestdir) |
| 127 | with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output: |
| 128 | output.write(format_pkg_list(pkgs, 'ver')) |
| 129 | } |
| 130 | |
| 131 | sdk_prune_dirs () { |
| 132 | for d in ${SDK_PRUNE_SYSROOT_DIRS}; do |
| 133 | rm -rf ${SDK_OUTPUT}${SDKTARGETSYSROOT}$d |
| 134 | done |
| 135 | } |
| 136 | |
| 137 | python write_sdk_test_data() { |
| 138 | from oe.data import export2json |
| 139 | testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME')) |
| 140 | bb.utils.mkdirhier(os.path.dirname(testdata)) |
| 141 | export2json(d, testdata) |
| 142 | } |
| 143 | |
| 144 | python write_host_sdk_manifest () { |
| 145 | from oe.sdk import sdk_list_installed_packages |
| 146 | from oe.utils import format_pkg_list |
| 147 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST")) |
| 148 | pkgs = sdk_list_installed_packages(d, False) |
| 149 | if not os.path.exists(sdkmanifestdir): |
| 150 | bb.utils.mkdirhier(sdkmanifestdir) |
| 151 | with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output: |
| 152 | output.write(format_pkg_list(pkgs, 'ver')) |
| 153 | } |
| 154 | |
| 155 | POPULATE_SDK_POST_TARGET_COMMAND:append = " write_sdk_test_data ; " |
| 156 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " write_target_sdk_manifest; sdk_prune_dirs; " |
| 157 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manifest; " |
| 158 | |
| 159 | SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" |
| 160 | SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} " |
| 161 | |
| 162 | def populate_sdk_common(d): |
| 163 | from oe.sdk import populate_sdk |
| 164 | from oe.manifest import create_manifest, Manifest |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 165 | import oe.packagedata |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 166 | |
| 167 | # Handle package exclusions |
| 168 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() |
| 169 | inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split() |
| 170 | inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split() |
| 171 | |
| 172 | d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) |
| 173 | d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) |
| 174 | |
| 175 | for pkg in excl_pkgs: |
| 176 | if pkg in inst_pkgs: |
| 177 | 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)) |
| 178 | inst_pkgs.remove(pkg) |
| 179 | |
| 180 | if pkg in inst_attempt_pkgs: |
| 181 | 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)) |
| 182 | inst_attempt_pkgs.remove(pkg) |
| 183 | |
| 184 | d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) |
| 185 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) |
| 186 | |
| 187 | pn = d.getVar('PN') |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 188 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) |
| 189 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 190 | |
| 191 | ld = bb.data.createCopy(d) |
| 192 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 193 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) |
| 194 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 195 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) |
| 196 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) |
| 197 | |
| 198 | # create target/host SDK manifests |
| 199 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
| 200 | manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST) |
| 201 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
| 202 | manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET) |
| 203 | |
| 204 | populate_sdk(d) |
| 205 | |
| 206 | fakeroot python do_populate_sdk() { |
| 207 | populate_sdk_common(d) |
| 208 | } |
| 209 | SSTATETASKS += "do_populate_sdk" |
| 210 | SSTATE_SKIP_CREATION:task-populate-sdk = '1' |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 211 | do_populate_sdk[cleandirs] += "${SDKDEPLOYDIR}" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 212 | do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}" |
| 213 | do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}" |
| 214 | do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" |
| 215 | python do_populate_sdk_setscene () { |
| 216 | sstate_setscene(d) |
| 217 | } |
| 218 | addtask do_populate_sdk_setscene |
| 219 | |
| 220 | PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk" |
| 221 | |
| 222 | fakeroot create_sdk_files() { |
| 223 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ |
| 224 | |
| 225 | # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern. |
| 226 | # Escape special characters like '+' and '.' in the SDKPATH |
| 227 | escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g") |
| 228 | sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py |
| 229 | |
| 230 | mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ |
| 231 | echo '${SDKPATHNATIVE}${libdir_nativesdk} |
| 232 | ${SDKPATHNATIVE}${base_libdir_nativesdk} |
| 233 | include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf |
| 234 | } |
| 235 | |
| 236 | python check_sdk_sysroots() { |
| 237 | # Fails build if there are broken or dangling symlinks in SDK sysroots |
| 238 | |
| 239 | if d.getVar('CHECK_SDK_SYSROOTS') != '1': |
| 240 | # disabled, bail out |
| 241 | return |
| 242 | |
| 243 | def norm_path(path): |
| 244 | return os.path.abspath(path) |
| 245 | |
| 246 | # Get scan root |
| 247 | SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'), |
| 248 | d.getVar('SDKPATH'))) |
| 249 | |
| 250 | bb.note('Checking SDK sysroots at ' + SCAN_ROOT) |
| 251 | |
| 252 | def check_symlink(linkPath): |
| 253 | if not os.path.islink(linkPath): |
| 254 | return |
| 255 | |
| 256 | linkDirPath = os.path.dirname(linkPath) |
| 257 | |
| 258 | targetPath = os.readlink(linkPath) |
| 259 | if not os.path.isabs(targetPath): |
| 260 | targetPath = os.path.join(linkDirPath, targetPath) |
| 261 | targetPath = norm_path(targetPath) |
| 262 | |
| 263 | if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ): |
| 264 | bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 265 | return |
| 266 | |
| 267 | if not os.path.exists(targetPath): |
| 268 | bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 269 | return |
| 270 | |
| 271 | if os.path.isdir(targetPath): |
| 272 | dir_walk(targetPath) |
| 273 | |
| 274 | def walk_error_handler(e): |
| 275 | bb.error(str(e)) |
| 276 | |
| 277 | def dir_walk(rootDir): |
| 278 | for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler): |
| 279 | entries = subDirEntries + fileEntries |
| 280 | for e in entries: |
| 281 | ePath = os.path.join(dirPath, e) |
| 282 | check_symlink(ePath) |
| 283 | |
| 284 | # start |
| 285 | dir_walk(SCAN_ROOT) |
| 286 | } |
| 287 | |
| 288 | SDKTAROPTS = "--owner=root --group=root" |
| 289 | |
| 290 | fakeroot archive_sdk() { |
| 291 | # Package it up |
| 292 | mkdir -p ${SDKDEPLOYDIR} |
| 293 | ${SDK_ARCHIVE_CMD} |
| 294 | } |
| 295 | |
| 296 | TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh" |
| 297 | TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh" |
| 298 | |
| 299 | fakeroot create_shar() { |
| 300 | # copy in the template shar extractor script |
| 301 | cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 302 | |
| 303 | rm -f ${T}/pre_install_command ${T}/post_install_command |
| 304 | |
| 305 | if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then |
| 306 | cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command |
| 307 | fi |
| 308 | cat << "EOF" >> ${T}/pre_install_command |
| 309 | ${SDK_PRE_INSTALL_COMMAND} |
| 310 | EOF |
| 311 | |
| 312 | cat << "EOF" >> ${T}/post_install_command |
| 313 | ${SDK_POST_INSTALL_COMMAND} |
| 314 | EOF |
| 315 | sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \ |
| 316 | -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \ |
| 317 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 318 | |
| 319 | # substitute variables |
| 320 | sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \ |
| 321 | -e 's#@SDKPATH@#${SDKPATH}#g' \ |
| 322 | -e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \ |
| 323 | -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \ |
| 324 | -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \ |
| 325 | -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \ |
| 326 | -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \ |
| 327 | -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \ |
| 328 | -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ |
| 329 | -e '/@SDK_POST_INSTALL_COMMAND@/d' \ |
| 330 | -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \ |
| 331 | -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \ |
| 332 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 333 | |
| 334 | # add execution permission |
| 335 | chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 336 | |
| 337 | # append the SDK tarball |
| 338 | cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 339 | |
| 340 | # delete the old tarball, we don't need it anymore |
| 341 | rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} |
| 342 | } |
| 343 | |
| 344 | populate_sdk_log_check() { |
| 345 | for target in $* |
| 346 | do |
| 347 | lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}" |
| 348 | |
| 349 | echo "log_check: Using $lf_path as logfile" |
| 350 | |
| 351 | if [ -e "$lf_path" ]; then |
| 352 | ${IMAGE_PKGTYPE}_log_check $target $lf_path |
| 353 | else |
| 354 | echo "Cannot find logfile [$lf_path]" |
| 355 | fi |
| 356 | echo "Logfile is clean" |
| 357 | done |
| 358 | } |
| 359 | |
| 360 | def sdk_command_variables(d): |
| 361 | 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'] |
| 362 | |
| 363 | def sdk_variables(d): |
| 364 | variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT', |
| 365 | 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', |
| 366 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS'] |
| 367 | variables.extend(sdk_command_variables(d)) |
| 368 | return " ".join(variables) |
| 369 | |
| 370 | do_populate_sdk[vardeps] += "${@sdk_variables(d)}" |
| 371 | |
| 372 | python () { |
| 373 | variables = sdk_command_variables(d) |
| 374 | for var in variables: |
| 375 | if d.getVar(var, False): |
| 376 | d.setVarFlag(var, 'func', '1') |
| 377 | } |
| 378 | |
| 379 | do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \ |
| 380 | ${TOOLCHAIN_SHAR_EXT_TMPL}:True" |
| 381 | |
| 382 | do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}" |
| 383 | do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}" |
| 384 | do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}" |
| 385 | do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb" |
| 386 | do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}" |
| 387 | addtask populate_sdk |