fwupdate-9-objcopy_detection.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From affc219a5bac93cb6e774879c874c203f755ba11 Mon Sep 17 00:00:00 2001
  2. From: Raymund Will <rw@suse.com>
  3. Date: Mon, 13 Mar 2017 12:57:07 +0100
  4. Subject: [PATCH] Fix regression in "objcopy version check" (AKA `expr: syntax
  5. error`)
  6. While commit 8418fee4 may have fixed the check for "some distributions"
  7. it broke the same check for others, like
  8. `GNU objcopy (WinAVR 20090313) 2.19`
  9. `GNU objcopy (AVR_8_bit_GNU_Toolchain_3.4.3_1072) 2.23.2`
  10. `GNU objcopy (Codescape GNU Tools 2016.05-03 for MIPS MTI Bare Metal) 2.24.90`
  11. `GNU objcopy (GNU Binutils; openSUSE Leap 42.2) 2.26.1`
  12. `GNU objcopy (GNU Binutils; SUSE Linux Enterprise 12) 2.26.1`
  13. (some more, some less relevant... ;)
  14. This version is meant to cover them all (or at least be easily extensible).
  15. Signed-off-by: Raymund Will <rw@suse.com>
  16. ---
  17. efi/Makefile | 10 +++++++++-
  18. 1 file changed, 9 insertions(+), 1 deletion(-)
  19. diff --git a/efi/Makefile b/efi/Makefile
  20. index 920c096..faf8ee2 100644
  21. --- a/efi/Makefile
  22. +++ b/efi/Makefile
  23. @@ -15,7 +15,15 @@ CCLDFLAGS ?= -nostdlib -Wl,--warn-common \
  24. -Wl,-shared -Wl,-Bsymbolic -L$(LIBDIR) -L$(GNUEFIDIR) \
  25. -Wl,--build-id=sha1 -Wl,--hash-style=sysv \
  26. $(GNUEFIDIR)/crt0-efi-$(ARCH).o
  27. -OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^[^0-9]*//g' | cut -f1-2 -d.` \>= 2.24)
  28. +
  29. +define objcopy_version =
  30. + $(OBJCOPY) --version |
  31. + sed -e '/^GNU objcopy/! d;
  32. + : loop1; s/([^)(]*)//g; t loop1;
  33. + : loop2; s/\[[^][]*\]//g; t loop2;
  34. + s/.* \([0-9][0-9]*\.[0-9][0-9]*\).*/\1/;'
  35. +endef
  36. +OBJCOPY_GTE224 := $(shell expr `$(objcopy_version)` \>= 2.24)
  37. FWUP = fwupdate