b50565e
# vim:filetype=spec
b50565e
# Modules always contain just 32-bit code
b50565e
%global _libdir %{_exec_prefix}/lib
b50565e
%global _binaries_in_noarch_packages_terminate_build 0
b50565e
#%%undefine _missing_build_ids_terminate_build
b50565e
%{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}}
b50565e
%{expand:%%{!?_licensedir:%%global license %%%%doc}}
b50565e
3619a3f
%global _configure ../configure
31ca145
b50565e
%if %{?_with_ccache: 1}%{?!_with_ccache: 0}
b50565e
%global cc_equals CC=/usr/%{_lib}/ccache/gcc
b50565e
%else
b50565e
%global cc_equals %{nil}
b50565e
%endif
b50565e
dcee992
%global cflags_sed						\\\
b50565e
	sed							\\\
b50565e
		-e 's/-O. //g'					\\\
28076bb
		-e 's/-fplugin=annobin //g'			\\\
28076bb
		-e 's,-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ,,g' \\\
b50565e
		-e 's/-fstack-protector[[:alpha:]-]\\+//g'	\\\
b50565e
		-e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g'	\\\
b50565e
		-e 's/--param=ssp-buffer-size=4//g'		\\\
b50565e
		-e 's/-mregparm=3/-mregparm=4/g'		\\\
b50565e
		-e 's/-fexceptions//g'				\\\
3a8f1e2
		-e 's/-fcf-protection//g'			\\\
b50565e
		-e 's/-fasynchronous-unwind-tables//g'		\\\
dcee992
		-e 's/^/ -fno-strict-aliasing /'		\\\
dcee992
		%{nil}
dcee992
7388f24
%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
7388f24
%global legacy_host_cflags					\\\
7388f24
	%{expand:%%(echo %{host_cflags} |			\\\
8d56311
	%{cflags_sed}						\\\
8d56311
		-e 's/-m64//g'					\\\
8d56311
		-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g'	\\\
8d56311
	)}
7388f24
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
7388f24
7388f24
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
7388f24
%global legacy_target_cflags					\\\
7388f24
	%{expand:%%(echo %{target_cflags} | 			\\\
dcee992
	%{cflags_sed}						\\\
b50565e
		-e 's/-m64//g'					\\\
b50565e
		-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g'	\\\
dcee992
	)}
8d56311
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
8d56311
7388f24
%global ldflags_sed						\\\
7388f24
	sed							\\\
7388f24
		-e 's/^$//'					\\\
7388f24
		%{nil}
7388f24
7388f24
%global host_ldflags %{expand:%%(echo %{build_ldflags} %{?_hardening_ldflags} | %{ldflags_sed})}
7388f24
%global legacy_host_ldflags					\\\
7388f24
	%{expand:%%(echo %{host_ldflags} |			\\\
7388f24
	%{ldflags_sed}						\\\
7388f24
	)}
7388f24
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
7388f24
7388f24
%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})}
7388f24
%global legacy_target_ldflags					\\\
7388f24
	%{expand:%%(echo %{target_ldflags} | 			\\\
7388f24
	%{ldflags_sed}						\\\
7388f24
	)}
