aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/multilib_script.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/multilib_script.bbclass')
-rw-r--r--meta/classes/multilib_script.bbclass32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/classes/multilib_script.bbclass b/meta/classes/multilib_script.bbclass
new file mode 100644
index 00000000000..a5a552b7163
--- /dev/null
+++ b/meta/classes/multilib_script.bbclass
@@ -0,0 +1,32 @@
+#
+# 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(":")
+ scriptname = os.path.basename(script)
+ d.setVar("ALTERNATIVE_" + pkg, 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}")
+}