|
|
8631a2 |
# vim:filetype=spec
|
|
|
8631a2 |
# Modules always contain just 32-bit code
|
|
|
8631a2 |
%global _libdir %{_exec_prefix}/lib
|
|
|
8631a2 |
%global _binaries_in_noarch_packages_terminate_build 0
|
|
|
8631a2 |
#%%undefine _missing_build_ids_terminate_build
|
|
|
8631a2 |
%{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}}
|
|
|
8631a2 |
%{expand:%%{!?_licensedir:%%global license %%%%doc}}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global _configure ../configure
|
|
|
8631a2 |
|
|
|
8631a2 |
%if %{?_with_ccache: 1}%{?!_with_ccache: 0}
|
|
|
8631a2 |
%global cc_equals CC=/usr/%{_lib}/ccache/gcc
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global cc_equals %{nil}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global cflags_sed \\\
|
|
|
8631a2 |
sed \\\
|
|
|
8631a2 |
-e 's/-O. //g' \\\
|
|
|
8631a2 |
-e 's/-fplugin=annobin //g' \\\
|
|
|
8631a2 |
-e 's,-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ,,g' \\\
|
|
|
8631a2 |
-e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\
|
|
|
8631a2 |
-e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\
|
|
|
8631a2 |
-e 's/--param=ssp-buffer-size=4//g' \\\
|
|
|
8631a2 |
-e 's/-mregparm=3/-mregparm=4/g' \\\
|
|
|
8631a2 |
-e 's/-fexceptions//g' \\\
|
|
|
8631a2 |
-e 's/-fasynchronous-unwind-tables//g' \\\
|
|
|
8631a2 |
-e 's/^/ -fno-strict-aliasing /' \\\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
|
|
|
8631a2 |
%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
|
|
|
8631a2 |
%global legacy_host_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{host_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
|
|
|
8631a2 |
%global legacy_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global ldflags_sed \\\
|
|
|
8631a2 |
sed \\\
|
|
|
8631a2 |
-e 's/^$//' \\\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global host_ldflags %{expand:%%(echo %{build_ldflags} %{?_hardening_ldflags} | %{ldflags_sed})}
|
|
|
8631a2 |
%global legacy_host_ldflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{host_ldflags} | \\\
|
|
|
8631a2 |
%{ldflags_sed} \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})}
|
|
|
8631a2 |
%global legacy_target_ldflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_ldflags} | \\\
|
|
|
8631a2 |
%{ldflags_sed} \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global with_efi_arch 0
|
|
|
8631a2 |
%global with_alt_efi_arch 0
|
|
|
8631a2 |
%global with_legacy_arch 0
|
|
|
8631a2 |
%global grubefiarch %{nil}
|
|
|
8631a2 |
%global grublegacyarch %{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
# sparc is always compiled 64 bit
|
|
|
8631a2 |
%ifarch %{sparc}
|
|
|
8631a2 |
%global target_cpu_name sparc64
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global legacy_target_cpu_name %{_arch}
|
|
|
8631a2 |
%global legacy_package_arch ieee1275
|
|
|
8631a2 |
%global platform ieee1275
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
# ppc is always compiled 64 bit
|
|
|
8631a2 |
%ifarch ppc ppc64 ppc64le
|
|
|
8631a2 |
%global target_cpu_name %{_arch}
|
|
|
8631a2 |
%global legacy_target_cpu_name powerpc
|
|
|
8631a2 |
%global legacy_package_arch %{_arch}
|
|
|
8631a2 |
%global legacy_grub_dir powerpc-ieee1275
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global platform ieee1275
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
|
|
|
8631a2 |
%global efi_only aarch64 %{arm}
|
|
|
8631a2 |
%global efi_arch x86_64 ia64 %{efi_only}
|
|
|
8631a2 |
%ifarch %{efi_arch}
|
|
|
8631a2 |
%global with_efi_arch 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_arch 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%ifarch %{efi_only}
|
|
|
8631a2 |
%global with_efi_only 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_only 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%{!?with_efi_arch:%global without_efi_arch 0}
|
|
|
8631a2 |
%{?with_efi_arch:%global without_efi_arch 1}
|
|
|
8631a2 |
%{!?with_efi_only:%global without_efi_only 0}
|
|
|
8631a2 |
%{?with_efi_only:%global without_efi_only 1}
|
|
|
8631a2 |
|
|
|
8631a2 |
### fixme
|
|
|
8631a2 |
%ifarch aarch64 %{arm}
|
|
|
8631a2 |
%global platform_modules " "
|
|
|
8631a2 |
%else
|
|
|
dbe756 |
%global platform_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard "
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch aarch64 %{arm}
|
|
|
8631a2 |
%global legacy_provides -l
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{ix86}
|
|
|
8631a2 |
%global efiarch ia32
|
|
|
8631a2 |
%global target_cpu_name i386
|
|
|
8631a2 |
%global grub_target_name i386-efi
|
|
|
8631a2 |
%global package_arch efi-ia32
|
|
|
8631a2 |
|
|
|
8631a2 |
%global legacy_target_cpu_name i386
|
|
|
8631a2 |
%global legacy_package_arch pc
|
|
|
8631a2 |
%global platform pc
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch x86_64
|
|
|
8631a2 |
%global efiarch x64
|
|
|
8631a2 |
%global target_cpu_name %{_arch}
|
|
|
8631a2 |
%global grub_target_name %{_arch}-efi
|
|
|
8631a2 |
%global package_arch efi-x64
|
|
|
8631a2 |
|
|
|
8631a2 |
%global legacy_target_cpu_name i386
|
|
|
8631a2 |
%global legacy_package_arch pc
|
|
|
8631a2 |
%global platform pc
|
|
|
8631a2 |
|
|
|
8631a2 |
%global alt_efi_arch ia32
|
|
|
8631a2 |
%global alt_target_cpu_name i386
|
|
|
8631a2 |
%global alt_grub_target_name i386-efi
|
|
|
8631a2 |
%global alt_platform efi
|
|
|
8631a2 |
%global alt_package_arch efi-ia32
|
|
|
8631a2 |
|
|
|
8631a2 |
%global alt_efi_host_cflags %{expand:%%(echo %{efi_host_cflags})}
|
|
|
8631a2 |
%global alt_efi_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch aarch64
|
|
|
8631a2 |
%global efiarch aa64
|
|
|
8631a2 |
%global target_cpu_name aarch64
|
|
|
8631a2 |
%global grub_target_name arm64-efi
|
|
|
8631a2 |
%global package_arch efi-aa64
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{arm}
|
|
|
8631a2 |
%global efiarch arm
|
|
|
8631a2 |
%global target_cpu_name arm
|
|
|
8631a2 |
%global grub_target_name arm-efi
|
|
|
8631a2 |
%global package_arch efi-arm
|
|
|
8631a2 |
%global efi_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{optflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-march=armv7-a[[:alnum:]+-]*/&+nofp/g' \\\
|
|
|
8631a2 |
-e 's/-mfpu=[[:alnum:]-]\\+//g' \\\
|
|
|
8631a2 |
-e 's/-mfloat-abi=[[:alpha:]]\\+/-mfloat-abi=soft/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global _alt_target_platform %{alt_target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{efi_arch}
|
|
|
8631a2 |
%global with_efi_arch 1
|
|
|
8631a2 |
%global grubefiname grub%{efiarch}.efi
|
|
|
8631a2 |
%global grubeficdname gcd%{efiarch}.efi
|
|
|
8631a2 |
%global grubefiarch %{target_cpu_name}-efi
|
|
|
8631a2 |
%ifarch %{ix86}
|
|
|
8631a2 |
%global with_efi_modules 0
|
|
|
8631a2 |
%global without_efi_modules 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_modules 1
|
|
|
8631a2 |
%global without_efi_modules 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%if 0%{?alt_efi_arch:1}
|
|
|
8631a2 |
%global with_alt_efi_arch 1
|
|
|
8631a2 |
%global grubaltefiname grub%{alt_efi_arch}.efi
|
|
|
8631a2 |
%global grubalteficdname gcd%{alt_efi_arch}.efi
|
|
|
8631a2 |
%global grubaltefiarch %{alt_target_cpu_name}-efi
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifnarch %{efi_only}
|
|
|
8631a2 |
%global with_legacy_arch 1
|
|
|
8631a2 |
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
|
|
|
8631a2 |
%global moduledir %{legacy_target_cpu_name}-%{platform}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global evr %{epoch}:%{version}-%{release}
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch x86_64
|
|
|
8631a2 |
%global with_efi_common 1
|
|
|
8631a2 |
%global with_legacy_modules 0
|
|
|
8631a2 |
%global with_legacy_common 0
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_common 0
|
|
|
8631a2 |
%global with_legacy_common 1
|
|
|
8631a2 |
%global with_legacy_modules 1
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_legacy_variant() \
|
|
|
8631a2 |
%{expand:%%package %%{1}} \
|
|
|
8631a2 |
Summary: Bootloader with support for Linux, Multiboot, and more \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Provides: %{name} = %{evr} \
|
|
|
8631a2 |
Obsoletes: %{name} < %{evr} \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-%{1}-modules = %{evr} \
|
|
|
8631a2 |
Requires: gettext which file \
|
|
|
8631a2 |
Requires: %{name}-tools-extra = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools = %{evr} \
|
|
|
8631a2 |
Requires(pre): dracut \
|
|
|
8631a2 |
Requires(post): dracut \
|
|
|
8631a2 |
%{expand:%%description %%{1}} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for %%{1} systems. \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%%if 0%%{with_legacy_modules} \
|
|
|
8631a2 |
%%package %%{1}-modules \
|
|
|
8631a2 |
Summary: Modules used to build custom grub images \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
BuildArch: noarch \
|
|
|
8631a2 |
Requires: %%{name}-common = %%{evr} \
|
|
|
8631a2 |
%%description %%{1}-modules \
|
|
|
8631a2 |
%%{desc} \
|
|
|
8631a2 |
This subpackage provides support for rebuilding your own grub.efi. \
|
|
|
8631a2 |
%%endif \
|
|
|
8631a2 |
} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%%package %%{1}-tools} \
|
|
|
8631a2 |
Summary: Support tools for GRUB. \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: gettext os-prober which file system-logos \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
8631a2 |
Requires: os-prober >= 1.58-11 \
|
|
|
8631a2 |
Requires: gettext which file \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%description %%{1}-tools} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides tools for support of %%{1} platforms. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_efi_variant(o) \
|
|
|
8631a2 |
%{expand:%%package %{1}} \
|
|
|
8631a2 |
Summary: GRUB for EFI systems. \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: efi-filesystem \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal >= %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-extra = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi = %{evr} \
|
|
|
8631a2 |
%{?legacy_provides:Provides: %{name} = %{evr}} \
|
|
|
8631a2 |
%{-o:Obsoletes: %{name}-efi < %{evr}} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%description %{1}} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for %{1} systems. \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%if 0%{?with_efi_modules} \
|
|
|
8631a2 |
%{expand:%%package %{1}-modules} \
|
|
|
8631a2 |
Summary: Modules used to build custom grub.efi images \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
BuildArch: noarch \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi-modules = %{evr} \
|
|
|
8631a2 |
Obsoletes: %{name}-efi-modules < %{evr} \
|
|
|
8631a2 |
%{expand:%%description %{1}-modules} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for rebuilding your own grub.efi. \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%package %{1}-cdboot} \
|
|
|
8631a2 |
Summary: Files used to boot removeable media with EFI \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi-cdboot = %{evr} \
|
|
|
8631a2 |
%{expand:%%description %{1}-cdboot} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global do_common_setup() \
|
|
|
8631a2 |
%setup -q -n grub-%{tarversion} \
|
|
|
8631a2 |
rm -fv docs/*.info \
|
|
|
8631a2 |
cp %{SOURCE6} .gitignore \
|
|
|
8631a2 |
cp %{SOURCE8} ./grub-core/tests/strtoull_test.c \
|
|
|
8631a2 |
git init \
|
|
|
8631a2 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \
|
|
|
8631a2 |
echo '!*.[[:digit:]]' > util/.gitignore \
|
|
|
8631a2 |
echo '!config.h' > include/grub/emu/.gitignore \
|
|
|
8631a2 |
git config user.email "%{name}-owner@fedoraproject.org" \
|
|
|
8631a2 |
git config user.name "Fedora Ninjas" \
|
|
|
8631a2 |
git config gc.auto 0 \
|
|
|
8631a2 |
rm -f configure \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -a -q -m "%{tarversion} baseline." \
|
|
|
8631a2 |
git apply --index --whitespace=nowarn %{SOURCE3} \
|
|
|
8631a2 |
git commit -a -q -m "%{tarversion} master." \
|
|
|
8631a2 |
git am --whitespace=nowarn %%{patches}
|
|
|
8631a2 |
autoreconf -vi \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -a -q -m "autoreconf" \
|
|
|
8631a2 |
autoconf \
|
|
|
8631a2 |
PYTHON=python3 ./autogen.sh \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_configure() \
|
|
|
8631a2 |
%configure \\\
|
|
|
8631a2 |
%{cc_equals} \\\
|
|
|
8631a2 |
HOST_CFLAGS="%{3}" \\\
|
|
|
8631a2 |
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
HOST_LDFLAGS="%{efi_host_ldflags}" \\\
|
|
|
8631a2 |
TARGET_CFLAGS="%{2}" \\\
|
|
|
8631a2 |
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
TARGET_LDFLAGS="%{efi_target_ldflags}" \\\
|
|
|
8631a2 |
--with-platform=efi \\\
|
|
|
8631a2 |
--with-utils=host \\\
|
|
|
8631a2 |
--target=%{1} \\\
|
|
|
8631a2 |
--with-grubdir=%{name} \\\
|
|
|
8631a2 |
--program-transform-name=s,grub,%{name}, \\\
|
|
|
8631a2 |
--disable-grub-mount \\\
|
|
|
dbe756 |
--with-debug-timestamps \\\
|
|
|
dbe756 |
--enable-boot-time \\\
|
|
|
8631a2 |
--disable-werror || ( cat config.log ; exit 1 ) \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -m "After efi configure" \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_build_modules() \
|
|
|
8631a2 |
make %{?_smp_mflags} ascii.h widthspec.h \
|
|
|
8631a2 |
make %{?_smp_mflags} -C grub-core \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_build_all() \
|
|
|
8631a2 |
make %{?_smp_mflags} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_link_utils() \
|
|
|
8631a2 |
for x in grub-mkimage ; do \\\
|
|
|
8631a2 |
ln ../grub-%{1}-%{tarversion}/${x} ./ ; \\\
|
|
|
8631a2 |
done \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch x86_64 aarch64 %{arm}
|
|
|
8631a2 |
%define mkimage() \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
|
|
|
8631a2 |
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
|
|
|
8631a2 |
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.one -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.one -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{2}.one -o %%{2} -a %%{8} -c %%{9} -n %%{10}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{3}.one -o %%{3} -a %%{8} -c %%{9} -n %%{10}}} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%define mkimage() \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{2} \\\
|
|
|
8631a2 |
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{3} \\\
|
|
|
8631a2 |
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_build_images() \
|
|
|
8631a2 |
GRUB_MODULES=" all_video boot blscfg btrfs \\\
|
|
|
a7e0e3 |
cat configfile cryptodisk \\\
|
|
|
8631a2 |
echo efi_netfs efifwsetup efinet ext2 \\\
|
|
|
a7e0e3 |
fat font gcry_rijndael gcry_rsa gcry_serpent \\\
|
|
|
c0334e |
gcry_sha256 gcry_twofish gcry_whirlpool \\\
|
|
|
a7e0e3 |
gfxmenu gfxterm gzio \\\
|
|
|
ee2076 |
halt hfsplus http increment iso9660 jpeg \\\
|
|
|
a7e0e3 |
loadenv loopback linux lvm lsefi lsefimmap luks \\\
|
|
|
8631a2 |
mdraid09 mdraid1x minicmd net \\\
|
|
|
8631a2 |
normal part_apple part_msdos part_gpt \\\
|
|
|
8631a2 |
password_pbkdf2 png reboot \\\
|
|
|
eefaf6 |
regexp search search_fs_uuid search_fs_file \\\
|
|
|
8631a2 |
search_label serial sleep syslinuxcfg test tftp \\\
|
|
|
8631a2 |
video xfs" \
|
|
|
8631a2 |
GRUB_MODULES+=%{platform_modules} \
|
|
|
a4d572 |
%{expand:%%{mkimage %{1} %{2} %{3} %{4} %{5} %{6} %{7} %{8} %{9} %{10}}} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_primary_efi_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
|
|
8631a2 |
%do_efi_build_all \
|
|
|
a4d572 |
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./ %{7} %{8} %{9} %{10} %{11} %{12}} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_alt_efi_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
|
|
8631a2 |
%do_efi_build_modules \
|
|
|
8631a2 |
%{expand:%%do_efi_link_utils %{grubefiarch}} \
|
|
|
a4d572 |
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../grub-%{grubefiarch}-%{tarversion}/ %{7} %{8} %{9} %{10} %{11} %{12}} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_legacy_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%configure \\\
|
|
|
8631a2 |
%{cc_equals} \\\
|
|
|
8631a2 |
HOST_CFLAGS="%{legacy_host_cflags}" \\\
|
|
|
8631a2 |
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
HOST_LDFLAGS="%{legacy_host_ldflags}" \\\
|
|
|
8631a2 |
TARGET_CFLAGS="%{legacy_target_cflags}" \\\
|
|
|
8631a2 |
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
TARGET_LDFLAGS="%{legacy_target_ldflags}" \\\
|
|
|
8631a2 |
--with-platform=%{platform} \\\
|
|
|
8631a2 |
--with-utils=host \\\
|
|
|
8631a2 |
--target=%{_target_platform} \\\
|
|
|
8631a2 |
--with-grubdir=%{name} \\\
|
|
|
8631a2 |
--program-transform-name=s,grub,%{name}, \\\
|
|
|
8631a2 |
--disable-grub-mount \\\
|
|
|
dbe756 |
--with-debug-timestamps \\\
|
|
|
dbe756 |
--enable-boot-time \\\
|
|
|
8631a2 |
--disable-werror || ( cat config.log ; exit 1 ) \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -m "After legacy configure" \
|
|
|
8631a2 |
make %{?_smp_mflags} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_alt_efi_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
|
|
|
8631a2 |
find . '(' -iname gdb_grub \\\
|
|
|
8631a2 |
-o -iname kernel.exec \\\
|
|
|
8631a2 |
-o -iname kernel.img \\\
|
|
|
8631a2 |
-o -iname config.h \\\
|
|
|
8631a2 |
-o -iname gmodule.pl \\\
|
|
|
8631a2 |
-o -iname modinfo.sh \\\
|
|
|
8631a2 |
-o -iname '*.lst' \\\
|
|
|
8631a2 |
-o -iname '*.mod' \\\
|
|
|
8631a2 |
')' \\\
|
|
|
8631a2 |
-exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \
|
|
|
8631a2 |
find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \
|
|
|
8631a2 |
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \
|
|
|
8631a2 |
touch $RPM_BUILD_ROOT%{efi_esp_dir}/grub.cfg \
|
|
|
8631a2 |
ln -sf ..%{efi_esp_dir}/grub.cfg \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \
|
|
|
8631a2 |
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
install -D -m 700 unicode.pf2 \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create \
|
|
|
8631a2 |
ln -sf ../efi/EFI/%{efi_vendor}/grubenv \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT/boot/grub2/grubenv \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_legacy_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
ln -s ../boot/%{name}/grub.cfg \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
|
|
|
8631a2 |
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ %{3} -eq 0 ]; then \
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_common_install() \
|
|
|
8631a2 |
install -d -m 0755 \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_infodir}/ \
|
|
|
8631a2 |
cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \
|
|
|
8631a2 |
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
|
|
|
8631a2 |
cp docs/grub-dev.info \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
|
|
|
8631a2 |
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \
|
|
|
8631a2 |
ln -sf ../default/grub \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
|
|
|
8631a2 |
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_legacy_variant_files() \
|
|
|
8631a2 |
%{expand:%%files %{1}} \
|
|
|
8631a2 |
%defattr(-,root,root,-) \
|
|
|
8631a2 |
%config(noreplace) %{_sysconfdir}/%{name}.cfg \
|
|
|
8631a2 |
%ghost %config(noreplace) /boot/%{name}/grub.cfg \
|
|
|
8631a2 |
%dir %attr(0700,root,root)/boot/loader/entries \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%if 0%{?with_legacy_modules} \
|
|
|
8631a2 |
%{expand:%%files %{1}-modules} \
|
|
|
8631a2 |
%defattr(-,root,root) \
|
|
|
8631a2 |
%dir %{_libdir}/grub/%{2}/ \
|
|
|
8631a2 |
%{_libdir}/grub/%{2}/* \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/*.module \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/*.o \
|
|
|
8631a2 |
%else \
|
|
|
8631a2 |
%%exclude %%{_libdir}/grub/%%{grublegacyarch}/* \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_efi_variant_files() \
|
|
|
8631a2 |
%{expand:%%files %{1}} \
|
|
|
8631a2 |
%defattr(0700,root,root,-) \
|
|
|
8631a2 |
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
%dir %attr(0700,root,root)%{efi_esp_dir}/fonts \
|
|
|
8631a2 |
%dir %attr(0700,root,root)/boot/loader/entries \
|
|
|
8631a2 |
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
|
|
|
a7e0e3 |
%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \
|
|
|
8631a2 |
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \
|
|
|
8631a2 |
%{expand:%if 0%{?without_efi_modules} \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6} \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6}/* \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%if 0%{?with_efi_modules} \
|
|
|
8631a2 |
%{expand:%%files %{1}-modules} \
|
|
|
8631a2 |
%defattr(-,root,root,-) \
|
|
|
8631a2 |
%dir %{_libdir}/grub/%{6}/ \
|
|
|
8631a2 |
%{_libdir}/grub/%{6}/* \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6}/*.module \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%files %{1}-cdboot} \
|
|
|
8631a2 |
%defattr(0700,root,root,-) \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/fonts \
|
|
|
8631a2 |
%{nil}
|