From b785bd6de7e4fedada8f301d6a29d8d3cf2c2fad Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Sat, 5 Sep 2015 22:28:29 -0400 Subject: [PATCH] sys-boot/gnu-efi: Support building ia32 EFI libs on amd64 Package-Manager: portage-2.2.20 --- sys-boot/gnu-efi/gnu-efi-3.0.3.ebuild | 55 ++++++++++++++++++--------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/sys-boot/gnu-efi/gnu-efi-3.0.3.ebuild b/sys-boot/gnu-efi/gnu-efi-3.0.3.ebuild index f79b3b2961d5..9c6a09fcff1d 100644 --- a/sys-boot/gnu-efi/gnu-efi-3.0.3.ebuild +++ b/sys-boot/gnu-efi/gnu-efi-3.0.3.ebuild @@ -13,7 +13,7 @@ SRC_URI="mirror://sourceforge/gnu-efi/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="-* ~amd64 ~ia64 ~x86" -IUSE="" +IUSE="abi_x86_32 abi_x86_64" DEPEND="sys-apps/pciutils" RDEPEND="" @@ -21,29 +21,48 @@ RDEPEND="" # These objects get run early boot (i.e. not inside of Linux), # so doing these QA checks on them doesn't make sense. QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o" +RESTRICT="strip" -_emake() { - emake \ - prefix=${CHOST}- \ - ARCH=${iarch} \ - PREFIX="${EPREFIX}/usr" \ - LIBDIR='$(PREFIX)/'"$(get_libdir)" \ - "$@" +efimake() { + local arch= + case ${CHOST} in + arm*) arch=arm ;; + aarch64*) arch=aarch64 ;; + ia64*) arch=ia64 ;; + i?86*) arch=ia32 ;; + x86_64*) arch=x86_64 ;; + *) die "Unknown CHOST" ;; + esac + + local args=( + ARCH="${arch}" + HOSTCC="${BUILD_CC}" + CC="${CC}" + AS="${AS}" + LD="${LD}" + AR="${AR}" + PREFIX="${EPREFIX}/usr" + LIBDIR='$(PREFIX)'/$(get_libdir) + ) + emake -j1 "${args[@]}" "$@" } src_compile() { - case ${ARCH} in - ia64) iarch=ia64 ;; - x86) iarch=ia32 ;; - amd64) iarch=x86_64 ;; - *) die "unknown architecture: $ARCH" ;; - esac - # The lib subdir uses unsafe archive targets, and - # the apps subdir needs gnuefi subdir - _emake -j1 + tc-export BUILD_CC AR AS CC LD + if [[ ${CHOST} == x86_64* ]]; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake + use abi_x86_64 && efimake + else + efimake + fi } src_install() { - _emake install PREFIX=/usr INSTALLROOT="${D}" + if [[ ${CHOST} == x86_64* ]]; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake INSTALLROOT="${D}" install + use abi_x86_64 && efimake INSTALLROOT="${D}" install + else + efimake INSTALLROOT="${D}" install + fi dodoc README* ChangeLog } -- 2.26.2