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'				\\\
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
b50565e
%global efi_only aarch64 %{arm}
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
b50565e
%ifarch aarch64 %{arm}
a52365a
%global efi_modules " "
b50565e
%else
ebe16ce
%global efi_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug "
b50565e
%endif
b50565e
dd0009e
%ifarch aarch64 %{arm}
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
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	\
b50565e
Group:		System Environment/Base					\
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-extra = %{evr}				\
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
Group:		System Environment/Base					\
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
Group:		System Environment/Base					\
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.					\
b50565e
Group:		System Environment/Base					\
a52365a
Requires:	efi-filesystem						\
b50565e
Requires:	%{name}-common = %{evr}					\
b50565e
Requires:	%{name}-tools-minimal >= %{evr}				\
b50565e
Requires:	%{name}-tools-extra = %{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
Group:		System Environment/Base					\
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
Group:		System Environment/Base					\
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					\
b50565e
cp %{SOURCE8} ./grub-core/tests/strtoull_test.c			\
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."			\
15a2072
git apply --index --whitespace=nowarn %{SOURCE3}		\
15a2072
git commit -a -q -m "%{tarversion} master."			\
15a2072
git am --whitespace=nowarn %%{patches} 
da0e16c
autoreconf -vi							\
da0e16c
git add .							\
da0e16c
git commit -a -q -m "autoreconf"				\
da0e16c
autoconf							\
da0e16c
PYTHON=python3 ./autogen.sh					\
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
dd0009e
%ifarch x86_64 aarch64 %{arm}
b50565e
%define mkimage()						\
b50565e
%{4}./grub-mkimage -O %{1} -o %{2}.orig				\\\
a52365a
	-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES}	\
b50565e
%{4}./grub-mkimage -O %{1} -o %{3}.orig				\\\
b50565e
	-p /EFI/BOOT -d grub-core ${GRUB_MODULES}		\
b50565e
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}}	\
b50565e
%{expand:%%{pesign -s -i %%{3}.orig -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			\\\
ebe16ce
		cat configfile					\\\
a52365a
		echo efi_netfs efifwsetup efinet ext2		\\\
a52365a
		fat font gfxmenu gfxterm gzio			\\\
db4a996
		halt hfsplus http increment iso9660 jpeg	\\\
98536ec
		loadenv loopback linux lvm lsefi lsefimmap	\\\
a52365a
		mdraid09 mdraid1x minicmd net			\\\
b50565e
		normal part_apple part_msdos part_gpt		\\\
5376ad0
		password_pbkdf2 png reboot			\\\
b50565e
		search search_fs_uuid search_fs_file		\\\
a52365a
		search_label serial sleep syslinuxcfg test tftp	\\\
98536ec
		version video xfs"				\
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}						\\\
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			\
a18e8e6
make %{?_smp_mflags} -C grub-core/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} \
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 {} '\;'	\
a52365a
touch $RPM_BUILD_ROOT%{efi_esp_dir}/grub.cfg			\
a52365a
ln -sf ..%{efi_esp_dir}/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}		\
bf33524
install -D -m 700 unicode.pf2					\\\
a52365a
	$RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2		\
a52365a
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv			\\\
a52365a
	${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create		\
a52365a
ln -sf ../efi/EFI/%{efi_vendor}/grubenv				\\\
a52365a
	$RPM_BUILD_ROOT/boot/grub2/grubenv			\
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
ln -s ../boot/%{name}/grub.cfg					\\\
b50565e
	${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg		\
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								\
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			\
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			\
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,-)					\
b50565e
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg		\
a52365a
%attr(0700,root,root)%{efi_esp_dir}/%{2}			\
a52365a
%dir %attr(0700,root,root)%{efi_esp_dir}/fonts			\
1b55f4c
%dir %attr(0700,root,root)/boot/loader/entries			\
a52365a
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg	\
8c44667
%config(noreplace) /boot/grub2/grubenv					\
a52365a
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv	\
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}			\
4892e6b
%attr(0700,root,root)%{efi_esp_dir}/fonts			\
b50565e
%{nil}