From f04bb421028bdb55a6e6c8a380d4d817e195774a Mon Sep 17 00:00:00 2001 From: Doan Tran Cong Danh Date: Mon, 16 Dec 2019 21:33:04 +0700 Subject: [PATCH] efitools: add patch for latest gnu-efi-libs --- .../patches/01-gnu-efi-libs-update.patch | 11 ++++++ ....patch => 02-libressl-compatibility.patch} | 0 ...-makefile-enable-harden-local-files.patch} | 0 ... 04-makefile-keep-freestanding-flag.patch} | 0 ...e-remove-useless-problematic-target.patch} | 0 .../patches/06-makefile-cross-compile.patch | 37 +++++++++++++++++++ srcpkgs/efitools/template | 17 +++------ 7 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 srcpkgs/efitools/patches/01-gnu-efi-libs-update.patch rename srcpkgs/efitools/patches/{libressl-compatibility.patch => 02-libressl-compatibility.patch} (100%) rename srcpkgs/efitools/patches/{makefile-enable-harden-local-files.patch => 03-makefile-enable-harden-local-files.patch} (100%) rename srcpkgs/efitools/patches/{makefile-keep-freestanding-flag.patch => 04-makefile-keep-freestanding-flag.patch} (100%) rename srcpkgs/efitools/patches/{makefile-remove-useless-problematic-target.patch => 05-makefile-remove-useless-problematic-target.patch} (100%) create mode 100644 srcpkgs/efitools/patches/06-makefile-cross-compile.patch diff --git a/srcpkgs/efitools/patches/01-gnu-efi-libs-update.patch b/srcpkgs/efitools/patches/01-gnu-efi-libs-update.patch new file mode 100644 index 00000000000..fed5c32c25e --- /dev/null +++ b/srcpkgs/efitools/patches/01-gnu-efi-libs-update.patch @@ -0,0 +1,11 @@ +--- a/lib/console.c 2019-12-16 21:20:40.007421863 +0700 ++++ b/lib/console.c 2019-12-16 21:21:44.988540682 +0700 +@@ -357,7 +357,7 @@ + { EFI_SECURITY_VIOLATION, L"Security Violation"}, + + // warnings +- { EFI_WARN_UNKOWN_GLYPH, L"Warning Unknown Glyph"}, ++ { EFI_WARN_UNKNOWN_GLYPH, L"Warning Unknown Glyph"}, + { EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"}, + { EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"}, + { EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"}, diff --git a/srcpkgs/efitools/patches/libressl-compatibility.patch b/srcpkgs/efitools/patches/02-libressl-compatibility.patch similarity index 100% rename from srcpkgs/efitools/patches/libressl-compatibility.patch rename to srcpkgs/efitools/patches/02-libressl-compatibility.patch diff --git a/srcpkgs/efitools/patches/makefile-enable-harden-local-files.patch b/srcpkgs/efitools/patches/03-makefile-enable-harden-local-files.patch similarity index 100% rename from srcpkgs/efitools/patches/makefile-enable-harden-local-files.patch rename to srcpkgs/efitools/patches/03-makefile-enable-harden-local-files.patch diff --git a/srcpkgs/efitools/patches/makefile-keep-freestanding-flag.patch b/srcpkgs/efitools/patches/04-makefile-keep-freestanding-flag.patch similarity index 100% rename from srcpkgs/efitools/patches/makefile-keep-freestanding-flag.patch rename to srcpkgs/efitools/patches/04-makefile-keep-freestanding-flag.patch diff --git a/srcpkgs/efitools/patches/makefile-remove-useless-problematic-target.patch b/srcpkgs/efitools/patches/05-makefile-remove-useless-problematic-target.patch similarity index 100% rename from srcpkgs/efitools/patches/makefile-remove-useless-problematic-target.patch rename to srcpkgs/efitools/patches/05-makefile-remove-useless-problematic-target.patch diff --git a/srcpkgs/efitools/patches/06-makefile-cross-compile.patch b/srcpkgs/efitools/patches/06-makefile-cross-compile.patch new file mode 100644 index 00000000000..e18cf6e52d9 --- /dev/null +++ b/srcpkgs/efitools/patches/06-makefile-cross-compile.patch @@ -0,0 +1,37 @@ +diff --git a/Make.rules.orig b/Make.rules +index b849cfc4c7..7fdcc6095c 100644 +--- a/Make.rules.orig ++++ b/Make.rules +@@ -13,21 +13,25 @@ ARCH3264 = + else + $(error unknown architecture $(ARCH)) + endif +-INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol +-EFI_CPPFLAGS = -DCONFIG_$(ARCH) +-EFI_CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check ++INCDIR = -I$(TOPDIR)include \ ++ -I$(XBPS_CROSS_BASE)/usr/include/efi \ ++ -I$(XBPS_CROSS_BASE)/usr/include/efi/$(ARCH) \ ++ -I$(XBPS_CROSS_BASE)/usr/include/efi/protocol ++ ++EFI_CPPFLAGS = -DCONFIG_$(ARCH) ++EFI_CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check + EFI_LDFLAGS = -nostdlib + CRTOBJ = crt0-efi-$(ARCH).o +-CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi /usr/lib/gnuefi /usr/lib64/gnuefi +-CRTPATH = $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done) ++CRTPATHS = $(XBPS_CROSS_BASE)/usr/lib ++CRTPATH = $(XBPS_CROSS_BASE)/usr/lib + CRTOBJS = $(CRTPATH)/$(CRTOBJ) + # there's a bug in the gnu tools ... the .reloc section has to be + # aligned otherwise the file alignment gets screwed up + LDSCRIPT = elf_$(ARCH)_efi.lds +-EFI_LDFLAGS += -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) -L /usr/lib -L /usr/lib64 -T $(LDSCRIPT) ++EFI_LDFLAGS += -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH)\ ++ -L $(XBPS_CROSS_BASE)/usr/lib -L $(XBPS_CROSS_BASE)/usr/lib64 -T $(LDSCRIPT) + LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name) + FORMAT = --target=efi-app-$(ARCH) +-OBJCOPY = objcopy + MYGUID = 11111111-2222-3333-4444-123456789abc + INSTALL = install + BINDIR = $(DESTDIR)/usr/bin diff --git a/srcpkgs/efitools/template b/srcpkgs/efitools/template index 0a7e88f7ce8..57e9948790f 100644 --- a/srcpkgs/efitools/template +++ b/srcpkgs/efitools/template @@ -1,7 +1,7 @@ # Template file for 'efitools' pkgname=efitools version=1.9.2 -revision=2 +revision=3 archs="x86_64* i686* arm* aarch64*" build_style=gnu-makefile hostmakedepends="perl-File-Slurp" @@ -15,22 +15,17 @@ checksum=0f315b36e7d1ba74bfc97ab9f304f0a3072c47578bbe5e42594acae381f9acfe patch_args="-Nup1" post_patch() { - [ ! "$CROSS_BUILD" ] && return - case "${XBPS_TARGET_MACHINE}" in arm*) _ARCH=arm ;; i686*) _ARCH=ia32 ;; *) _ARCH="${XBPS_TARGET_MACHINE%-musl}" ;; esac # 1: correct target arch - # 2,3,4: include and lib inside sysroot - # 5: use cross-objcopy - sed -i -e "/^ARCH[[:space:]]*=/s/=.*/=${_ARCH}/" \ - -e "s,^\(CRTPATH.*=\).*,\1${XBPS_CROSS_BASE}/usr/lib," \ - -e "/^INCDIR/s,I\(/usr/include\),I${XBPS_CROSS_BASE}\1,g" \ - -e "s,-L /usr/lib,-L ${XBPS_CROSS_BASE}/usr/lib,g" \ - -e "/^OBJCOPY/d" \ - Make.rules + # 2: link to correct .o files + # 3: include sysroot's header + # 4: link to sysroot library + # 5: cross-objcopy + vsed -i -e "/^ARCH[[:space:]]*=/s/=.*/=${_ARCH}/" Make.rules } efitools-efi_package() {