mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:52:39 +02:00
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. (From OE-Core rev: 65e160ae521386d80cd21df72d23814afb9e445c) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
c91078954e
commit
907b87dd11
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user