From d50b6eb13b00579e89747baa6a6be142930f3f94 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 1 May 2018 13:39:47 -0400 Subject: [PATCH 4/5] Add %efi_alt_arch and %efi_alt_arch_upper Signed-off-by: Peter Jones --- README | 18 ++++++++++-------- macros.efi.in | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/README b/README index 23601c763b0..c3474a1d863 100644 --- a/README +++ b/README @@ -8,11 +8,13 @@ EFI_VENDOR the vendor name for your EFI System Partition directory The following rpm macros are set: -%efi the arches that EFI packages should be built on, suitable for use with %ifarch -%efi_vendor the vendor name for your EFI System Partition directory -%efi_esp_root the directory where the EFI system Partition is mounted -%efi_esp_efi the full path to \EFI on the EFI System Partition -%efi_esp_boot the full path to \EFI\BOOT on the EFI System Partition -%efi_esp_dir the full path to your vendor directory on the EFI System Partition -%efi_arch the EFI architecture name, e.g. x64 -%efi_arch_upper the EFI architecture name in upper case, e.g. X64 +%efi the arches that EFI packages should be built on, suitable for use with %ifarch +%efi_vendor the vendor name for your EFI System Partition directory +%efi_esp_root the directory where the EFI system Partition is mounted +%efi_esp_efi the full path to \EFI on the EFI System Partition +%efi_esp_boot the full path to \EFI\BOOT on the EFI System Partition +%efi_esp_dir the full path to your vendor directory on the EFI System Partition +%efi_arch the EFI architecture name, e.g. x64 +%efi_arch_upper the EFI architecture name in upper case, e.g. X64 +%efi_alt_arch the EFI architecture name for other arches that build on this one (i.e. ia32 on x64) +%efi_alt_arch_upper the upper case version of %efi_alt_arch diff --git a/macros.efi.in b/macros.efi.in index d935fd23da1..e03b9011e9d 100644 --- a/macros.efi.in +++ b/macros.efi.in @@ -56,3 +56,26 @@ end local arch = rpm.expand("%{efi_arch}") print(string.upper(arch)) } + +%efi_alt_arch %{lua: +-- test if our arch matches +local function ifarch(archmacro) + local target = rpm.expand(" %{_target_cpu} ") + local arches = rpm.expand(" " .. archmacro .. " ") + local match = string.match(arches, target) + if not (match == nil) then + return true + end +end +-- Do the work +if ifarch("x86_64") then + print("ia32") +else + print("") +end +} + +%efi_alt_arch_upper %{lua: + local arch = rpm.expand("%{efi_alt_arch}") + print(string.upper(arch)) +} -- 2.14.3