Blob Blame History Raw
From 01469263892c3bf6634ffd82dbe5cf981aaa328d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 25 May 2017 13:45:01 -0400
Subject: [PATCH 260/261] Make module directory specifiable on the configure
 command line.

Currently ppc, ppc64, and ppc64le all wind up with modules in
/usr/lib/grub/powerpc-ieee1275, because powerpc is the target cpu in
grub's eyes.  This causes file conflicts between "noarch" module
packages.

This patch allows --with-moduledir=%{arch} to be specified on the
configure command line to override the directory name for a specific
build, to disambiguate the various ppc directories.

Resolves: rhbz#1455243

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 conf/Makefile.common          | 2 +-
 config.h.in                   | 2 ++
 configure.ac                  | 9 +++++++++
 grub-core/osdep/aros/config.c | 2 +-
 grub-core/osdep/unix/config.c | 2 +-
 5 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/conf/Makefile.common b/conf/Makefile.common
index 6f836d827..5daa6d57c 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -69,7 +69,7 @@ CCASFLAGS_LIBRARY =
 # Other variables
 
 grubconfdir = $(sysconfdir)/grub.d
-platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
+platformdir = $(pkglibdir)/$(moduledirname)
 starfielddir = $(pkgdatadir)/themes/starfield
 
 CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
diff --git a/config.h.in b/config.h.in
index 4b6301441..c38fc74f7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -41,6 +41,8 @@
 #define END_SYMBOL @END_SYMBOL@
 /* Name of package.  */
 #define PACKAGE "@PACKAGE@"
+/* Name of the default module directory.  */
+#define MODULE_DIR_NAME "@MODULE_DIR_NAME@"
 /* Version number of package.  */
 #define VERSION "@VERSION@"
 /* Define to the full name and version of this package. */
diff --git a/configure.ac b/configure.ac
index 8b10a93cb..ab3007ba6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,6 +315,15 @@ AC_SUBST(grubdirname)
 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
     [Default grub directory name])
 
+AC_ARG_WITH([moduledir],
+	    AS_HELP_STRING([--with-moduledir=NAME],
+			   [set the name of the module directory [[guessed]]]),
+			   [moduledirname="$with_moduledir"],
+			   [moduledirname="$target_cpu-$platform"])
+AC_SUBST(moduledirname)
+AC_DEFINE_UNQUOTED(MODULE_DIR_NAME, "$moduledirname",
+    [Default module directory name])
+
 #
 # Checks for build programs.
 #
diff --git a/grub-core/osdep/aros/config.c b/grub-core/osdep/aros/config.c
index c82d0ea8e..bf3593d97 100644
--- a/grub-core/osdep/aros/config.c
+++ b/grub-core/osdep/aros/config.c
@@ -52,7 +52,7 @@ grub_util_get_pkgdatadir (void)
 const char *
 grub_util_get_pkglibdir (void)
 {
-  return GRUB_LIBDIR "/" PACKAGE;
+  return GRUB_LIBDIR "/" MODULE_DIR_NAME;
 }
 
 const char *
diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c
index f4b0bb466..d882bed33 100644
--- a/grub-core/osdep/unix/config.c
+++ b/grub-core/osdep/unix/config.c
@@ -52,7 +52,7 @@ grub_util_get_pkgdatadir (void)
 const char *
 grub_util_get_pkglibdir (void)
 {
-  return GRUB_LIBDIR "/" PACKAGE;
+  return GRUB_LIBDIR "/" MODULE_DIR_NAME;
 }
 
 const char *
-- 
2.13.5