Mesa (7.9): Fix build on systems where "python" is python 3.

Ian Romanick idr at kemper.freedesktop.org
Tue Jan 4 17:59:25 UTC 2011


Module: Mesa
Branch: 7.9
Commit: 3c8dd6a8de869925c5a899b1896452a4627f3c58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c8dd6a8de869925c5a899b1896452a4627f3c58

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Oct 25 13:52:58 2010 -0700

Fix build on systems where "python" is python 3.

First, it changes autoconf to use a "python2" binary when available,
rather than plain "python" (which is ambiguous).  Secondly, it changes
the Makefiles to use $(PYTHON) $(PYTHON_FLAGS) rather than calling
python directly.

Signed-off-by: Xavier Chantry <chantry.xavier at gmail.com>
Signed-off-by: Matthew William Cox <matt at mattcox.ca>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit 3acc8265200295265b476222299a013791050b73)

---

 configs/autoconf.in                          |    2 +-
 configure.ac                                 |    3 +++
 src/gallium/auxiliary/Makefile               |   10 +++++-----
 src/gallium/drivers/llvmpipe/Makefile        |    2 +-
 src/glsl/Makefile                            |    2 +-
 src/mesa/drivers/dri/common/xmlpool/Makefile |    2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 9bdbefe..e2d70c6 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -53,7 +53,7 @@ MKDEP_OPTIONS = @MKDEP_OPTIONS@
 INSTALL = @INSTALL@
 
 # Python and flags (generally only needed by the developers)
-PYTHON2 = python
+PYTHON2 = @PYTHON2@
 PYTHON_FLAGS = -t -O -O
 
 # Library names (base name)
diff --git a/configure.ac b/configure.ac
index 2f3a47a..45c6df7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_PROG_CPP
 AC_PROG_CC
 AC_PROG_CXX
 AC_CHECK_PROGS([MAKE], [gmake make])
+AC_CHECK_PROGS([PYTHON2], [python2 python])
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
 
@@ -1687,6 +1688,8 @@ echo ""
 echo "        CFLAGS:          $cflags"
 echo "        CXXFLAGS:        $cxxflags"
 echo "        Macros:          $defines"
+echo ""
+echo "        PYTHON2:         $PYTHON2"
 
 echo ""
 echo "        Run '${MAKE-make}' to build Mesa"
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 5388f4e..ecd58c2 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -206,16 +206,16 @@ include ../Makefile.template
 
 
 indices/u_indices_gen.c: indices/u_indices_gen.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 util/u_format_srgb.c: util/u_format_srgb.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 util/u_format_table.c: util/u_format_table.py util/u_format_pack.py util/u_format_parse.py util/u_format.csv
-	python util/u_format_table.py util/u_format.csv > $@
+	$(PYTHON2) util/u_format_table.py util/u_format.csv > $@
 
 util/u_half.c: util/u_half.py
-	python util/u_half.py > $@
+	$(PYTHON2) util/u_half.py > $@
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index 55b877b..aa8f310 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -70,7 +70,7 @@ PROGS_DEPS := ../../auxiliary/libgallium.a
 include ../../Makefile.template
 
 lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_pack.py ../../auxiliary/util/u_format.csv
-	python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
+	$(PYTHON2) $(PYTHON_FLAGS) lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
 
 LDFLAGS += $(LLVM_LDFLAGS)
 LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a $(LLVM_LIBS) $(GL_LIB_DEPS)
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index cee5182..63545de 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -180,7 +180,7 @@ builtins: builtin_function.cpp builtins/profiles/* builtins/ir/* builtins/tools/
 	cp builtins/tools/builtin_function.cpp .
 	make glsl_compiler
 	@echo Regenerating builtin_function.cpp...
-	./builtins/tools/generate_builtins.py > builtin_function.cpp
+	$(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py > builtin_function.cpp
 	@echo Rebuilding the real compiler...
 	make glsl_compiler
 
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile b/src/mesa/drivers/dri/common/xmlpool/Makefile
index 62ec919..b71629e 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile
@@ -62,7 +62,7 @@ clean:
 
 # Default target options.h
 options.h: t_options.h mo
-	python gen_xmlpool.py $(LANGS) > options.h
+	$(PYTHON2) $(PYTHON_FLAGS) gen_xmlpool.py $(LANGS) > options.h
 
 # Update .mo files from the corresponding .po files.
 mo:




More information about the mesa-commit mailing list