Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tim Landscheidt <tim@tim-landscheidt.de>
Date: Fri, 11 Jun 2021 13:02:37 +0200
Subject: [PATCH] Fix disabling grub-rpm-sort

Currently, grub-rpm-sort is unconditionally compiled whether
./configure has been called with --disable-rpm-sort or not.  This adds
the necessary logic to configure.ac and Makefile.util.def and some
debug output to ./configure and fixes #44.
---
 configure.ac      | 8 ++++++++
 Makefile.util.def | 1 +
 2 files changed, 9 insertions(+)

diff --git a/configure.ac b/configure.ac
index d5d2a28b4e..c7842ec29d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1936,6 +1936,8 @@ AC_ARG_ENABLE([rpm-sort],
                               [enable native rpm sorting of kernels in grub (default=guessed)])])
 if test x"$enable_rpm_sort" = xno ; then
   rpm_sort_excuse="explicitly disabled"
+else
+  enable_rpm_sort=yes
 fi
 
 if test x"$rpm_sort_excuse" = x ; then
@@ -2200,6 +2202,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
+AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes])
 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
 if test x$FONT_SOURCE != x ; then
    HAVE_FONT_SOURCE=1
@@ -2328,6 +2331,11 @@ echo grub-mount: Yes
 else
 echo grub-mount: No "($grub_mount_excuse)"
 fi
+if [ x"$rpm_sort_excuse" = x ]; then
+echo grub-rpm-sort: Yes
+else
+echo grub-rpm-sort: No "($rpm_sort_excuse)"
+fi
 if [ x"$starfield_excuse" = x ]; then
 echo starfield theme: Yes
 echo With DejaVuSans font from $DJVU_FONT_SOURCE
diff --git a/Makefile.util.def b/Makefile.util.def
index 8cfbe69a76..3f191aa809 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -774,6 +774,7 @@ program = {
   ldadd = libgrubkern.a;
   ldadd = grub-core/lib/gnulib/libgnu.a;
   ldadd = '$(LIBDEVMAPPER) $(LIBRPM)';
+  condition = COND_GRUB_RPM_SORT;
 };
 
 script = {