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