7388f24
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
7388f24
b50565e
%global with_efi_arch 0
b50565e
%global with_alt_efi_arch 0
b50565e
%global with_legacy_arch 0
a18e8e6
%global with_emu_arch 1
a18e8e6
%global emuarch %{_arch}
b50565e
%global grubefiarch %{nil}
b50565e
%global grublegacyarch %{nil}
b50565e
b50565e
# sparc is always compiled 64 bit
b50565e
%ifarch %{sparc}
b50565e
%global target_cpu_name sparc64
b50565e
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
b50565e
%global legacy_target_cpu_name %{_arch}
b50565e
%global legacy_package_arch ieee1275
b50565e
%global platform ieee1275
b50565e
%endif
b50565e
# ppc is always compiled 64 bit
b50565e
%ifarch ppc ppc64 ppc64le
a18e8e6
# GRUB emu fails to build on ppc64le
a18e8e6
%global with_emu_arch 0
b50565e
%global target_cpu_name %{_arch}
b50565e
%global legacy_target_cpu_name powerpc
b50565e
%global legacy_package_arch %{_arch}
b50565e
%global legacy_grub_dir powerpc-ieee1275
b50565e
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
b50565e
%global platform ieee1275
b50565e
%endif
b50565e
53a4172
David Abdurachmanov b888fb3
%global efi_only aarch64 %{arm} riscv64
11b49b8
%global efi_arch x86_64 ia64 %{efi_only}
b50565e
%ifarch %{efi_arch}
b50565e
%global with_efi_arch 1
b50565e
%else
b50565e
%global with_efi_arch 0
b50565e
%endif
b50565e
%ifarch %{efi_only}
b50565e
%global with_efi_only 1
b50565e
%else
b50565e
%global with_efi_only 0
b50565e
%endif
b50565e
%{!?with_efi_arch:%global without_efi_arch 0}
b50565e
%{?with_efi_arch:%global without_efi_arch 1}
b50565e
%{!?with_efi_only:%global without_efi_only 0}
b50565e
%{?with_efi_only:%global without_efi_only 1}
b50565e
b50565e
### fixme
David Abdurachmanov b888fb3
%ifarch aarch64 %{arm} riscv64
a52365a
%global efi_modules " "
b50565e
%else
c321e64
%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard "
b50565e
%endif
b50565e
David Abdurachmanov b888fb3
%ifarch aarch64 %{arm} riscv64
e1f4c0e
%global legacy_provides -l
e1f4c0e
%endif
e1f4c0e
a91fed7
%ifarch %{ix86}
a91fed7
%global efiarch ia32
a91fed7
%global target_cpu_name i386
a91fed7
%global grub_target_name i386-efi
a91fed7
%global package_arch efi-ia32
a91fed7
a91fed7
%global legacy_target_cpu_name i386
a91fed7
%global legacy_package_arch pc
a91fed7
%global platform pc
a91fed7
%endif
a91fed7
b50565e
%ifarch x86_64
b50565e
%global efiarch x64
b50565e
%global target_cpu_name %{_arch}
b50565e
%global grub_target_name %{_arch}-efi
b50565e
%global package_arch efi-x64
b50565e
b50565e
%global legacy_target_cpu_name i386
b50565e
%global legacy_package_arch pc
b50565e
%global platform pc
b50565e
b50565e
%global alt_efi_arch ia32
b50565e
%global alt_target_cpu_name i386
b50565e
%global alt_grub_target_name i386-efi
b50565e
%global alt_platform efi
b50565e
%global alt_package_arch efi-ia32
8d56311
8d56311
%global alt_efi_host_cflags %{expand:%%(echo %{efi_host_cflags})}
8d56311
%global alt_efi_target_cflags					\\\
8d56311
	%{expand:%%(echo %{target_cflags} |			\\\
dcee992
	%{cflags_sed}						\\\
dcee992
		-e 's/-m64//g'					\\\
dcee992
	)}
b50565e
%endif
b50565e
b50565e
%ifarch aarch64
a18e8e6
%global emuarch arm64
b50565e
%global efiarch aa64
b50565e
%global target_cpu_name aarch64
b50565e
%global grub_target_name arm64-efi
b50565e
%global package_arch efi-aa64
b50565e
%endif
b50565e
David Abdurachmanov b888fb3
%ifarch riscv64
David Abdurachmanov b888fb3
%global emuarch riscv64
David Abdurachmanov b888fb3
%global efiarch riscv64
David Abdurachmanov b888fb3
%global target_cpu_name riscv64
David Abdurachmanov b888fb3
%global grub_target_name riscv64-efi
David Abdurachmanov b888fb3
%global package_arch efi-riscv64
David Abdurachmanov b888fb3
%endif
David Abdurachmanov b888fb3
b50565e
%ifarch %{arm}
b50565e
%global efiarch arm
b50565e
%global target_cpu_name arm
b50565e
%global grub_target_name arm-efi
b50565e
%global package_arch efi-arm
8d56311
%global efi_target_cflags						\\\
8d56311
	%{expand:%%(echo %{optflags} |					\\\
8d56311
	%{cflags_sed}							\\\
8d56311
		-e 's/-march=armv7-a[[:alnum:]+-]*/&+nofp/g'		\\\
8d56311
		-e 's/-mfpu=[[:alnum:]-]\\+//g'				\\\
8d56311
		-e 's/-mfloat-abi=[[:alpha:]]\\+/-mfloat-abi=soft/g'	\\\
8d56311
	)}
b50565e
%endif
b50565e
b50565e
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
b50565e
%global _alt_target_platform %{alt_target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
b50565e
b50565e
%ifarch %{efi_arch}
b50565e
%global with_efi_arch 1
b50565e
%global grubefiname grub%{efiarch}.efi
b50565e
%global grubeficdname gcd%{efiarch}.efi
b50565e
%global grubefiarch %{target_cpu_name}-efi
a91fed7
%ifarch %{ix86}
a91fed7
%global with_efi_modules 0
a91fed7
%global without_efi_modules 1
a91fed7
%else
a91fed7
%global with_efi_modules 1
a91fed7
%global without_efi_modules 0
a91fed7
%endif
b50565e
%endif
b50565e
b50565e
%if 0%{?alt_efi_arch:1}
b50565e
%global with_alt_efi_arch 1
b50565e
%global grubaltefiname grub%{alt_efi_arch}.efi
b50565e
%global grubalteficdname gcd%{alt_efi_arch}.efi
b50565e
%global grubaltefiarch %{alt_target_cpu_name}-efi
b50565e
%endif
b50565e
b50565e
%ifnarch %{efi_only}
b50565e
%global with_legacy_arch 1
b50565e
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
b50565e
%global moduledir %{legacy_target_cpu_name}-%{platform}
b50565e
%endif
b50565e
b50565e
%global evr %{epoch}:%{version}-%{release}
b50565e
53a4172
%ifarch x86_64
b50565e
%global with_efi_common 1
53a4172
%global with_legacy_modules 0
b50565e
%global with_legacy_common 0
53a4172
%else
53a4172
%global with_efi_common 0
53a4172
%global with_legacy_common 1
53a4172
%global with_legacy_modules 1
b50565e
%endif
b50565e
b50565e
%define define_legacy_variant()						\
b50565e
%{expand:%%package %%{1}}						\
b50565e
Summary:	Bootloader with support for Linux, Multiboot, and more	\
152cdcd
Provides:	%{name} = %{evr}					\
b52a729
Obsoletes:	%{name} < %{evr}					\
b50565e
Requires:	%{name}-common = %{evr}					\
b50565e
Requires:	%{name}-tools-minimal = %{evr}				\
b50565e
Requires:	%{name}-%{1}-modules = %{evr}				\
b50565e
Requires:	gettext which file					\
b50565e
Requires:	%{name}-tools = %{evr}					\
b50565e
Requires(pre):	dracut							\
b50565e
Requires(post): dracut							\
b50565e
%{expand:%%description %%{1}}						\
b50565e
%{desc}									\
af06f22
This subpackage provides support for %{1} systems.			\
b50565e
									\
b50565e
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
53a4172
%{expand:%%if 0%%{with_legacy_modules}					\
53a4172
%%package %%{1}-modules							\
b50565e
Summary:	Modules used to build custom grub images		\
b50565e
BuildArch:	noarch							\
53a4172
Requires:	%%{name}-common = %%{evr}				\
53a4172
%%description %%{1}-modules						\
53a4172
%%{desc}								\
b50565e
This subpackage provides support for rebuilding your own grub.efi.	\
53a4172
%%endif									\
53a4172
}									\
b50565e
									\
b50565e
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
b50565e
%{expand:%%package %%{1}-tools}						\
b50565e
Summary:	Support tools for GRUB.					\
b50565e
Requires:	gettext os-prober which file system-logos		\
b50565e
Requires:	%{name}-common = %{evr}					\
b50565e
Requires:	%{name}-tools-minimal = %{evr}				\
b50565e
Requires:	os-prober >= 1.58-11					\
b50565e
Requires:	gettext which file					\
b50565e
									\
b50565e
%{expand:%%description %%{1}-tools}					\
b50565e
%{desc}									\
b50565e
This subpackage provides tools for support of %%{1} platforms.		\
b50565e
%{nil}
b50565e
152cdcd
%define define_efi_variant(o)						\
b50565e
%{expand:%%package %{1}}						\
b50565e
Summary:	GRUB for EFI systems.					\
a52365a
Requires:	efi-filesystem						\
b50565e
Requires:	%{name}-common = %{evr}					\
b50565e
Requires:	%{name}-tools-minimal >= %{evr}				\
b50565e
Requires:	%{name}-tools = %{evr}					\
152cdcd
Provides:	%{name}-efi = %{evr}					\
e1f4c0e
%{?legacy_provides:Provides:	%{name} = %{evr}}			\
152cdcd
%{-o:Obsoletes:	%{name}-efi < %{evr}}					\
b50565e
									\
b50565e
%{expand:%%description %{1}}						\
b50565e
%{desc}									\
b50565e
This subpackage provides support for %{1} systems.			\
b50565e
									\
b50565e
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
a91fed7
%{expand:%if 0%{?with_efi_modules}					\
b50565e
%{expand:%%package %{1}-modules}					\
b50565e
Summary:	Modules used to build custom grub.efi images		\
b50565e
BuildArch:	noarch							\
b50565e
Requires:	%{name}-common = %{evr}					\
a91fed7
Provides:	%{name}-efi-modules = %{evr}				\
a91fed7
Obsoletes:	%{name}-efi-modules < %{evr}				\
b50565e
%{expand:%%description %{1}-modules}					\
b50565e
%{desc}									\
b50565e
This subpackage provides support for rebuilding your own grub.efi.	\
a91fed7
%endif}									\
b50565e
									\
b50565e
%{expand:%%package %{1}-cdboot}						\
b50565e
Summary:	Files used to boot removeable media with EFI		\
b50565e
Requires:	%{name}-common = %{evr}					\
152cdcd
Provides:	%{name}-efi-cdboot = %{evr}				\
b50565e
%{expand:%%description %{1}-cdboot}					\
b50565e
%{desc}									\
b50565e
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
b50565e
%{nil}
b50565e
b50565e
%global do_common_setup()					\
b50565e
%setup -q -n grub-%{tarversion}					\
b50565e
rm -fv docs/*.info						\
b50565e
cp %{SOURCE6} .gitignore					\
e153146
cp %{SOURCE7} bootstrap						\
e153146
cp %{SOURCE8} bootstrap.conf					\
e153146
cp %{SOURCE9} ./grub-core/tests/strtoull_test.c			\
0cb30b7
cp %{SOURCE2} gnulib-%{gnulibversion}.tar.gz			\
e153146
tar -zxf gnulib-%{gnulibversion}.tar.gz				\
e153146
mv gnulib-%{gnulibversion} gnulib				\
b50565e
git init							\
b50565e
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore	\
b50565e
echo '!*.[[:digit:]]' > util/.gitignore				\
b50565e
echo '!config.h' > include/grub/emu/.gitignore			\
b50565e
git config user.email "%{name}-owner@fedoraproject.org"		\
b50565e
git config user.name "Fedora Ninjas"				\
b50565e
git config gc.auto 0						\
da0e16c
rm -f configure							\
b50565e
git add .							\
b50565e
git commit -a -q -m "%{tarversion} baseline."			\
e153146
#git apply --index --whitespace=nowarn %{SOURCE3}		\
e153146
#git commit -a -q -m "%{tarversion} master."			\
15a2072
git am --whitespace=nowarn %%{patches} 
e153146
./bootstrap							\
b50565e
%{nil}
b50565e
b50565e
%define do_efi_configure()					\
b50565e
%configure							\\\
b50565e
	%{cc_equals}						\\\
7388f24
	HOST_CFLAGS="%{3}"					\\\
7388f24
	HOST_CPPFLAGS="-I$(pwd)"				\\\
7388f24
	HOST_LDFLAGS="%{efi_host_ldflags}"			\\\
7388f24
	TARGET_CFLAGS="%{2}"					\\\
7388f24
	TARGET_CPPFLAGS="-I$(pwd)"				\\\
7388f24
	TARGET_LDFLAGS="%{efi_target_ldflags}"			\\\
a451613
	--with-platform=efi					\\\
8d56311
	--with-utils=host					\\\
b50565e
	--target=%{1}						\\\
b50565e
	--with-grubdir=%{name}					\\\
a451613
	--program-transform-name=s,grub,%{name},		\\\
dd0009e
	--disable-werror || ( cat config.log ; exit 1 )		\
dbfd2e6
git add .							\
dbfd2e6
git commit -m "After efi configure"				\
b50565e
%{nil}
b50565e
b50565e
%define do_efi_build_modules()					\
b50565e
make %{?_smp_mflags} ascii.h widthspec.h			\
b50565e
make %{?_smp_mflags} -C grub-core				\
b50565e
%{nil}
b50565e
b50565e
%define do_efi_build_all()					\
b50565e
make %{?_smp_mflags}						\
b50565e
%{nil}
b50565e
b50565e
%define do_efi_link_utils()					\
b50565e
for x in grub-mkimage ; do					\\\
b50565e
	ln ../grub-%{1}-%{tarversion}/${x} ./ ;			\\\
b50565e
done								\
b50565e
%{nil}
b50565e
8c2cf1c
%define do_install_protected_file()				\
8c2cf1c
touch %{1}.conf							\
8c2cf1c
echo %{1} > %{1}.conf						\
8c2cf1c
install -d -m 755 ${RPM_BUILD_ROOT}/etc/dnf/protected.d/	\
8c2cf1c
install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \
8c2cf1c
rm -f %{1}.conf							\
8c2cf1c
%{nil}
8c2cf1c
David Abdurachmanov b888fb3
%ifarch x86_64 aarch64 %{arm} riscv64
b50565e
%define mkimage()						\
b50565e
%{4}./grub-mkimage -O %{1} -o %{2}.orig				\\\
46968b6
	-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES}	\\\
46968b6
	--sbat %{4}./sbat.csv					\
b50565e
%{4}./grub-mkimage -O %{1} -o %{3}.orig				\\\
46968b6
	-p /EFI/BOOT -d grub-core ${GRUB_MODULES}		\\\
46968b6
	--sbat %{4}./sbat.csv					\
47cf637
%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \
47cf637
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
47cf637
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}}	\
47cf637
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}}	\
47cf637
%{expand:%%define __pesign_client_cert grub2-signer} \
47cf637
%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}}	\
47cf637
%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}}	\
b50565e
%{nil}
b50565e
%else
b50565e
%define mkimage()						\
b50565e
%{4}./grub-mkimage -O %{1} -o %{2}				\\\
a52365a
	-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES}	\
b50565e
%{4}./grub-mkimage -O %{1} -o %{3}				\\\
b50565e
	-p /EFI/BOOT -d grub-core ${GRUB_MODULES}		\
b50565e
%{nil}
b50565e
%endif
b50565e
b50565e
%define do_efi_build_images()					\
06b68a8
GRUB_MODULES="	all_video boot blscfg btrfs			\\\
300c372
		cat configfile cryptodisk			\\\
6d09d20
		echo efi_netfs efifwsetup efinet ext2 f2fs	\\\
300c372
		fat font gcry_rijndael gcry_rsa gcry_serpent 	\\\
300c372
		gcry_sha256 gcry_twofish gcry_whirlpool   	\\\
e153146
		gfxmenu gfxterm gzio				\\\
db4a996
		halt hfsplus http increment iso9660 jpeg	\\\
300c372
		loadenv loopback linux lvm lsefi lsefimmap luks	\\\
485dd93
		luks2 mdraid09 mdraid1x minicmd net		\\\
b50565e
		normal part_apple part_msdos part_gpt		\\\
e153146
		password_pbkdf2 pgp png reboot			\\\
c432d1f
		regexp search search_fs_uuid search_fs_file	\\\
a52365a
		search_label serial sleep syslinuxcfg test tftp	\\\
68246dd
		version video xfs zstd "			\
b50565e
GRUB_MODULES+=%{efi_modules}					\
b50565e
%{expand:%%{mkimage %{1} %{2} %{3} %{4}}}			\
b50565e
%{nil}
b50565e
b50565e
%define do_primary_efi_build()					\
b50565e
cd grub-%{1}-%{tarversion}					\
8d56311
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}}			\
b50565e
%do_efi_build_all						\
b50565e
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./ } \
b50565e
cd ..								\
b50565e
%{nil}
b50565e
b50565e
%define do_alt_efi_build()					\
b50565e
cd grub-%{1}-%{tarversion}					\
8d56311
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}}			\
b50565e
%do_efi_build_modules						\
b50565e
%{expand:%%do_efi_link_utils %{grubefiarch}}			\
b50565e
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../grub-%{grubefiarch}-%{tarversion}/ } \
b50565e
cd ..								\
b50565e
%{nil}
b50565e
b50565e
%define do_legacy_build()					\
b50565e
cd grub-%{1}-%{tarversion}					\
b50565e
%configure							\\\
b50565e
	%{cc_equals}						\\\
7388f24
	HOST_CFLAGS="%{legacy_host_cflags}"			\\\
7388f24
	HOST_CPPFLAGS="-I$(pwd)"				\\\
7388f24
	HOST_LDFLAGS="%{legacy_host_ldflags}"			\\\
7388f24
	TARGET_CFLAGS="%{legacy_target_cflags}"			\\\
7388f24
	TARGET_CPPFLAGS="-I$(pwd)"				\\\
7388f24
	TARGET_LDFLAGS="%{legacy_target_ldflags}"		\\\
a451613
	--with-platform=%{platform}				\\\
8d56311
	--with-utils=host					\\\
b50565e
	--target=%{_target_platform}				\\\
b50565e
	--with-grubdir=%{name}					\\\
a451613
	--program-transform-name=s,grub,%{name},		\\\
dd0009e
	--disable-werror || ( cat config.log ; exit 1 )		\
dbfd2e6
git add .							\
7388f24
git commit -m "After legacy configure"				\
b50565e
make %{?_smp_mflags}						\
b50565e
cd ..								\
b50565e
%{nil}
b50565e
a18e8e6
%define do_emu_build()						\
a18e8e6
cd grub-emu-%{tarversion}					\
a18e8e6
%configure							\\\
a18e8e6
	%{cc_equals}						\\\
51b7d62
	HOST_CFLAGS="%{legacy_host_cflags}"			\\\
51b7d62
	HOST_CPPFLAGS="-I$(pwd)"				\\\
51b7d62
	HOST_LDFLAGS="%{legacy_host_ldflags}"			\\\
a18e8e6
	--with-platform=emu					\\\
a18e8e6
	--with-grubdir=%{name}					\\\
a18e8e6
	--program-transform-name=s,grub,%{name},		\\\
a18e8e6
	--disable-werror || ( cat config.log ; exit 1 )		\
a18e8e6
git add .							\
a18e8e6
git commit -m "After emu configure"				\
a18e8e6
make %{?_smp_mflags} ascii.h widthspec.h			\
e153146
make %{?_smp_mflags} -C grub-core/lib/gnulib			\
a18e8e6
make %{?_smp_mflags} -C grub-core				\
a18e8e6
cd ..								\
a18e8e6
%{nil}
a18e8e6
b50565e
%define do_alt_efi_install()					\
b50565e
cd grub-%{1}-%{tarversion}					\
bf33524
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
b50565e
find . '(' -iname gdb_grub					\\\
b50565e
	-o -iname kernel.exec					\\\
b50565e
	-o -iname kernel.img					\\\
b50565e
	-o -iname config.h					\\\
b50565e
	-o -iname gmodule.pl					\\\
b50565e
	-o -iname modinfo.sh					\\\
b50565e
	-o -iname '*.lst'					\\\
b50565e
	-o -iname '*.mod'					\\\
b50565e
	')'							\\\
b50565e
	-exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \
Petr Å abata 50a9c3a
find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;'	\
a52365a
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2}	\
a52365a
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
8c2cf1c
%{expand:%%do_install_protected_file %{name}-%{alt_package_arch}} \
b50565e
cd ..								\
b50565e
%{nil}
b50565e
b50565e
%define do_efi_install()					\
b50565e
cd grub-%{1}-%{tarversion}					\
b50565e
make DESTDIR=$RPM_BUILD_ROOT install				\
b50565e
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
b50565e
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
b50565e
fi								\
b50565e
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
b50565e
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
b50565e
fi								\
b50565e
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;'	\
4fe0f66
ln -s ../boot/%{name}/grub.cfg					\\\
b50565e
	$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg		\
a52365a
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2}		\
a52365a
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3}		\
0993459
%ifarch %{arm}							\
0993459
install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \
0993459
%endif								\
bf33524
install -D -m 700 unicode.pf2					\\\
9cf30d9
	${RPM_BUILD_ROOT}/boot/%{name}/fonts/unicode.pf2		\
a52365a
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv			\\\
4fe0f66
		${RPM_BUILD_ROOT}/boot/%{name}/grubenv create	\
8c2cf1c
%{expand:%%do_install_protected_file %{name}-%{package_arch}}	\
b50565e
cd ..								\
b50565e
%{nil}
b50565e
b50565e
%define do_legacy_install()					\
b50565e
cd grub-%{1}-%{tarversion}					\
b50565e
make DESTDIR=$RPM_BUILD_ROOT install				\
b50565e
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
b50565e
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
b50565e
fi								\
b50565e
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
b50565e
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
b50565e
fi								\
b50565e
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
b50565e
	mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp	\\\
b50565e
	   $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp	\
b50565e
fi								\
a52365a
if [ %{3} -eq 0 ]; then						\
a52365a
	${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv		\\\
a52365a
		${RPM_BUILD_ROOT}/boot/%{name}/grubenv create	\
a52365a
fi								\
8c2cf1c
%{expand:%%do_install_protected_file %{name}-%{legacy_package_arch}} \
dcee992
cd ..								\
b50565e
%{nil}
b50565e
a18e8e6
%define do_emu_install()					\
a18e8e6
cd grub-emu-%{tarversion}					\
a18e8e6
make DESTDIR=$RPM_BUILD_ROOT install -C grub-core		\
a18e8e6
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then		\
a18e8e6
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info		\
a18e8e6
fi								\
a18e8e6
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then	\
a18e8e6
	rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info		\
a18e8e6
fi								\
a18e8e6
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
a18e8e6
	mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp	\\\
a18e8e6
	   $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp	\
a18e8e6
fi								\
a18e8e6
cd ..								\
a18e8e6
%{nil}
a18e8e6
b50565e
%define do_common_install()					\
b50565e
install -d -m 0755 						\\\
b50565e
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot		\\\
b50565e
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en		\\\
b50565e
	$RPM_BUILD_ROOT%{_infodir}/				\
b50565e
cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot		\\\
b50565e
	$RPM_BUILD_ROOT%{_datarootdir}/locale/en		\
b50565e
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info	\
b50565e
cp docs/grub-dev.info						\\\
b50565e
	$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info		\
a52365a
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/		\
bf33524
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/		\
1b55f4c
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries	\
1b55f4c
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system	\
1b55f4c
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default	\
1b55f4c
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig	\
b50565e
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub		\
b50565e
ln -sf ../default/grub						\\\
b50565e
	${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub		\
b50565e
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg			\
4fe0f66
ln -s ../boot/%{name}/grub.cfg					\\\
4fe0f66
	${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg		\
b50565e
%{nil}
b50565e
b50565e
%define define_legacy_variant_files()				\
b50565e
%{expand:%%files %{1}}						\
b50565e
%defattr(-,root,root,-)						\
b50565e
%config(noreplace) %{_sysconfdir}/%{name}.cfg			\
b50565e
%ghost %config(noreplace) /boot/%{name}/grub.cfg		\
78e1a10
%dir %attr(0700,root,root)/boot/loader/entries			\
8c2cf1c
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
b50565e
								\
53a4172
%{expand:%if 0%{?with_legacy_modules}				\
b50565e
%{expand:%%files %{1}-modules}					\
b50565e
%defattr(-,root,root)						\
b50565e
%dir %{_libdir}/grub/%{2}/					\
b50565e
%{_libdir}/grub/%{2}/*						\
b50565e
%exclude %{_libdir}/grub/%{2}/*.module				\
31ea67e
%exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \
b50565e
%exclude %{_libdir}/grub/%{2}/*.o				\
53a4172
%else								\
53a4172
%%exclude %%{_libdir}/grub/%%{grublegacyarch}/*			\
53a4172
%endif}								\
b50565e
%{nil}
b50565e
b50565e
%define define_efi_variant_files()				\
b50565e
%{expand:%%files %{1}}						\
a52365a
%defattr(0700,root,root,-)					\
4fe0f66
%config(noreplace) %{_sysconfdir}/%{name}.cfg			\
b50565e
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg		\
a52365a
%attr(0700,root,root)%{efi_esp_dir}/%{2}			\
0993459
%ifarch %{arm}							\
0993459
%attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI		\
0993459
%endif								\
9cf30d9
%attr(0700,root,root)/boot/%{name}/fonts			\
1b55f4c
%dir %attr(0700,root,root)/boot/loader/entries			\
4fe0f66
%ghost %config(noreplace) /boot/%{name}/grub.cfg		\
a52365a
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg	\
ec73df1
%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv	\
8c2cf1c
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
a91fed7
%{expand:%if 0%{?without_efi_modules}				\
a91fed7
%exclude %{_libdir}/grub/%{6}					\
a91fed7
%exclude %{_libdir}/grub/%{6}/*					\
a91fed7
%endif}								\
b50565e
								\
a91fed7
%{expand:%if 0%{?with_efi_modules}				\
b50565e
%{expand:%%files %{1}-modules}					\
b50565e
%defattr(-,root,root,-)						\
b50565e
%dir %{_libdir}/grub/%{6}/					\
b50565e
%{_libdir}/grub/%{6}/*						\
b50565e
%exclude %{_libdir}/grub/%{6}/*.module				\
a91fed7
%endif}								\
b50565e
								\
b50565e
%{expand:%%files %{1}-cdboot}					\
4892e6b
%defattr(0700,root,root,-)					\
4892e6b
%attr(0700,root,root)%{efi_esp_dir}/%{3}			\
9cf30d9
%attr(0700,root,root)/boot/%{name}/fonts			\
b50565e
%{nil}