|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
# EFI specific SRPM macro definitions
|
|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
# Copyright 2018 Peter M Jones <pjones@redhat.com>
|
|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
9326b0 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
9326b0 |
# the Free Software Foundation, either version 3 of the License, or (at
|
|
Packit |
9326b0 |
# your option) any later version.
|
|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
# This program is distributed in the hope that it will be useful, but
|
|
Packit |
9326b0 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
9326b0 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
9326b0 |
# General Public License for more details.
|
|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
9326b0 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
9326b0 |
#
|
|
Packit |
9326b0 |
|
|
Packit |
9326b0 |
%_efi_srpm_macros_setup() %{expand:%{lua:
|
|
Packit |
9326b0 |
-- test if our arch matches
|
|
Packit |
9326b0 |
local function arch(archmacro)
|
|
Packit |
9326b0 |
local target = rpm.expand(" %{_target_cpu} ")
|
|
Packit |
9326b0 |
local arches = rpm.expand(" " .. archmacro .. " ")
|
|
Packit |
9326b0 |
local match = string.match(arches, target)
|
|
Packit |
9326b0 |
return (match ~= nil)
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
-- give us the arch...
|
|
Packit |
9326b0 |
local function getarch()
|
|
Packit |
9326b0 |
if arch("ia64") then
|
|
Packit |
9326b0 |
return("ia64")
|
|
Packit |
9326b0 |
elseif arch("x86_64") then
|
|
Packit |
9326b0 |
return("x64")
|
|
Packit |
9326b0 |
elseif arch("%{ix86}") then
|
|
Packit |
9326b0 |
return("ia32")
|
|
Packit |
9326b0 |
elseif arch("aarch64") then
|
|
Packit |
9326b0 |
return("aa64")
|
|
Packit |
9326b0 |
elseif arch("%{arm}") then
|
|
Packit |
9326b0 |
return("arm")
|
|
Packit |
9326b0 |
else
|
|
rpm-build |
7df8d1 |
return("none")
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
-- alt arch
|
|
Packit |
9326b0 |
local function getaltarch()
|
|
Packit |
9326b0 |
if arch("x86_64") then
|
|
Packit |
9326b0 |
return("ia32")
|
|
Packit |
9326b0 |
else
|
|
rpm-build |
7df8d1 |
return("none")
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
-- make some macros
|
|
Packit |
9326b0 |
local done = rpm.expand("%{?_efi}")
|
|
Packit |
9326b0 |
if done == nil or done == "" then
|
|
rpm-build |
7df8d1 |
local arch = getarch()
|
|
Packit |
9326b0 |
local alt = getaltarch()
|
|
Packit |
9326b0 |
print("%global _efi @@EFI_ARCHES@@\\n")
|
|
Packit |
9326b0 |
print("%global _efi_vendor @@EFI_VENDOR@@\\n")
|
|
rpm-build |
7df8d1 |
if arch == "none" then
|
|
rpm-build |
7df8d1 |
print("%global _efi_has_arch 0\\n")
|
|
rpm-build |
7df8d1 |
else
|
|
rpm-build |
7df8d1 |
print("%global _efi_has_arch 1\\n")
|
|
rpm-build |
7df8d1 |
end
|
|
Packit |
9326b0 |
print("%global _efi_arch " .. getarch() .. "\\n")
|
|
Packit |
9326b0 |
print("%global _efi_arch_upper " .. string.upper(getarch()) .. "\\n")
|
|
rpm-build |
7df8d1 |
if alt == "none" then
|
|
Packit |
9326b0 |
print("%global _efi_has_alt_arch 0\\n")
|
|
Packit |
9326b0 |
else
|
|
Packit |
9326b0 |
print("%global _efi_has_alt_arch 1\\n")
|
|
Packit |
9326b0 |
end
|
|
rpm-build |
7df8d1 |
print("%global _efi_alt_arch " .. alt .. "\\n")
|
|
rpm-build |
7df8d1 |
print("%global _efi_alt_arch_upper " .. string.upper(alt) .. "\\n")
|
|
Packit |
9326b0 |
end
|
|
Packit |
9326b0 |
}}
|
|
Packit |
9326b0 |
|
|
Packit |
9326b0 |
%efi_srpm_macros_version %{expand:%{_efi_srpm_macros_setup}}@@EFI_RPM_MACROS_VERSION@@
|
|
Packit |
9326b0 |
|
|
Packit |
9326b0 |
%efi %{expand:%{_efi_srpm_macros_setup}}%{expand:%{_efi}}
|
|
Packit |
9326b0 |
%efi_vendor %{expand:%{_efi_srpm_macros_setup}}%{expand:%{_efi_vendor}}
|
|
Packit |
9326b0 |
|
|
Packit |
9326b0 |
%efi_esp_root @@EFI_ESP_ROOT@@
|
|
Packit |
9326b0 |
%efi_esp_efi %{efi_esp_root}/EFI
|
|
Packit |
9326b0 |
%efi_esp_boot %{efi_esp_efi}/BOOT
|
|
Packit |
9326b0 |
%efi_esp_dir %{expand:%{_efi_srpm_macros_setup}}%{efi_esp_efi}/%{efi_vendor}
|
|
Packit |
9326b0 |
|
|
Packit |
9326b0 |
%efi_arch %{expand:%{_efi_srpm_macros_setup}}%{_efi_arch}
|
|
Packit |
9326b0 |
%efi_arch_upper %{expand:%{_efi_srpm_macros_setup}}%{_efi_arch_upper}
|
|
rpm-build |
7df8d1 |
%efi_has_arch %{expand:%{_efi_srpm_macros_setup}}0%{_efi_has_arch}
|
|
Packit |
9326b0 |
%efi_has_alt_arch %{expand:%{_efi_srpm_macros_setup}}0%{_efi_has_alt_arch}
|
|
Packit |
9326b0 |
%efi_alt_arch %{expand:%{_efi_srpm_macros_setup}}%{?_efi_alt_arch}%{nil}
|
|
Packit |
9326b0 |
%efi_alt_arch_upper %{expand:%{_efi_srpm_macros_setup}}%{?_efi_alt_arch_upper}%{nil}
|