summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/rpm
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2015-11-18 19:46:02 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-27 11:27:01 +0000
commit65e160ae521386d80cd21df72d23814afb9e445c (patch)
tree809aacebab15c805d32ac779cfd6500277ff7d41 /meta/recipes-devtools/rpm
parent5cb597a19dbfe825e5b26d828e18644c9ee58f86 (diff)
downloadopenembedded-core-65e160ae521386d80cd21df72d23814afb9e445c.tar.gz
openembedded-core-65e160ae521386d80cd21df72d23814afb9e445c.tar.bz2
openembedded-core-65e160ae521386d80cd21df72d23814afb9e445c.zip
rpm: Generate per distribution and multilib macro files
The distribution and multilib macro files are required for rpmbuild, on the target, to work properly. These override the default settings from the upstream macro files with the proper values for the OE configuration. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.14.bb81
1 files changed, 81 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.14.bb b/meta/recipes-devtools/rpm/rpm_5.4.14.bb
index f338fd6706..24aaf655df 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.14.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.14.bb
@@ -119,6 +119,9 @@ inherit autotools gettext
acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java"
+# The local distribution macro directory
+distromacrodir = "${libdir}/rpm/poky"
+
# Specify the default rpm macros in terms of adjustable variables
rpm_macros = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:%{_etcrpm}/macros.*:%{_etcrpm}/macros:%{_etcrpm}/%{_target}/macros:~/.oerpmmacros"
rpm_macros_class-native = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:~/.oerpmmacros"
@@ -338,6 +341,7 @@ FILES_${PN}-build = "${prefix}/src/rpm \
${libdir}/rpm/vpkg-provides.sh \
${libdir}/rpm/vpkg-provides2.sh \
${libdir}/rpm/perfile_rpmdeps.sh \
+ ${distromacrodir} \
"
RDEPENDS_${PN} = "base-files run-postinsts"
RDEPENDS_${PN}_class-native = ""
@@ -481,6 +485,83 @@ do_install_append() {
}
+do_install_append_class-target() {
+ # Create and install distribution specific macros
+ mkdir -p ${D}/${distromacrodir}
+ cat << EOF > ${D}/${distromacrodir}/macros
+%_defaultdocdir ${docdir}
+
+%_prefix ${prefix}
+%_exec_prefix ${exec_prefix}
+%_datarootdir ${datadir}
+%_bindir ${bindir}
+%_sbindir ${sbindir}
+%_libexecdir %{_libdir}/%{name}
+%_datadir ${datadir}
+%_sysconfdir ${sysconfdir}
+%_sharedstatedir ${sharedstatedir}
+%_localstatedir ${localstatedir}
+%_lib lib
+%_libdir %{_exec_prefix}/%{_lib}
+%_includedir ${includedir}
+%_oldincludedir ${oldincludedir}
+%_infodir ${infodir}
+%_mandir ${mandir}
+%_localedir %{_libdir}/locale
+EOF
+
+ # Create and install multilib specific macros
+ ${@multilib_rpmmacros(d)}
+}
+
+def multilib_rpmmacros(d):
+ localdata = d.createCopy()
+ # We need to clear the TOOLCHAIN_OPTIONS (--sysroot)
+ localdata.delVar('TOOLCHAIN_OPTIONS')
+
+ # Set 'localdata' values to be consistent with 'd' values.
+ localdata.setVar('distromacrodir', d.getVar('distromacrodir', True))
+ localdata.setVar('WORKDIR', d.getVar('WORKDIR', True))
+
+ ret = gen_arch_macro(localdata)
+
+ variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+ for item in variants.split():
+ # Load overrides from 'd' to avoid having to reset the value...
+ localdata = d.createCopy()
+ overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
+ localdata.setVar("OVERRIDES", overrides)
+ localdata.setVar("MLPREFIX", item + "-")
+ bb.data.update_data(localdata)
+ ret += gen_arch_macro(localdata)
+ return ret
+
+def gen_arch_macro(d):
+ # Generate shell script to produce the file as part of do_install
+ val = "mkdir -p ${D}/${distromacrodir}/${TARGET_ARCH}-${TARGET_OS}\n"
+ val += "cat << EOF > ${D}/${distromacrodir}/${TARGET_ARCH}-${TARGET_OS}/macros\n"
+ val += "%_lib ${baselib}\n"
+ val += "%_libdir ${libdir}\n"
+ val += "%_localedir ${localedir}\n"
+ val += "\n"
+ val += "# Toolchain configuration\n"
+ val += "%TOOLCHAIN_OPTIONS %{nil}\n"
+ val += "%__ar ${@d.getVar('AR', True).replace('$','%')}\n"
+ val += "%__as ${@d.getVar('AS', True).replace('$','%')}\n"
+ val += "%__cc ${@d.getVar('CC', True).replace('$','%')}\n"
+ val += "%__cpp ${@d.getVar('CPP', True).replace('$','%')}\n"
+ val += "%__cxx ${@d.getVar('CXX', True).replace('$','%')}\n"
+ val += "%__ld ${@d.getVar('LD', True).replace('$','%')}\n"
+ val += "%__nm ${@d.getVar('NM', True).replace('$','%')}\n"
+ val += "%__objcopy ${@d.getVar('OBJCOPY', True).replace('$','%')}\n"
+ val += "%__objdump ${@d.getVar('OBJDUMP', True).replace('$','%')}\n"
+ val += "%__ranlib ${@d.getVar('RANLIB', True).replace('$','%')}\n"
+ val += "%__strip ${@d.getVar('STRIP', True).replace('$','%')}\n"
+ val += "EOF\n"
+ val += "\n"
+ return d.expand(val)
+
+
add_native_wrapper() {
create_wrapper ${D}/${bindir}/rpm \
RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \