diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2015-11-18 19:46:02 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-28 09:25:19 +0000 |
commit | 907b87dd11c52ee6641fb19b1e58da720bf4df25 (patch) | |
tree | 60a4d0eca461b53e230f22a1c1b9a214c0177d33 | |
parent | c91078954e9f183412456d04c8261a0198a063c1 (diff) | |
download | poky-907b87dd11c52ee6641fb19b1e58da720bf4df25.tar.gz |
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>
-rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.14.bb | 81 |
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 | |||
119 | 119 | ||
120 | acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java" | 120 | acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java" |
121 | 121 | ||
122 | # The local distribution macro directory | ||
123 | distromacrodir = "${libdir}/rpm/poky" | ||
124 | |||
122 | # Specify the default rpm macros in terms of adjustable variables | 125 | # Specify the default rpm macros in terms of adjustable variables |
123 | rpm_macros = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:%{_etcrpm}/macros.*:%{_etcrpm}/macros:%{_etcrpm}/%{_target}/macros:~/.oerpmmacros" | 126 | rpm_macros = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:%{_etcrpm}/macros.*:%{_etcrpm}/macros:%{_etcrpm}/%{_target}/macros:~/.oerpmmacros" |
124 | rpm_macros_class-native = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:~/.oerpmmacros" | 127 | rpm_macros_class-native = "%{_usrlibrpm}/macros:%{_usrlibrpm}/${DISTRO}/macros:%{_usrlibrpm}/${DISTRO}/%{_target}/macros:~/.oerpmmacros" |
@@ -338,6 +341,7 @@ FILES_${PN}-build = "${prefix}/src/rpm \ | |||
338 | ${libdir}/rpm/vpkg-provides.sh \ | 341 | ${libdir}/rpm/vpkg-provides.sh \ |
339 | ${libdir}/rpm/vpkg-provides2.sh \ | 342 | ${libdir}/rpm/vpkg-provides2.sh \ |
340 | ${libdir}/rpm/perfile_rpmdeps.sh \ | 343 | ${libdir}/rpm/perfile_rpmdeps.sh \ |
344 | ${distromacrodir} \ | ||
341 | " | 345 | " |
342 | RDEPENDS_${PN} = "base-files run-postinsts" | 346 | RDEPENDS_${PN} = "base-files run-postinsts" |
343 | RDEPENDS_${PN}_class-native = "" | 347 | RDEPENDS_${PN}_class-native = "" |
@@ -481,6 +485,83 @@ do_install_append() { | |||
481 | 485 | ||
482 | } | 486 | } |
483 | 487 | ||
488 | do_install_append_class-target() { | ||
489 | # Create and install distribution specific macros | ||
490 | mkdir -p ${D}/${distromacrodir} | ||
491 | cat << EOF > ${D}/${distromacrodir}/macros | ||
492 | %_defaultdocdir ${docdir} | ||
493 | |||
494 | %_prefix ${prefix} | ||
495 | %_exec_prefix ${exec_prefix} | ||
496 | %_datarootdir ${datadir} | ||
497 | %_bindir ${bindir} | ||
498 | %_sbindir ${sbindir} | ||
499 | %_libexecdir %{_libdir}/%{name} | ||
500 | %_datadir ${datadir} | ||
501 | %_sysconfdir ${sysconfdir} | ||
502 | %_sharedstatedir ${sharedstatedir} | ||
503 | %_localstatedir ${localstatedir} | ||
504 | %_lib lib | ||
505 | %_libdir %{_exec_prefix}/%{_lib} | ||
506 | %_includedir ${includedir} | ||
507 | %_oldincludedir ${oldincludedir} | ||
508 | %_infodir ${infodir} | ||
509 | %_mandir ${mandir} | ||
510 | %_localedir %{_libdir}/locale | ||
511 | EOF | ||
512 | |||
513 | # Create and install multilib specific macros | ||
514 | ${@multilib_rpmmacros(d)} | ||
515 | } | ||
516 | |||
517 | def multilib_rpmmacros(d): | ||
518 | localdata = d.createCopy() | ||
519 | # We need to clear the TOOLCHAIN_OPTIONS (--sysroot) | ||
520 | localdata.delVar('TOOLCHAIN_OPTIONS') | ||
521 | |||
522 | # Set 'localdata' values to be consistent with 'd' values. | ||
523 | localdata.setVar('distromacrodir', d.getVar('distromacrodir', True)) | ||
524 | localdata.setVar('WORKDIR', d.getVar('WORKDIR', True)) | ||
525 | |||
526 | ret = gen_arch_macro(localdata) | ||
527 | |||
528 | variants = d.getVar("MULTILIB_VARIANTS", True) or "" | ||
529 | for item in variants.split(): | ||
530 | # Load overrides from 'd' to avoid having to reset the value... | ||
531 | localdata = d.createCopy() | ||
532 | overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item | ||
533 | localdata.setVar("OVERRIDES", overrides) | ||
534 | localdata.setVar("MLPREFIX", item + "-") | ||
535 | bb.data.update_data(localdata) | ||
536 | ret += gen_arch_macro(localdata) | ||
537 | return ret | ||
538 | |||
539 | def gen_arch_macro(d): | ||
540 | # Generate shell script to produce the file as part of do_install | ||
541 | val = "mkdir -p ${D}/${distromacrodir}/${TARGET_ARCH}-${TARGET_OS}\n" | ||
542 | val += "cat << EOF > ${D}/${distromacrodir}/${TARGET_ARCH}-${TARGET_OS}/macros\n" | ||
543 | val += "%_lib ${baselib}\n" | ||
544 | val += "%_libdir ${libdir}\n" | ||
545 | val += "%_localedir ${localedir}\n" | ||
546 | val += "\n" | ||
547 | val += "# Toolchain configuration\n" | ||
548 | val += "%TOOLCHAIN_OPTIONS %{nil}\n" | ||
549 | val += "%__ar ${@d.getVar('AR', True).replace('$','%')}\n" | ||
550 | val += "%__as ${@d.getVar('AS', True).replace('$','%')}\n" | ||
551 | val += "%__cc ${@d.getVar('CC', True).replace('$','%')}\n" | ||
552 | val += "%__cpp ${@d.getVar('CPP', True).replace('$','%')}\n" | ||
553 | val += "%__cxx ${@d.getVar('CXX', True).replace('$','%')}\n" | ||
554 | val += "%__ld ${@d.getVar('LD', True).replace('$','%')}\n" | ||
555 | val += "%__nm ${@d.getVar('NM', True).replace('$','%')}\n" | ||
556 | val += "%__objcopy ${@d.getVar('OBJCOPY', True).replace('$','%')}\n" | ||
557 | val += "%__objdump ${@d.getVar('OBJDUMP', True).replace('$','%')}\n" | ||
558 | val += "%__ranlib ${@d.getVar('RANLIB', True).replace('$','%')}\n" | ||
559 | val += "%__strip ${@d.getVar('STRIP', True).replace('$','%')}\n" | ||
560 | val += "EOF\n" | ||
561 | val += "\n" | ||
562 | return d.expand(val) | ||
563 | |||
564 | |||
484 | add_native_wrapper() { | 565 | add_native_wrapper() { |
485 | create_wrapper ${D}/${bindir}/rpm \ | 566 | create_wrapper ${D}/${bindir}/rpm \ |
486 | RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \ | 567 | RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \ |