nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
8e15ce
# vim:filetype=spec
8e15ce
# Modules always contain just 32-bit code
8e15ce
%global _libdir %{_exec_prefix}/lib
8e15ce
%global _binaries_in_noarch_packages_terminate_build 0
8e15ce
#%%undefine _missing_build_ids_terminate_build
8e15ce
%{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}}
8e15ce
%{expand:%%{!?_licensedir:%%global license %%%%doc}}
8e15ce
8e15ce
%global _configure ../configure
8e15ce
8e15ce
%if %{?_with_ccache: 1}%{?!_with_ccache: 0}
8e15ce
%global cc_equals CC=/usr/%{_lib}/ccache/gcc
8e15ce
%else
8e15ce
%global cc_equals %{nil}
8e15ce
%endif
8e15ce
8e15ce
%global cflags_sed						\\\
8e15ce
	sed							\\\
8e15ce
		-e 's/-O. //g'					\\\
8e15ce
		-e 's/-fplugin=annobin //g'			\\\
8e15ce
		-e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\
8e15ce
		-e 's/-fstack-protector[[:alpha:]-]\\+//g'	\\\
8e15ce
		-e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g'	\\\
8e15ce
		-e 's/--param=ssp-buffer-size=4//g'		\\\
8e15ce
		-e 's/-mregparm=3/-mregparm=4/g'		\\\
8e15ce
		-e 's/-fexceptions//g'				\\\
8e15ce
		-e 's/-fcf-protection//g'			\\\
8e15ce
		-e 's/-fasynchronous-unwind-tables//g'		\\\
8e15ce
		-e 's/^/ -fno-strict-aliasing /'		\\\
8e15ce
		%{nil}
8e15ce
8e15ce
%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
8e15ce
%global legacy_host_cflags					\\\
8e15ce
	%{expand:%%(echo %{host_cflags} |			\\\
8e15ce
	%{cflags_sed}						\\\
8e15ce
		-e 's/-m64//g'					\\\
8e15ce
		-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g'	\\\
8e15ce
	)}
8e15ce
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
8e15ce
8e15ce
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
8e15ce
%global legacy_target_cflags					\\\
8e15ce
	%{expand:%%(echo %{target_cflags} | 			\\\
8e15ce
	%{cflags_sed}						\\\
8e15ce
		-e 's/-m64//g'					\\\
8e15ce
		-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g'	\\\
8e15ce
	)}
8e15ce
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
8e15ce
8e15ce
%global ldflags_sed						\\\
8e15ce
	sed							\\\
8e15ce
		-e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\
8e15ce
		-e 's/^$//'					\\\
8e15ce
		%{nil}
8e15ce
8e15ce
%global host_ldflags %{expand:%%(echo %{build_ldflags} %{?_hardening_ldflags} | %{ldflags_sed})}
8e15ce
%global legacy_host_ldflags					\\\
8e15ce
	%{expand:%%(echo %{host_ldflags} |			\\\
8e15ce
	%{ldflags_sed}						\\\
8e15ce
	)}
8e15ce
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
8e15ce
8e15ce
%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})}
8e15ce
%global legacy_target_ldflags					\\\
8e15ce
	%{expand:%%(echo %{target_ldflags} | 			\\\
8e15ce
	%{ldflags_sed}						\\\
8e15ce
	)}
8e15ce
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
8e15ce
8e15ce
%global with_efi_arch 0
8e15ce
%global with_legacy_arch 0
8e15ce
%global with_emu_arch 1
8e15ce
%global emuarch %{_arch}
8e15ce
%global grubefiarch %{nil}
8e15ce
%global grublegacyarch %{nil}
fa8ac2
%global grubelfname %{nil}
8e15ce
8e15ce
# sparc is always compiled 64 bit
8e15ce
%ifarch %{sparc}
8e15ce
%global target_cpu_name sparc64
8e15ce
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
8e15ce
%global legacy_target_cpu_name %{_arch}
8e15ce
%global legacy_package_arch ieee1275
8e15ce
%global platform ieee1275
8e15ce
%endif
8e15ce
# ppc is always compiled 64 bit
8e15ce
%ifarch ppc ppc64 ppc64le
8e15ce
# GRUB emu fails to build on ppc64le
8e15ce
%global with_emu_arch 0
8e15ce
%global target_cpu_name %{_arch}
8e15ce
%global legacy_target_cpu_name powerpc
8e15ce
%global legacy_package_arch %{_arch}
8e15ce
%global legacy_grub_dir powerpc-ieee1275
8e15ce
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
8e15ce
%global platform ieee1275
8e15ce
%endif
8e15ce
8e15ce
8e15ce
%global efi_only aarch64 %{arm} riscv64
8e15ce
%global efi_arch x86_64 ia64 %{efi_only}
8e15ce
%ifarch %{efi_arch}
8e15ce
%global with_efi_arch 1
8e15ce
%else
8e15ce
%global with_efi_arch 0
8e15ce
%endif
8e15ce
%ifarch %{efi_only}
8e15ce
%global with_efi_only 1
8e15ce
%else
8e15ce
%global with_efi_only 0
8e15ce
%endif
8e15ce
%{!?with_efi_arch:%global without_efi_arch 0}
8e15ce
%{?with_efi_arch:%global without_efi_arch 1}
8e15ce
%{!?with_efi_only:%global without_efi_only 0}
8e15ce
%{?with_efi_only:%global without_efi_only 1}
8e15ce
fa8ac2
%ifarch %{efi_arch}
6fd602
%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi "
fa8ac2
%endif
fa8ac2
fa8ac2
%ifarch x86_64 %{ix86}
fa8ac2
%global platform_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard "
fa8ac2
%endif
fa8ac2
fa8ac2
%ifarch ppc64le
fa8ac2
%global platform_modules " appendedsig "
fa8ac2
%endif
fa8ac2
8e15ce
%ifarch aarch64 %{arm} riscv64
fa8ac2
%global platform_modules " "
8e15ce
%endif
8e15ce
8e15ce
%ifarch aarch64 %{arm} riscv64
8e15ce
%global legacy_provides -l
8e15ce
%endif
8e15ce
8e15ce
%ifarch %{ix86}
8e15ce
%global efiarch ia32
8e15ce
%global target_cpu_name i386
8e15ce
%global grub_target_name i386-efi
8e15ce
%global package_arch efi-ia32
8e15ce
8e15ce
%global legacy_target_cpu_name i386
8e15ce
%global legacy_package_arch pc
8e15ce
%global platform pc
8e15ce
%endif
8e15ce
8e15ce
%ifarch x86_64
8e15ce
%global efiarch x64
8e15ce
%global target_cpu_name %{_arch}
8e15ce
%global grub_target_name %{_arch}-efi
8e15ce
%global package_arch efi-x64
8e15ce
8e15ce
%global legacy_target_cpu_name i386
8e15ce
%global legacy_package_arch pc
8e15ce
%global platform pc
8e15ce
%endif
8e15ce
8e15ce
%ifarch aarch64
8e15ce
%global emuarch arm64
8e15ce
%global efiarch aa64
8e15ce
%global target_cpu_name aarch64
8e15ce
%global grub_target_name arm64-efi
8e15ce
%global package_arch efi-aa64
8e15ce
%endif
8e15ce
8e15ce
%ifarch riscv64
8e15ce
%global emuarch riscv64
8e15ce
%global efiarch riscv64
8e15ce
%global target_cpu_name riscv64
8e15ce
%global grub_target_name riscv64-efi
8e15ce
%global package_arch efi-riscv64
8e15ce
%endif
8e15ce
8e15ce
%ifarch %{arm}
8e15ce
%global efiarch arm
8e15ce
%global target_cpu_name arm
8e15ce
%global grub_target_name arm-efi
8e15ce
%global package_arch efi-arm
8e15ce
%global efi_target_cflags						\\\
8e15ce
	%{expand:%%(echo %{optflags} |					\\\
8e15ce
	%{cflags_sed}							\\\
8e15ce
		-e 's/-march=armv7-a[[:alnum:]+-]*/&+nofp/g'		\\\
8e15ce
		-e 's/-mfpu=[[:alnum:]-]\\+//g'				\\\
8e15ce
		-e 's/-mfloat-abi=[[:alpha:]]\\+/-mfloat-abi=soft/g'	\\\
8e15ce
	)}
8e15ce
%endif
8e15ce
8e15ce
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
8e15ce
8e15ce
%ifarch %{efi_arch}
8e15ce
%global with_efi_arch 1
8e15ce
%global grubefiname grub%{efiarch}.efi
8e15ce
%global grubeficdname gcd%{efiarch}.efi
8e15ce
%global grubefiarch %{target_cpu_name}-efi
8e15ce
%ifarch %{ix86}
8e15ce
%global with_efi_modules 0
8e15ce
%global without_efi_modules 1
8e15ce
%else
8e15ce
%global with_efi_modules 1
8e15ce
%global without_efi_modules 0
8e15ce
%endif
8e15ce
%endif
8e15ce
8e15ce
%ifnarch %{efi_only}
8e15ce
%global with_legacy_arch 1
8e15ce
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
8e15ce
%global moduledir %{legacy_target_cpu_name}-%{platform}
fa8ac2
%global grubelfname core.elf
8e15ce
%endif
8e15ce
8e15ce
%global evr %{epoch}:%{version}-%{release}
8e15ce
8e15ce
%ifarch x86_64
8e15ce
%global with_efi_common 1
8e15ce
%global with_legacy_modules 0
8e15ce
%global with_legacy_common 0
8e15ce
%else
8e15ce
%global with_efi_common 0
8e15ce
%global with_legacy_common 1
8e15ce
%global with_legacy_modules 1
8e15ce
%endif
8e15ce
8e15ce
%define define_legacy_variant()						\
8e15ce
%{expand:%%package %%{1}}						\
8e15ce
Summary:	Bootloader with support for Linux, Multiboot, and more	\
8e15ce
Provides:	%{name} = %{evr}					\
8e15ce
Obsoletes:	%{name} < %{evr}					\
8e15ce
Requires:	%{name}-common = %{evr}					\
8e15ce
Requires:	%{name}-tools-minimal = %{evr}				\
8e15ce
Requires:	%{name}-%{1}-modules = %{evr}				\
8e15ce
Requires:	gettext which file					\
8e15ce
Requires:	%{name}-tools = %{evr}					\
8e15ce
Requires(pre):	dracut							\
8e15ce
Requires(post): dracut							\
8e15ce
%{expand:%%description %%{1}}						\
8e15ce
%{desc}									\
8e15ce
This subpackage provides support for %{1} systems.			\
8e15ce
									\
8e15ce
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
8e15ce
%{expand:%%if 0%%{with_legacy_modules}					\
8e15ce
%%package %%{1}-modules							\
8e15ce
Summary:	Modules used to build custom grub images		\
8e15ce
BuildArch:	noarch							\
8e15ce
Requires:	%%{name}-common = %%{evr}				\
8e15ce
%%description %%{1}-modules						\
8e15ce
%%{desc}								\
8e15ce
This subpackage provides support for rebuilding your own grub.efi.	\
8e15ce
%%endif									\
8e15ce
}									\
8e15ce
									\
8e15ce
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
8e15ce
%{expand:%%package %%{1}-tools}						\
8e15ce
Summary:	Support tools for GRUB.					\
8e15ce
Requires:	gettext os-prober which file system-logos		\
8e15ce
Requires:	%{name}-common = %{evr}					\
8e15ce
Requires:	%{name}-tools-minimal = %{evr}				\
8e15ce
Requires:	os-prober >= 1.58-11					\
8e15ce
Requires:	gettext which file					\
8e15ce
									\
