Files
poky/meta/classes-recipe/multilib_script.bbclass
Richard Purdie fd1517e2b5 classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.

(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12 15:27:17 +01:00

41 lines
1.3 KiB
Plaintext

#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
#
# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
# to indicate which script files to process from which packages.
#
inherit update-alternatives
MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
multilibscript_rename() {
:
}
python () {
# Do nothing if multilib isn't being used
if not d.getVar("MULTILIB_VARIANTS"):
return
# Do nothing for native/cross
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
return
for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
pkg, script = entry.split(":")
epkg = d.expand(pkg)
scriptname = os.path.basename(script)
d.appendVar("ALTERNATIVE:" + epkg, " " + scriptname + " ")
d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
d.appendVar("FILES:" + epkg, " " + script + "-${MULTILIB_SUFFIX}")
}