Make the gnu-efi Makefiles install some of our compat libs.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2019-11-14 09:35:45 -05:00
parent e7a09764c4
commit 1104109978
11 changed files with 175 additions and 81 deletions

View File

@ -1,45 +1,116 @@
From 1071f82a88908aacc2de36111045f721ec53a644 Mon Sep 17 00:00:00 2001
From d81377adca4b2085ad3ab5714851899e4d4cd541 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 25 Oct 2019 15:41:16 -0400
Subject: [PATCH 36/45] Install our libraries in $(LIBDIR)/gnuefi/$(ARCH)
This makes it possible to install all the output on the same machine for
cross-builds.
cross-builds. This also adds "install_compat", which uses the previous
paths.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
gnuefi/Makefile | 10 +++++-----
lib/Makefile | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
Make.defaults | 1 +
Makefile | 4 ++--
apps/Makefile | 2 +-
gnuefi/Makefile | 22 ++++++++++++++++++----
inc/Makefile | 3 +++
lib/Makefile | 5 ++++-
6 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/Make.defaults b/Make.defaults
index 157559d20ee..7231e9bced2 100755
--- a/Make.defaults
+++ b/Make.defaults
@@ -72,6 +72,7 @@ LD := $(prefix)$(CROSS_COMPILE)ld
AR := $(prefix)$(CROSS_COMPILE)ar
RANLIB := $(prefix)$(CROSS_COMPILE)ranlib
OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy
+SYMLINK := ln -vfs
# Host/target identification
diff --git a/Makefile b/Makefile
index eecce6d9736..962ac72b664 100644
--- a/Makefile
+++ b/Makefile
@@ -87,10 +87,10 @@ clean:
fi; \
done
-install:
+install install_compat:
@set -e ; for d in $(SUBDIRS); do \
mkdir -p $(OBJDIR)/$$d; \
- $(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
+ $(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d $@ ; done
.PHONY: $(SUBDIRS) clean depend
diff --git a/apps/Makefile b/apps/Makefile
index 3b96f153a23..8ab83d58a3c 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -91,6 +91,6 @@ ctors_test.so : ctors_fns.o ctors_test.o
clean:
@rm -vf $(TARGETS) *~ *.o *.so
-.PHONY: install
+.PHONY: install install_compat
include $(SRCDIR)/../Make.rules
diff --git a/gnuefi/Makefile b/gnuefi/Makefile
index bea629b0b29..5bdaec7579b 100644
index bea629b0b29..7652669a7cc 100644
--- a/gnuefi/Makefile
+++ b/gnuefi/Makefile
@@ -60,16 +60,16 @@ clean:
@@ -60,16 +60,30 @@ clean:
@rm -vf $(TARGETS) *~ *.o $(OBJS)
install:
- mkdir -p $(INSTALLROOT)$(LIBDIR)
- $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
+ mkdir -p $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ $(INSTALL) -m 644 -t $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)/ $(TARGETS)
+ifneq (,$(findstring FreeBSD,$(OS)))
+ ifeq ($(ARCH),x64)
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ else
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ endif
+else
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+endif
+
+install_compat: install
mkdir -p $(INSTALLROOT)$(LIBDIR)
- $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
+ $(SYMLINK) gnuefi/$(ARCH)/libgnuefi.a $(INSTALLROOT)$(LIBDIR)/libgnuefi.a
+ $(SYMLINK) gnuefi/$(ARCH)/crt0-efi-$(ARCH).o $(INSTALLROOT)$(LIBDIR)/crt0-efi-$(BFD_ARCH).o
ifneq (,$(findstring FreeBSD,$(OS)))
ifeq ($(ARCH),x64)
- $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ $(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_fbsd_efi.lds
else
- $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ $(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
endif
else
- $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
+ $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+ $(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
endif
include $(SRCDIR)/../Make.rules
diff --git a/inc/Makefile b/inc/Makefile
index 13022fd6ae1..445d340f0fa 100644
--- a/inc/Makefile
+++ b/inc/Makefile
@@ -17,4 +17,7 @@ install:
$(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol
$(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
+install_compat: install
+ @if [ ! -h $(DEST)/$(BFD_ARCH) ]; then $(SYMLINK) $(ARCH) $(INSTALLROOT)$(PREFIX)/include/efi/$(BFD_ARCH) ; fi
+
include $(SRCDIR)/../Make.rules
diff --git a/lib/Makefile b/lib/Makefile
index 9a2b611cab7..14cf9059b28 100644
index 9a2b611cab7..0ec04b4e59d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -66,7 +66,7 @@ OBJS = $(FILES:%=%.o)
@ -47,10 +118,20 @@ index 9a2b611cab7..14cf9059b28 100644
SUBDIRS = $(ARCHES) runtime
-LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR)
+LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
+LIBDIRINSTALL ?= $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)
all: libsubdirs libefi.a
@@ -88,6 +88,9 @@ $(LIBDIRINSTALL)/libefi.a: libefi.a | $(LIBDIRINSTALL)
install: $(LIBDIRINSTALL)/libefi.a
+install_compat: install
+ $(SYMLINK) gnuefi/$(ARCH)/libefi.a $(INSTALLROOT)$(LIBDIR)/libefi.a
+
include $(SRCDIR)/../Make.rules
.PHONY: libsubdirs
--
2.24.1

View File

@ -1,4 +1,4 @@
From 0a12613849ffb6e32e1014b94d1e48b6ba2bef45 Mon Sep 17 00:00:00 2001
From 16d17b0d947b66ce76f79749123431b678f998df Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 25 Oct 2019 15:42:10 -0400
Subject: [PATCH 37/45] Install all headers for all arches.
@ -7,14 +7,14 @@ This further enables cross-builds by installing all the arches headers.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
inc/Makefile | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
inc/Makefile | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/inc/Makefile b/inc/Makefile
index 13022fd6ae1..f993cc5b108 100644
index 445d340f0fa..e8123fd3115 100644
--- a/inc/Makefile
+++ b/inc/Makefile
@@ -9,12 +9,14 @@ all:
@@ -9,15 +9,18 @@ all:
clean:
@ -34,6 +34,11 @@ index 13022fd6ae1..f993cc5b108 100644
+ $(INSTALL) -v -m 644 -t $(subst $(SOURCE),$(DEST),$(d)) $(wildcard $(d)/*.h); \
+ )
install_compat: install
- @if [ ! -h $(DEST)/$(BFD_ARCH) ]; then $(SYMLINK) $(ARCH) $(INSTALLROOT)$(PREFIX)/include/efi/$(BFD_ARCH) ; fi
+ @if [ ! -h $(DEST)/x86_64 ]; then $(SYMLINK) x64/ $(DEST)/x86_64 ; fi
+ @if [ ! -h $(DEST)/aarch64 ]; then $(SYMLINK) aa64/ $(DEST)/aarch64 ; fi
include $(SRCDIR)/../Make.rules
--
2.24.1

View File

@ -1,4 +1,4 @@
From 01560cac5ddbbb93d642c29758c27909ce1c1d18 Mon Sep 17 00:00:00 2001
From 6318d6eddeb905a01e81add07d4ab6fc35268ac8 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 13 Nov 2019 15:24:27 -0500
Subject: [PATCH 38/45] Rename our installed .o and linker scripts.
@ -9,14 +9,14 @@ renames them to crt0.o and efi.lds .
Signed-off-by: Peter Jones <pjones@redhat.com>
---
gnuefi/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
gnuefi/Makefile | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/gnuefi/Makefile b/gnuefi/Makefile
index 5bdaec7579b..d96ec74e96f 100644
index 7652669a7cc..86760f55578 100644
--- a/gnuefi/Makefile
+++ b/gnuefi/Makefile
@@ -55,21 +55,21 @@ all: $(TARGETS)
@@ -55,35 +55,35 @@ all: $(TARGETS)
libgnuefi.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $^
@ -43,6 +43,23 @@ index 5bdaec7579b..d96ec74e96f 100644
+ @$(INSTALL) -v -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/gnuefi/$(ARCH)/efi.lds
endif
install_compat: install
mkdir -p $(INSTALLROOT)$(LIBDIR)
$(SYMLINK) gnuefi/$(ARCH)/libgnuefi.a $(INSTALLROOT)$(LIBDIR)/libgnuefi.a
- $(SYMLINK) gnuefi/$(ARCH)/crt0-efi-$(ARCH).o $(INSTALLROOT)$(LIBDIR)/crt0-efi-$(BFD_ARCH).o
+ $(SYMLINK) gnuefi/$(ARCH)/crt0.o $(INSTALLROOT)$(LIBDIR)/crt0-efi-$(BFD_ARCH).o
ifneq (,$(findstring FreeBSD,$(OS)))
ifeq ($(ARCH),x64)
$(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_fbsd_efi.lds
else
- $(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
+ $(SYMLINK) gnuefi/$(ARCH)/efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
endif
else
- $(SYMLINK) gnuefi/$(ARCH)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
+ $(SYMLINK) gnuefi/$(ARCH)/efi.lds $(INSTALLROOT)$(LIBDIR)/elf_$(BFD_ARCH)_efi.lds
endif
include $(SRCDIR)/../Make.rules
--
2.24.1

View File

@ -1,4 +1,4 @@
From ea15a51ab4f9d513c773d9d8824e0dac8c883c0b Mon Sep 17 00:00:00 2001
From 456fb32b345ba87565bd3b99291c6009f499c22f Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 13 Nov 2019 15:24:41 -0500
Subject: [PATCH 39/45] Supply makefile templates.
@ -33,10 +33,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 inc/x64.mk
diff --git a/Make.defaults b/Make.defaults
index 157559d20ee..284819977ed 100755
index 7231e9bced2..01269660ab8 100755
--- a/Make.defaults
+++ b/Make.defaults
@@ -81,12 +81,14 @@ HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
@@ -82,12 +82,14 @@ HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
-e s,amd64,x64, -e s,x86_64,x64, \
-e s,aarch64,aa64, \
-e 's,armv[[:digit:]].*,arm,' \
@ -51,7 +51,7 @@ index 157559d20ee..284819977ed 100755
)
BFD_ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
-e s,i[3456789]86,ia32, \
@@ -101,6 +103,7 @@ ifneq ($(CROSS_COMPILE),)
@@ -102,6 +104,7 @@ ifneq ($(CROSS_COMPILE),)
-e s,amd64,x64, -e s,x86_64,x64, \
-e s,aarch64,aa64, \
-e 's,armv[[:digit:]].*,arm,' \
@ -59,7 +59,7 @@ index 157559d20ee..284819977ed 100755
)
endif
@@ -160,7 +163,8 @@ ifneq (,$(filter $(ARCH),ia32 x64))
@@ -161,7 +164,8 @@ ifneq (,$(filter $(ARCH),ia32 x64))
endif
ifeq ($(ARCH),mips64el)
@ -78,10 +78,10 @@ index 00000000000..91716c91aab
+efi.mk
+efi.mk.3
diff --git a/inc/Makefile b/inc/Makefile
index f993cc5b108..34d49a075d0 100644
index e8123fd3115..c7f1406f026 100644
--- a/inc/Makefile
+++ b/inc/Makefile
@@ -5,18 +5,37 @@ TOPDIR = $(SRCDIR)/..
@@ -5,19 +5,38 @@ TOPDIR = $(SRCDIR)/..
include $(SRCDIR)/../Make.defaults
@ -121,7 +121,8 @@ index f993cc5b108..34d49a075d0 100644
+
+.PHONY: install
include $(SRCDIR)/../Make.rules
install_compat: install
@if [ ! -h $(DEST)/x86_64 ]; then $(SYMLINK) x64/ $(DEST)/x86_64 ; fi
diff --git a/inc/aa64.mk b/inc/aa64.mk
new file mode 100644
index 00000000000..406915ef742

View File

@ -1,4 +1,4 @@
From ff402db6d28775e0ff5412d9d00f1986b877ea77 Mon Sep 17 00:00:00 2001
From 212920a4c3dedc6fc119fb371be798dfc971a749 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 18 Nov 2019 13:05:15 -0500
Subject: [PATCH 40/45] Semi-asciibetize _Print()'s formatters.

View File

@ -1,4 +1,4 @@
From 37e7f439442c89f5bcb30ba7b65f3d7ba5eff9bf Mon Sep 17 00:00:00 2001
From 58c33b63da0e8def2fab43b79ae73403f5ccc23d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 18 Nov 2019 13:06:23 -0500
Subject: [PATCH 41/45] Implement Print(L"%p", ptr);

View File

@ -1,4 +1,4 @@
From 34e890bcf098ef21194db9d440762b5a34e50196 Mon Sep 17 00:00:00 2001
From 55ea0b4b8ce651bf9d1048754e7a2981624509a2 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 19 Nov 2019 13:23:14 -0500
Subject: [PATCH 42/45] Switch to -fPIE
@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Make.defaults b/Make.defaults
index 284819977ed..27d74a74954 100755
index 01269660ab8..15af35e6e26 100755
--- a/Make.defaults
+++ b/Make.defaults
@@ -192,10 +192,10 @@ endif
@@ -193,10 +193,10 @@ endif
INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \
-I$(TOPDIR)/inc/protocol

View File

@ -1,4 +1,4 @@
From f5d8b8181ff9241a313810d9a5fd62e35d7a9d8a Mon Sep 17 00:00:00 2001
From dba7d5eeb75c3e8526eaf6b898e3ba808dde5ac4 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 14 Jan 2020 10:13:30 -0500
Subject: [PATCH 43/45] lfbgrid: Make pointer size testing not arch name

View File

@ -1,4 +1,4 @@
From 7fcc84bd9b5d99a9966269483692eaa58ebf9662 Mon Sep 17 00:00:00 2001
From e483e9bd6e900c2e9a637165149f60b44bba109e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 15 Jan 2020 13:07:49 -0500
Subject: [PATCH 44/45] Fix the arch subdirs in .gitignore.

View File

@ -1,4 +1,4 @@
From 981ef7277241d0c5986b79cce16f3960f7e17ee4 Mon Sep 17 00:00:00 2001
From 926725b8704472ee2565e6c3fbd1a2012732f9de Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 15 Jan 2020 13:10:11 -0500
Subject: [PATCH 45/45] Use CFLAGS with "gcc -print-libgcc-file-name" to get
@ -13,10 +13,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Make.defaults b/Make.defaults
index 27d74a74954..fd5ccde7dbc 100755
index 15af35e6e26..de88bcd0231 100755
--- a/Make.defaults
+++ b/Make.defaults
@@ -180,10 +180,6 @@ endif
@@ -181,10 +181,6 @@ endif
endif
endif
@ -27,7 +27,7 @@ index 27d74a74954..fd5ccde7dbc 100755
ifeq ($(ARCH),arm)
CFLAGS += -marm
endif
@@ -222,3 +218,7 @@ endif
@@ -223,3 +219,7 @@ endif
ASFLAGS += $(ARCH3264)
LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \
--build-id=sha1

View File

@ -58,7 +58,7 @@ applications that run under EFI (Extensible Firmware Interface).
%package devel
Summary: Development Libraries and headers for EFI
Obsoletes: gnu-efi < 1:3.0.2-1
Requires: gnu-efi
Requires: gnu-efi = %{epoch}:%{version}-%{release}
BuildArch: noarch
%description devel
@ -93,55 +93,45 @@ make apps
%endif
%install
mkdir -p %{buildroot}/%{_libdir}/gnuefi
mkdir -p %{buildroot}/%{_prefix}/lib/
mkdir -p %{buildroot}/%{efi_esp_dir}/%{efi_arch}
make PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib INSTALLROOT=%{buildroot} install
mkdir -p %{buildroot}/%{efi_esp_dir}/%{efi_arch}
mv %{efi_arch}/apps/{route80h.efi,modelist.efi} %{buildroot}%{efi_esp_dir}/%{efi_arch}/
# temporarily, for compatibility with our older packages
# for compatibility with our older packages
make PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib INSTALLROOT=%{buildroot} install_compat
mkdir -p %{buildroot}/%{_libdir}/gnuefi/
mkdir -p %{buildroot}/%{_includedir}/efi/
if [[ -d %{buildroot}/%{_prefix}/lib/gnuefi/x64 ]] ; then
ln -s ../../lib/gnuefi/%{efi_arch} %{buildroot}/%{_libdir}/gnuefi/%{efi_arch}
ln -s %{efi_arch}/crt0.o %{buildroot}/%{_libdir}/gnuefi/crt0-efi-x86_64.o
ln -s %{efi_arch}/efi.lds %{buildroot}/%{_libdir}/gnuefi/elf_x86_64_efi.lds
ln -s %{efi_arch}/libefi.a %{buildroot}/%{_libdir}/gnuefi/libefi.a
ln -s %{efi_arch}/libgnuefi.a %{buildroot}/%{_libdir}/gnuefi/libgnuefi.a
elif [[ -d %{buildroot}/%{_prefix}/lib/gnuefi/aa64 ]] ; then
ln -s ../../lib/gnuefi/%{efi_arch} %{buildroot}/%{_libdir}/gnuefi/%{efi_arch}
ln -s %{efi_arch}/crt0.o %{buildroot}/%{_libdir}/gnuefi/crt0-efi-aarch64.o
ln -s %{efi_arch}/efi.lds %{buildroot}/%{_libdir}/gnuefi/elf_aarch64_efi.lds
ln -s %{efi_arch}/libefi.a %{buildroot}/%{_libdir}/gnuefi/libefi.a
ln -s %{efi_arch}/libgnuefi.a %{buildroot}/%{_libdir}/gnuefi/libgnuefi.a
fi
%if %{efi_has_alt_arch}
mkdir -p %{buildroot}%{efi_esp_dir}/%{efi_alt_arch}
setarch linux32 -B make PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib INSTALLROOT=%{buildroot} ARCH=%{efi_alt_arch} install
mkdir -p %{buildroot}%{efi_esp_dir}/%{efi_alt_arch}
mv %{efi_alt_arch}/apps/{route80h.efi,modelist.efi} %{buildroot}%{efi_esp_dir}/%{efi_alt_arch}/
# temporarily, for compatibility with our older packages
cd %{buildroot}/%{_prefix}/lib/
ln -s gnuefi/%{efi_alt_arch}/*.a .
cd gnuefi
ln -s %{efi_alt_arch}/crt0.o crt0-efi-%{efi_alt_arch}.o
ln -s %{efi_alt_arch}/efi.lds elf_%{efi_alt_arch}_efi.lds
# for compatibility with our older packages
setarch linux32 -B make PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib INSTALLROOT=%{buildroot} ARCH=%{efi_alt_arch} BFD_ARCH=%{efi_alt_arch} install_compat
mkdir -p %{buildroot}/%{_prefix}/lib/gnuefi/
ln -s %{efi_alt_arch}/crt0.o %{buildroot}/%{_prefix}/lib/gnuefi/crt0-efi-%{efi_alt_arch}.o
ln -s %{efi_alt_arch}/efi.lds %{buildroot}/%{_prefix}/lib/gnuefi/elf_%{efi_alt_arch}_efi.lds
ln -s %{efi_alt_arch}/libefi.a %{buildroot}/%{_prefix}/lib/gnuefi/libefi.a
ln -s %{efi_alt_arch}/libgnuefi.a %{buildroot}/%{_prefix}/lib/gnuefi/libgnuefi.a
%endif
# temporarily, for compatibility with our older packages
cd %{buildroot}/%{_libdir}/
ln -s ../lib/gnuefi/%{efi_arch}/*.a .
cd gnuefi
ln -s ../../lib/gnuefi/%{efi_arch}/crt0.o crt0-efi-%{efi_arch}.o
ln -s ../../lib/gnuefi/%{efi_arch}/efi.lds elf_%{efi_arch}_efi.lds
%ifarch x86_64
ln -s ../../lib/gnuefi/%{efi_arch}/crt0.o crt0-efi-x86_64.o
ln -s ../../lib/gnuefi/%{efi_arch}/efi.lds elf_x86_64_efi.lds
%endif
%ifarch aarch64
ln -s ../../lib/gnuefi/%{efi_arch}/crt0.o crt0-efi-aarch64.o
ln -s ../../lib/gnuefi/%{efi_arch}/efi.lds elf_aarch64_efi.lds
%endif
cd %{buildroot}/%{_includedir}/efi
if [[ -d aa64 ]] ; then
ln -s aa64 aarch64
fi
if [[ -d x64 ]] ; then
ln -s x64 x86_64
fi
%files
%{_prefix}/lib*/*
%{_prefix}/lib*/gnuefi
%{_prefix}/lib*/*.{o,a,lds}
%files devel
%doc README.*