8e15ce
%{expand:%%description %%{1}-tools}					\
8e15ce
%{desc}									\
8e15ce
This subpackage provides tools for support of %%{1} platforms.		\
8e15ce
%{nil}
8e15ce
8e15ce
%define define_efi_variant(o)						\
8e15ce
%{expand:%%package %{1}}						\
8e15ce
Summary:	GRUB for EFI systems.					\
8e15ce
Requires:	efi-filesystem						\
8e15ce
Requires:	%{name}-common = %{evr}					\
8e15ce
Requires:	%{name}-tools-minimal >= %{evr}				\
8e15ce
Requires:	%{name}-tools = %{evr}					\
8e15ce
Provides:	%{name}-efi = %{evr}					\
8e15ce
%{?legacy_provides:Provides:	%{name} = %{evr}}			\
8e15ce
%{-o:Obsoletes:	%{name}-efi < %{evr}}					\
8e15ce
									\
8e15ce
%{expand:%%description %{1}}						\
8e15ce
%{desc}									\
8e15ce
This subpackage provides support for %{1} systems.			\
8e15ce
									\
8e15ce
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
8e15ce
%{expand:%if 0%{?with_efi_modules}					\
8e15ce
%{expand:%%package %{1}-modules}					\
8e15ce
Summary:	Modules used to build custom grub.efi images		\
8e15ce
BuildArch:	noarch							\
8e15ce
Requires:	%{name}-common = %{evr}					\
8e15ce
Provides:	%{name}-efi-modules = %{evr}				\
8e15ce
Obsoletes:	%{name}-efi-modules < %{evr}				\
8e15ce
%{expand:%%description %{1}-modules}					\
8e15ce
%{desc}									\
8e15ce
This subpackage provides support for rebuilding your own grub.efi.	\
8e15ce
%endif}									\
8e15ce
									\
