Blob Blame History Raw
From 658da7bd0ff62b35395012ccfb10aef13756eb2b Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 25 May 2017 13:45:01 -0400
Subject: [PATCH] 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>
---
 configure.ac                  | 9 +++++++++
 grub-core/osdep/aros/config.c | 2 +-
 grub-core/osdep/unix/config.c | 2 +-
 conf/Makefile.common          | 2 +-
 config.h.in                   | 2 ++
 5 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 359cac3c26b..aef90611168 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,15 @@ AS_IF([$($PKG_CONFIG --exists bash-completion)], [
 ])
 AC_SUBST(bashcompletiondir)
 
+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 c82d0ea8e76..bf3593d9743 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 b637c58efb7..403eee565cd 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 *
diff --git a/conf/Makefile.common b/conf/Makefile.common
index c75848f5c06..d2fedeaa3a5 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -62,7 +62,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 9e8f9911b18..c7fc6efa1fa 100644
--- a/config.h.in
+++ b/config.h.in
@@ -46,6 +46,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. */