Skip to content

Commit

Permalink
asd,mf
Browse files Browse the repository at this point in the history
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
  • Loading branch information
SergiiDmytruk committed Jan 16, 2025
1 parent 37fb75d commit 899a78e
Showing 1 changed file with 40 additions and 33 deletions.
73 changes: 40 additions & 33 deletions grub2.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+
URL: http://www.gnu.org/software/grub/
Obsoletes: grub < 1:0.98
Source0: ${name}-%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
Source3: 99-grub-mkconfig.install
Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz
Source5: theme.tar.bz2
Expand Down Expand Up @@ -79,14 +79,18 @@ Source13: 99-grub-mkconfig.install
%endif
%global legacy_host_cflags \\\
%{expand:%%(echo %{host_cflags} | \\\
sed -e 's/-m64//g' -e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
sed \\\
-e 's/-m64//g' \\\
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
)}
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}

%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
%global legacy_target_cflags \\\
%{expand:%%(echo %{target_cflags} | \\\
%{cflags_sed} -e 's/-m64//g' -e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
%{cflags_sed} \\\
-e 's/-m64//g' \\\
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
)}
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}

Expand Down Expand Up @@ -200,7 +204,10 @@ Source13: 99-grub-mkconfig.install

%global alt_efi_host_cflags %{expand:%%(echo %{efi_host_cflags})}
%global alt_efi_target_cflags \\\
%{expand:%%(echo %{target_cflags} | %{cflags_sed} -e 's/-m64//g' )}
%{expand:%%(echo %{target_cflags} | \\\
%{cflags_sed} \\\
-e 's/-m64//g' \\\
)}
%endif

%ifarch aarch64
Expand Down Expand Up @@ -402,7 +409,7 @@ make %{?_smp_mflags} \

%define do_efi_link_utils() \
for x in grub-mkimage ; do \\\
ln ../%{name}-%{1}-%{tarversion}/${x} ./ ; \\\
ln ../grub-%{1}-%{tarversion}/${x} ./ ; \\\
done \
%{nil}

Expand Down Expand Up @@ -462,7 +469,7 @@ GRUB_MODULES+=%{efi_modules} \
%{nil}

%define do_primary_efi_build() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
%do_efi_build_all \
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./ } \
Expand All @@ -474,12 +481,12 @@ cd %{name}-%{1}-%{tarversion} \
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
%do_efi_build_modules \
%{expand:%%do_efi_link_utils %{grubefiarch}} \
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../%{name}-%{grubefiarch}-%{tarversion}/ } \
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../grub-%{grubefiarch}-%{tarversion}/ } \
cd .. \
%{nil}

%define do_legacy_build() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
%configure \\\
%{cc_equals} \\\
HOST_CFLAGS="%{legacy_host_cflags}" \\\
Expand All @@ -504,7 +511,7 @@ cd .. \
%{nil}

%define do_emu_build() \
cd %{name}-emu-%{tarversion} \
cd grub-emu-%{tarversion} \
%configure \\\
%{cc_equals} \\\
HOST_CFLAGS="%{legacy_host_cflags}" \\\
Expand All @@ -523,7 +530,7 @@ cd .. \
%{nil}

%define do_alt_efi_install() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
find . '(' -iname gdb_grub \\\
-o -iname kernel.exec \\\
Expand All @@ -543,7 +550,7 @@ cd .. \
%{nil}

%define do_efi_install() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
make DESTDIR=$RPM_BUILD_ROOT install \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
Expand All @@ -567,7 +574,7 @@ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\
cd .. \
%{nil}

# TODO: switch to %%upper macro with rpm 4.19+
# TODO: switch to %upper macro with rpm 4.19+
%define upper_() %{lua:print(string.upper(rpm.expand("%{1}")))}

# This is supposed to be case-insensitive anyway. But all-uppercase (even for
Expand All @@ -579,7 +586,7 @@ cd .. \
%global efi_startup_script /boot/efi/startup.nsh

%define do_fallback_efi_install() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
install -D -m 700 %{2} \\\
$RPM_BUILD_ROOT%{expand:%%efi_default_image %{3}} \
%if "%{3}" != "%{alt_efi_arch}" \
Expand All @@ -590,7 +597,7 @@ cd .. \
%{nil}

%define do_legacy_install() \
cd %{name}-%{1}-%{tarversion} \
cd grub-%{1}-%{tarversion} \
make DESTDIR=$RPM_BUILD_ROOT install \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
Expand All @@ -611,7 +618,7 @@ cd .. \
%{nil}

%define do_emu_install() \
cd %{name}-emu-%{tarversion} \
cd grub-emu-%{tarversion} \
make DESTDIR=$RPM_BUILD_ROOT install -C grub-core \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
Expand Down Expand Up @@ -874,32 +881,32 @@ This subpackage provides the GRUB user-space emulation modules.
%prep
%do_common_setup
%if 0%{with_efi_arch}
mkdir %{name}-%{grubefiarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > %{name}-%{grubefiarch}-%{tarversion}/.gitignore
cp %{SOURCE4} %{name}-%{grubefiarch}-%{tarversion}/unifont.pcf.gz
mkdir grub-%{grubefiarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubefiarch}-%{tarversion}/.gitignore
cp %{SOURCE4} grub-%{grubefiarch}-%{tarversion}/unifont.pcf.gz
sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \
%{SOURCE12} > %{name}-%{grubefiarch}-%{tarversion}/sbat.csv
git add %{name}-%{grubefiarch}-%{tarversion}
%{SOURCE12} > grub-%{grubefiarch}-%{tarversion}/sbat.csv
git add grub-%{grubefiarch}-%{tarversion}
%endif
%if 0%{with_alt_efi_arch}
mkdir %{name}-%{grubaltefiarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > %{name}-%{grubaltefiarch}-%{tarversion}/.gitignore
cp %{SOURCE4} %{name}-%{grubaltefiarch}-%{tarversion}/unifont.pcf.gz
git add %{name}-%{grubaltefiarch}-%{tarversion}
mkdir grub-%{grubaltefiarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubaltefiarch}-%{tarversion}/.gitignore
cp %{SOURCE4} grub-%{grubaltefiarch}-%{tarversion}/unifont.pcf.gz
git add grub-%{grubaltefiarch}-%{tarversion}
%endif
%if 0%{with_legacy_arch}
mkdir %{name}-%{grublegacyarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > %{name}-%{grublegacyarch}-%{tarversion}/.gitignore
cp %{SOURCE4} %{name}-%{grublegacyarch}-%{tarversion}/unifont.pcf.gz
git add %{name}-%{grublegacyarch}-%{tarversion}
mkdir grub-%{grublegacyarch}-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grublegacyarch}-%{tarversion}/.gitignore
cp %{SOURCE4} grub-%{grublegacyarch}-%{tarversion}/unifont.pcf.gz
git add grub-%{grublegacyarch}-%{tarversion}
%endif
%if 0%{with_emu_arch}
mkdir %{name}-emu-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > %{name}-emu-%{tarversion}/.gitignore
cp %{SOURCE4} %{name}-emu-%{tarversion}/unifont.pcf.gz
git add %{name}-emu-%{tarversion}
mkdir grub-emu-%{tarversion}
grep -A100000 '# stuff "make" creates' .gitignore > grub-emu-%{tarversion}/.gitignore
cp %{SOURCE4} grub-emu-%{tarversion}/unifont.pcf.gz
git add grub-emu-%{tarversion}
%endif
git commit --allow-empty -m "After making subdirs"
git commit -m "After making subdirs"

%build
%if 0%{with_efi_arch}
Expand Down

0 comments on commit 899a78e

Please sign in to comment.