8e15ce
%{expand:%%package %{1}-cdboot}						\
8e15ce
Summary:	Files used to boot removeable media with EFI		\
8e15ce
Requires:	%{name}-common = %{evr}					\
8e15ce
Provides:	%{name}-efi-cdboot = %{evr}				\
8e15ce
%{expand:%%description %{1}-cdboot}					\
8e15ce
%{desc}									\
8e15ce
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
8e15ce
%{nil}
8e15ce
8e15ce
%global do_common_setup()					\
8e15ce
%setup -q -n grub-%{tarversion}					\
8e15ce
rm -fv docs/*.info						\
8e15ce
cp %{SOURCE6} .gitignore					\
8e15ce
cp %{SOURCE7} bootstrap						\
8e15ce
cp %{SOURCE8} bootstrap.conf					\
8e15ce
cp %{SOURCE9} ./grub-core/tests/strtoull_test.c			\
8e15ce
cp %{SOURCE2} gnulib-%{gnulibversion}.tar.gz			\
8e15ce
tar -zxf gnulib-%{gnulibversion}.tar.gz				\
8e15ce
mv gnulib-%{gnulibversion} gnulib				\
8e15ce
git init							\
8e15ce
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore	\
8e15ce
echo '!*.[[:digit:]]' > util/.gitignore				\
8e15ce
echo '!config.h' > include/grub/emu/.gitignore			\
8e15ce
git config user.email "%{name}-owner@fedoraproject.org"		\
8e15ce
git config user.name "Fedora Ninjas"				\
8e15ce
git config gc.auto 0						\
8e15ce
rm -f configure							\
8e15ce
git add .							\
8e15ce
git commit -a -q -m "%{tarversion} baseline."			\
8e15ce
#git apply --index --whitespace=nowarn %{SOURCE3}		\
8e15ce
#git commit -a -q -m "%{tarversion} master."			\
8e15ce
git am --whitespace=nowarn %%{patches} 
8e15ce
./bootstrap							\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_efi_configure()					\
8e15ce
%configure							\\\
8e15ce
	%{cc_equals}						\\\
8e15ce
	HOST_CFLAGS="%{3}"					\\\
8e15ce
	HOST_CPPFLAGS="-I$(pwd)"				\\\
8e15ce
	HOST_LDFLAGS="%{efi_host_ldflags}"			\\\
8e15ce
	TARGET_CFLAGS="%{2}"					\\\
8e15ce
	TARGET_CPPFLAGS="-I$(pwd)"				\\\
8e15ce
	TARGET_LDFLAGS="%{efi_target_ldflags}"			\\\
8e15ce
	--with-platform=efi					\\\
8e15ce
	--with-utils=host					\\\
8e15ce
	--target=%{1}						\\\
8e15ce
	--with-grubdir=%{name}					\\\
8e15ce
	--program-transform-name=s,grub,%{name},		\\\
8e15ce
	--disable-werror || ( cat config.log ; exit 1 )		\
8e15ce
git add .							\
8e15ce
git commit -m "After efi configure"				\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_efi_build_modules()					\
8e15ce
make %{?_smp_mflags} ascii.h widthspec.h			\
8e15ce
make %{?_smp_mflags} -C grub-core				\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_efi_build_all()					\
8e15ce
make %{?_smp_mflags}						\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_efi_link_utils()					\
8e15ce
for x in grub-mkimage ; do					\\\
8e15ce
	ln ../grub-%{1}-%{tarversion}/${x} ./ ;			\\\
8e15ce
done								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_install_protected_file()				\
8e15ce
touch %{1}.conf							\
8e15ce
echo %{1} > %{1}.conf						\
8e15ce
install -d -m 755 ${RPM_BUILD_ROOT}/etc/dnf/protected.d/	\
8e15ce
install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \
8e15ce
rm -f %{1}.conf							\
8e15ce
%{nil}
8e15ce
fa8ac2
%global grub_modules  " all_video boot blscfg btrfs		\\\
fa8ac2
			cat configfile cryptodisk		\\\
fa8ac2
			echo ext2 f2fs fat font			\\\
fa8ac2
			gcry_rijndael gcry_rsa gcry_serpent	\\\
fa8ac2
			gcry_sha256 gcry_twofish gcry_whirlpool	\\\
fa8ac2
			gfxmenu gfxterm gzio			\\\
fa8ac2
			halt hfsplus http increment iso9660	\\\
fa8ac2
			jpeg loadenv loopback linux lvm luks	\\\
fa8ac2
			luks2 mdraid09 mdraid1x minicmd net	\\\
fa8ac2
			normal part_apple part_msdos part_gpt	\\\
fa8ac2
			password_pbkdf2 pgp png reboot regexp	\\\
fa8ac2
			search search_fs_uuid search_fs_file	\\\
fa8ac2
			search_label serial sleep syslinuxcfg	\\\
fa8ac2
			test tftp version video xfs zstd "	\
fa8ac2
8e15ce
%ifarch x86_64 aarch64 %{arm} riscv64
fa8ac2
%define efi_mkimage()						\
8e15ce
%{4}./grub-mkimage -O %{1} -o %{2}.orig				\\\
fa8ac2
	-p /EFI/%{efi_vendor} -d grub-core			\\\
fa8ac2
	--sbat %{4}./sbat.csv					\\\
fa8ac2
	${GRUB_MODULES}						\
8e15ce
%{4}./grub-mkimage -O %{1} -o %{3}.orig				\\\
fa8ac2
	-p /EFI/BOOT -d grub-core				\\\
fa8ac2
	--sbat %{4}./sbat.csv					\\\
fa8ac2
	${GRUB_MODULES}						\
8e15ce
%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \
8e15ce
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
c16371
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}}	\
c16371
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}}	\
8e15ce
%{nil}
8e15ce
%else
fa8ac2
%define efi_mkimage()						\
8e15ce
%{4}./grub-mkimage -O %{1} -o %{2}				\\\
fa8ac2
	-p /EFI/%{efi_vendor} -d grub-core			\\\
fa8ac2
	${GRUB_MODULES}						\
8e15ce
%{4}./grub-mkimage -O %{1} -o %{3}				\\\
fa8ac2
	-p /EFI/BOOT -d grub-core				\\\
fa8ac2
	${GRUB_MODULES}						\
fa8ac2
%{nil}
fa8ac2
%endif
fa8ac2
fa8ac2
%ifarch ppc64le
fa8ac2
%define ieee1275_mkimage()					\
fa8ac2
APPENDED_SIG_SIZE=0						\
fa8ac2
if [ -x /usr/bin/rpm-sign ]; then				\
fa8ac2
	touch empty.unsigned					\
c16371
	rpm-sign --key %{4}					\\\
fa8ac2
		 --lkmsign empty.unsigned			\\\
fa8ac2
		 --output empty.signed				\
fa8ac2
	APPENDED_SIG_SIZE="$(stat -c '%s' empty.signed)"	\
fa8ac2
	rm empty.{un,}signed					\
fa8ac2
fi								\
fa8ac2
# FIXME: using this prefix is fragile, must be done properly	\
fa8ac2
./grub-mkimage -O %{1} -o %{2}.orig				\\\
fa8ac2
	-p '/grub2' -d grub-core				\\\
c16371
	-x %{3}							\\\
fa8ac2
	--appended-signature-size ${APPENDED_SIG_SIZE}		\\\
fa8ac2
	${GRUB_MODULES}						\
fa8ac2
if [ -x /usr/bin/rpm-sign ]; then				\
fa8ac2
	truncate -s -${APPENDED_SIG_SIZE} %{2}.orig		\
c16371
	rpm-sign --key %{4}					\\\
fa8ac2
		 --lkmsign %{2}.orig				\\\
fa8ac2
		 --output %{2}					\
fa8ac2
else								\
fa8ac2
	mv %{2}.orig %{2}					\
fa8ac2
fi								\
8e15ce
%{nil}
8e15ce
%endif
8e15ce
8e15ce
%define do_efi_build_images()					\
fa8ac2
GRUB_MODULES+=%{grub_modules}					\
8e15ce
GRUB_MODULES+=%{efi_modules}					\
fa8ac2
GRUB_MODULES+=%{platform_modules}				\
fa8ac2
%{expand:%%{efi_mkimage %{1} %{2} %{3} %{4} %{5} %{6} %{7} %{8} %{9} %{10}}}	\
fa8ac2
%{nil}
fa8ac2
c16371
%define do_ieee1275_build_images()			\
c16371
GRUB_MODULES+=%{grub_modules}				\
c16371
GRUB_MODULES+=%{platform_modules}			\
c16371
cd grub-%{1}-%{tarversion}				\
c16371
%{expand:%%ieee1275_mkimage %%{1} %%{2} %%{3} %%{4}}	\
c16371
cd ..							\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_primary_efi_build()					\
8e15ce
cd grub-%{1}-%{tarversion}					\
8e15ce
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}}			\
8e15ce
%do_efi_build_all						\
fa8ac2
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./  %{7} %{8} %{9} %{10} %{11} %{12}} \
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_legacy_build()					\
8e15ce
cd grub-%{1}-%{tarversion}					\
8e15ce
%configure							\\\
8e15ce
	%{cc_equals}						\\\
8e15ce
	HOST_CFLAGS="%{legacy_host_cflags}"			\\\
8e15ce
	HOST_CPPFLAGS="-I$(pwd)"				\\\
8e15ce
	HOST_LDFLAGS="%{legacy_host_ldflags}"			\\\
8e15ce
	TARGET_CFLAGS="%{legacy_target_cflags}"			\\\
8e15ce
	TARGET_CPPFLAGS="-I$(pwd)"				\\\
8e15ce
	TARGET_LDFLAGS="%{legacy_target_ldflags}"		\\\
8e15ce
	--with-platform=%{platform}				\\\
8e15ce
	--with-utils=host					\\\
8e15ce
	--target=%{_target_platform}				\\\
8e15ce
	--with-grubdir=%{name}					\\\
8e15ce
	--program-transform-name=s,grub,%{name},		\\\
8e15ce
	--disable-werror || ( cat config.log ; exit 1 )		\
8e15ce
git add .							\
8e15ce
git commit -m "After legacy configure"				\
8e15ce
make %{?_smp_mflags}						\
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_emu_build()						\
8e15ce
cd grub-emu-%{tarversion}					\
8e15ce
%configure							\\\
8e15ce
	%{cc_equals}						\\\
8e15ce
	HOST_CFLAGS="%{legacy_host_cflags}"			\\\
8e15ce
	HOST_CPPFLAGS="-I$(pwd)"				\\\
8e15ce
	HOST_LDFLAGS="%{legacy_host_ldflags}"			\\\
8e15ce
	--with-platform=emu					\\\
8e15ce
	--with-grubdir=%{name}					\\\
8e15ce
	--program-transform-name=s,grub,%{name},		\\\
8e15ce
	--disable-werror || ( cat config.log ; exit 1 )		\
8e15ce
git add .							\
8e15ce
git commit -m "After emu configure"				\
8e15ce
make %{?_smp_mflags} ascii.h widthspec.h			\
8e15ce
make %{?_smp_mflags} -C grub-core/lib/gnulib			\
8e15ce
make %{?_smp_mflags} -C grub-core				\
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_efi_install()					\
8e15ce
cd grub-%{1}-%{tarversion}					\
8e15ce
make DESTDIR=$RPM_BUILD_ROOT install				\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
8e15ce
fi								\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
8e15ce
fi								\
8e15ce
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;'	\
8e15ce
ln -s ../boot/%{name}/grub.cfg					\\\
8e15ce
	$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg		\
8e15ce
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2}		\
8e15ce
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3}		\
8e15ce
%ifarch %{arm}							\
8e15ce
install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \
8e15ce
%endif								\
8e15ce
install -D -m 700 unicode.pf2					\\\
8e15ce
	${RPM_BUILD_ROOT}/boot/%{name}/fonts/unicode.pf2		\
8e15ce
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv			\\\
8e15ce
		${RPM_BUILD_ROOT}/boot/%{name}/grubenv create	\
8e15ce
%{expand:%%do_install_protected_file %{name}-%{package_arch}}	\
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_legacy_install()					\
8e15ce
cd grub-%{1}-%{tarversion}					\
8e15ce
make DESTDIR=$RPM_BUILD_ROOT install				\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
8e15ce
fi								\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
8e15ce
fi								\
fa8ac2
%{expand:%ifarch ppc64le					\
fa8ac2
	install -m 700 %{grubelfname} $RPM_BUILD_ROOT/%{_libdir}/grub/%{1} \
fa8ac2
%endif}								\
8e15ce
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
8e15ce
	mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp	\\\
8e15ce
	   $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp	\
8e15ce
fi								\
c16371
if [ %{2} -eq 0 ]; then						\
8e15ce
	${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv		\\\
8e15ce
		${RPM_BUILD_ROOT}/boot/%{name}/grubenv create	\
8e15ce
fi								\
8e15ce
%{expand:%%do_install_protected_file %{name}-%{legacy_package_arch}} \
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_emu_install()					\
8e15ce
cd grub-emu-%{tarversion}					\
8e15ce
make DESTDIR=$RPM_BUILD_ROOT install -C grub-core		\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
8e15ce
fi								\
8e15ce
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
8e15ce
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
8e15ce
fi								\
8e15ce
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
8e15ce
	mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp	\\\
8e15ce
	   $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp	\
8e15ce
fi								\
8e15ce
cd ..								\
8e15ce
%{nil}
8e15ce
8e15ce
%define do_common_install()					\
8e15ce
install -d -m 0755 						\\\
8e15ce
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot		\\\
8e15ce
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en		\\\
8e15ce
	$RPM_BUILD_ROOT%{_infodir}/				\
8e15ce
cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot		\\\
8e15ce
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en		\
8e15ce
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info	\
8e15ce
cp docs/grub-dev.info						\\\
8e15ce
	$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info		\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/		\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/		\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries	\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system	\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default	\
8e15ce
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig	\
8e15ce
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub		\
8e15ce
ln -sf ../default/grub						\\\
8e15ce
	${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub		\
8e15ce
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg			\
8e15ce
ln -s ../boot/%{name}/grub.cfg					\\\
8e15ce
	${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg		\
8e15ce
%{nil}
8e15ce
8e15ce
%define define_legacy_variant_files()				\
8e15ce
%{expand:%%files %{1}}						\
8e15ce
%defattr(-,root,root,-)						\
8e15ce
%config(noreplace) %{_sysconfdir}/%{name}.cfg			\
8e15ce
%ghost %config(noreplace) /boot/%{name}/grub.cfg		\
8e15ce
%dir %attr(0700,root,root)/boot/loader/entries			\
8e15ce
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
fa8ac2
%ifarch ppc64le						\
fa8ac2
%dir %{_libdir}/grub/%{2}/					\
fa8ac2
%{_libdir}/grub/%{2}/%{grubelfname}				\
fa8ac2
%endif								\
8e15ce
								\
8e15ce
%{expand:%if 0%{?with_legacy_modules}				\
8e15ce
%{expand:%%files %{1}-modules}					\
8e15ce
%defattr(-,root,root)						\
8e15ce
%dir %{_libdir}/grub/%{2}/					\
8e15ce
%{_libdir}/grub/%{2}/*						\
fa8ac2
%ifarch ppc64le						\
fa8ac2
%exclude %{_libdir}/grub/%{2}/%{grubelfname}			\
fa8ac2
%endif								\
8e15ce
%exclude %{_libdir}/grub/%{2}/*.module				\
8e15ce
%exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \
8e15ce
%exclude %{_libdir}/grub/%{2}/*.o				\
8e15ce
%else								\
8e15ce
%%exclude %%{_libdir}/grub/%%{grublegacyarch}/*			\
8e15ce
%endif}								\
8e15ce
%{nil}
8e15ce
8e15ce
%define define_efi_variant_files()				\
8e15ce
%{expand:%%files %{1}}						\
8e15ce
%defattr(-,root,root,-)						\
8e15ce
%config(noreplace) %{_sysconfdir}/%{name}.cfg			\
8e15ce
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg		\
8e15ce
%attr(0700,root,root)%{efi_esp_dir}/%{2}			\
8e15ce
%ifarch %{arm}							\
8e15ce
%attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI		\
8e15ce
%endif								\
8e15ce
%attr(0700,root,root)/boot/%{name}/fonts			\
8e15ce
%dir %attr(0700,root,root)/boot/loader/entries			\
8e15ce
%ghost %config(noreplace) /boot/%{name}/grub.cfg		\
8e15ce
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg	\
8e15ce
%config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv	\
8e15ce
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
8e15ce
%{expand:%if 0%{?without_efi_modules}				\
8e15ce
%exclude %{_libdir}/grub/%{6}					\
8e15ce
%exclude %{_libdir}/grub/%{6}/*					\
8e15ce
%endif}								\
8e15ce
								\
8e15ce
%{expand:%if 0%{?with_efi_modules}				\
8e15ce
%{expand:%%files %{1}-modules}					\
8e15ce
%defattr(-,root,root,-)						\
8e15ce
%dir %{_libdir}/grub/%{6}/					\
8e15ce
%{_libdir}/grub/%{6}/*						\
8e15ce
%exclude %{_libdir}/grub/%{6}/*.module				\
8e15ce
%endif}								\
8e15ce
								\
8e15ce
%{expand:%%files %{1}-cdboot}					\
8e15ce
%defattr(-,root,root,-)						\
8e15ce
%attr(0700,root,root)%{efi_esp_dir}/%{3}			\
8e15ce
%attr(0700,root,root)/boot/%{name}/fonts			\
8e15ce
%{nil}