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' |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 18 | COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest 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 |
| 165 | |
| 166 | # Handle package exclusions |
| 167 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() |
| 168 | inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split() |
| 169 | inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split() |
| 170 | |
| 171 | d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) |
| 172 | d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) |
| 173 | |
| 174 | for pkg in excl_pkgs: |
| 175 | if pkg in inst_pkgs: |
| 176 | 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)) |
| 177 | inst_pkgs.remove(pkg) |
| 178 | |
| 179 | if pkg in inst_attempt_pkgs: |
| 180 | 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)) |
| 181 | inst_attempt_pkgs.remove(pkg) |
| 182 | |
| 183 | d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) |
| 184 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) |
| 185 | |
| 186 | pn = d.getVar('PN') |
| 187 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) |
| 188 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) |
| 189 | |
| 190 | ld = bb.data.createCopy(d) |
| 191 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") |
| 192 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) |
| 193 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) |
| 194 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) |
| 195 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) |
| 196 | |
| 197 | # create target/host SDK manifests |
| 198 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
| 199 | manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST) |
| 200 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), |
| 201 | manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET) |
| 202 | |
| 203 | populate_sdk(d) |
| 204 | |
| 205 | fakeroot python do_populate_sdk() { |
| 206 | populate_sdk_common(d) |
| 207 | } |
| 208 | SSTATETASKS += "do_populate_sdk" |
| 209 | SSTATE_SKIP_CREATION:task-populate-sdk = '1' |
| 210 | do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}" |
| 211 | do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}" |
| 212 | do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}" |
| 213 | do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" |
| 214 | python do_populate_sdk_setscene () { |
| 215 | sstate_setscene(d) |
| 216 | } |
| 217 | addtask do_populate_sdk_setscene |
| 218 | |
| 219 | PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk" |
| 220 | |
| 221 | fakeroot create_sdk_files() { |
| 222 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ |
| 223 | |
| 224 | # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern. |
| 225 | # Escape special characters like '+' and '.' in the SDKPATH |
| 226 | escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g") |
| 227 | sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py |
| 228 | |
| 229 | mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ |
| 230 | echo '${SDKPATHNATIVE}${libdir_nativesdk} |
| 231 | ${SDKPATHNATIVE}${base_libdir_nativesdk} |
| 232 | include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf |
| 233 | } |
| 234 | |
| 235 | python check_sdk_sysroots() { |
| 236 | # Fails build if there are broken or dangling symlinks in SDK sysroots |
| 237 | |
| 238 | if d.getVar('CHECK_SDK_SYSROOTS') != '1': |
| 239 | # disabled, bail out |
| 240 | return |
| 241 | |
| 242 | def norm_path(path): |
| 243 | return os.path.abspath(path) |
| 244 | |
| 245 | # Get scan root |
| 246 | SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'), |
| 247 | d.getVar('SDKPATH'))) |
| 248 | |
| 249 | bb.note('Checking SDK sysroots at ' + SCAN_ROOT) |
| 250 | |
| 251 | def check_symlink(linkPath): |
| 252 | if not os.path.islink(linkPath): |
| 253 | return |
| 254 | |
| 255 | linkDirPath = os.path.dirname(linkPath) |
| 256 | |
| 257 | targetPath = os.readlink(linkPath) |
| 258 | if not os.path.isabs(targetPath): |
| 259 | targetPath = os.path.join(linkDirPath, targetPath) |
| 260 | targetPath = norm_path(targetPath) |
| 261 | |
| 262 | if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ): |
| 263 | bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 264 | return |
| 265 | |
| 266 | if not os.path.exists(targetPath): |
| 267 | bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath)) |
| 268 | return |
| 269 | |
| 270 | if os.path.isdir(targetPath): |
| 271 | dir_walk(targetPath) |
| 272 | |
| 273 | def walk_error_handler(e): |
| 274 | bb.error(str(e)) |
| 275 | |
| 276 | def dir_walk(rootDir): |
| 277 | for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler): |
| 278 | entries = subDirEntries + fileEntries |
| 279 | for e in entries: |
| 280 | ePath = os.path.join(dirPath, e) |
| 281 | check_symlink(ePath) |
| 282 | |
| 283 | # start |
| 284 | dir_walk(SCAN_ROOT) |
| 285 | } |
| 286 | |
| 287 | SDKTAROPTS = "--owner=root --group=root" |
| 288 | |
| 289 | fakeroot archive_sdk() { |
| 290 | # Package it up |
| 291 | mkdir -p ${SDKDEPLOYDIR} |
| 292 | ${SDK_ARCHIVE_CMD} |
| 293 | } |
| 294 | |
| 295 | TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh" |
| 296 | TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh" |
| 297 | |
| 298 | fakeroot create_shar() { |
| 299 | # copy in the template shar extractor script |
| 300 | cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 301 | |
| 302 | rm -f ${T}/pre_install_command ${T}/post_install_command |
| 303 | |
| 304 | if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then |
| 305 | cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command |
| 306 | fi |
| 307 | cat << "EOF" >> ${T}/pre_install_command |
| 308 | ${SDK_PRE_INSTALL_COMMAND} |
| 309 | EOF |
| 310 | |
| 311 | cat << "EOF" >> ${T}/post_install_command |
| 312 | ${SDK_POST_INSTALL_COMMAND} |
| 313 | EOF |
| 314 | sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \ |
| 315 | -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \ |
| 316 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 317 | |
| 318 | # substitute variables |
| 319 | sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \ |
| 320 | -e 's#@SDKPATH@#${SDKPATH}#g' \ |
| 321 | -e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \ |
| 322 | -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \ |
| 323 | -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \ |
| 324 | -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \ |
| 325 | -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \ |
| 326 | -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \ |
| 327 | -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ |
| 328 | -e '/@SDK_POST_INSTALL_COMMAND@/d' \ |
| 329 | -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \ |
| 330 | -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \ |
| 331 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 332 | |
| 333 | # add execution permission |
| 334 | chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 335 | |
| 336 | # append the SDK tarball |
| 337 | cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh |
| 338 | |
| 339 | # delete the old tarball, we don't need it anymore |
| 340 | rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} |
| 341 | } |
| 342 | |
| 343 | populate_sdk_log_check() { |
| 344 | for target in $* |
| 345 | do |
| 346 | lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}" |
| 347 | |
| 348 | echo "log_check: Using $lf_path as logfile" |
| 349 | |
| 350 | if [ -e "$lf_path" ]; then |
| 351 | ${IMAGE_PKGTYPE}_log_check $target $lf_path |
| 352 | else |
| 353 | echo "Cannot find logfile [$lf_path]" |
| 354 | fi |
| 355 | echo "Logfile is clean" |
| 356 | done |
| 357 | } |
| 358 | |
| 359 | def sdk_command_variables(d): |
| 360 | 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'] |
| 361 | |
| 362 | def sdk_variables(d): |
| 363 | variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT', |
| 364 | 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', |
| 365 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS'] |
| 366 | variables.extend(sdk_command_variables(d)) |
| 367 | return " ".join(variables) |
| 368 | |
| 369 | do_populate_sdk[vardeps] += "${@sdk_variables(d)}" |
| 370 | |
| 371 | python () { |
| 372 | variables = sdk_command_variables(d) |
| 373 | for var in variables: |
| 374 | if d.getVar(var, False): |
| 375 | d.setVarFlag(var, 'func', '1') |
| 376 | } |
| 377 | |
| 378 | do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \ |
| 379 | ${TOOLCHAIN_SHAR_EXT_TMPL}:True" |
| 380 | |
| 381 | do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}" |
| 382 | do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}" |
| 383 | do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}" |
| 384 | do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb" |
| 385 | do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}" |
| 386 | addtask populate_sdk |