blob: dc166d06c17e2c809c911e048fe21f651a2eda59 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001#
2# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
3# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
4# to indicate which script files to process from which packages.
5#
6
7inherit update-alternatives
8
9MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
10
11PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
12
13multilibscript_rename() {
14 :
15}
16
17python () {
18 # Do nothing if multilib isn't being used
19 if not d.getVar("MULTILIB_VARIANTS"):
20 return
21 # Do nothing for native/cross
22 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
23 return
24
25 for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
26 pkg, script = entry.split(":")
Brad Bishopa5c52ff2018-11-23 10:55:50 +130027 epkg = d.expand(pkg)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028 scriptname = os.path.basename(script)
Brad Bishopa5c52ff2018-11-23 10:55:50 +130029 d.appendVar("ALTERNATIVE_" + epkg, " " + scriptname + " ")
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030 d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
31 d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
32 d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
Brad Bishopa5c52ff2018-11-23 10:55:50 +130033 d.appendVar("FILES_" + epkg, " " + script + "-${MULTILIB_SUFFIX}")
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034}