A patch from Jonathan McCune back in 2015 allowed build-time
configuration of the python interpreter used in autogen.sh. However,
this doesn't cover the whole build process, as we still have use of
'python' hardcoded into Makefile.common when running gentpl.py (the
script's own shebang is ignored). This patch allows you to set the make
variable 'PYTHONBIN' to change the interpreter used to run gentpl.py.
With this, it's possible to build grub on Fedora with 'PYTHON=python3
autogen.sh' and 'make PYTHONBIN=python3', without python2 installed at
all, and the build succeeds.
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net
From 111e9d54c1c5bd57d65d09549831cb6c4a37f530 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awill...@redhat.com>
Date: Wed, 4 Jul 2018 09:55:52 -0700
Subject: [PATCH] Make python interpreter used to run gentpl.py configurable
gentpl.py is python2/3-agnostic, but there's no way to cause it
to be run with any interpreter other than 'python', it's just
hard-coded into Makefile.common that way. Adjust that to allow
a make variable PYTHONBIN to be set to the desired interpreter.
This will make it easier in situations where we specifically
want to build with 'python2' or 'python3' or whatever.
Signed-off-by: Adam Williamson <awill...@redhat.com>
---
conf/Makefile.common | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 311da61c6..a6e05cd91 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -5,6 +5,9 @@ CFLAGS_PLATFORM=
export LC_COLLATE := C
unexport LC_ALL
+# default python is 'python', can be overridden
+PYTHONBIN = python
+
# Platform specific options
if COND_sparc64_ieee1275
LDFLAGS_PLATFORM = -Wl,-melf64_sparc
@@ -128,11 +131,11 @@ BUILT_SOURCES =
.PRECIOUS: $(top_srcdir)/Makefile.util.am
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ $(PYTHONBIN) $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ $(PYTHONBIN) $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
--
2.18.0.rc2
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel