[PATCH] always use system python for building

Matúš Kukan (via_Code_Review) gerrit at gerrit.libreoffice.org
Wed Mar 6 03:48:49 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2563

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/63/2563/1

always use system python for building

Change-Id: I5c6c53fbee06cd1ecccf878a5c080274bfd950c1
---
M RepositoryExternal.mk
M config_host.mk.in
M configure.ac
M nss/ExternalProject_nss.mk
M solenv/gbuild/ExternalExecutable.mk
5 files changed, 12 insertions(+), 85 deletions(-)



diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 869e179..c63d909 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2722,45 +2722,11 @@
 
 endif # SYSTEM_UCPP
 
-# TODO what do do with gb_PYTHON_PRECOMMAND? Move here?
-ifeq ($(SYSTEM_PYTHON),YES)
-
+# Always use system python for building
 define gb_ExternalExecutable__register_python
-$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
+$(call gb_ExternalExecutable_set_external,python)
 
 endef
-
-else ifeq ($(OS),MACOSX)
-
-#fixme: remove this MACOSX ifeq branch by filling in gb_PYTHON_PRECOMMAND in
-#gbuild/platform/macosx.mk correctly for mac, e.g. PYTHONPATH and PYTHONHOME
-#dirs for in-tree internal python
-define gb_ExternalExecutable__register_python
-$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
-
-endef
-
-else ifeq ($(DISABLE_PYTHON),TRUE)
-
-# Build-time python
-gb_ExternalExecutable__register_python :=
-
-else # ! SYSTEM_PYTHON
-
-# internal python
-define gb_ExternalExecutable__register_python
-$(call gb_ExternalExecutable_set_internal,python)
-$(call gb_ExternalExecutable_set_precommand,python,$(gb_PYTHON_PRECOMMAND))
-$(call gb_ExternalExecutable_add_dependencies,python,\
-	$(if $(filter MACOSX,$(OS)) \
-		,$(call gb_Zip_get_outdir_target_for_build,LibreOfficePython.framework) \
-		,$(call gb_Package_get_target_for_build,python3) \
-	) \
-)
-
-endef
-
-endif # SYSTEM_PYTHON
 
 ifneq ($(SYSTEM_GENBRK),)
 
diff --git a/config_host.mk.in b/config_host.mk.in
index cd0fc37..2c511ef 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -468,9 +468,7 @@
 export PSPRINT=TRUE
 export PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
 export PTHREAD_LIBS=@PTHREAD_LIBS@
-export PYTHON=@PYTHON@
 export PYTHON_CFLAGS=$(gb_SPACE)@PYTHON_CFLAGS@
-export PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 export PYTHON_LIBS=$(gb_SPACE)@PYTHON_LIBS@
 export PYTHON_VERSION=@PYTHON_VERSION@
 export PYTHON_VERSION_MAJOR=@PYTHON_VERSION_MAJOR@
diff --git a/configure.ac b/configure.ac
index 7b04705..f80f866 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4076,10 +4076,10 @@
     cp config.log ../config.Build.log
     mkdir -p ../config_build
     cp config_host/*.h ../config_build
-    . ./bin/get_config_variables COM GUI OS PATH CPU CPUNAME CC CXX DISABLE_PYTHON MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH PYTHON SYSTEM_LIBXSLT OUTDIR WORKDIR
+    . ./bin/get_config_variables COM GUI OS PATH CPU CPUNAME CC CXX MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH SYSTEM_LIBXSLT OUTDIR WORKDIR
 
-    for V in COM GUI OS CPU CPUNAME CC CXX DISABLE_PYTHON MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
-             PYTHON SYSTEM_LIBXSLT; do
+    for V in COM GUI OS CPU CPUNAME CC CXX MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \
+             SYSTEM_LIBXSLT; do
         VV='$'$V
         VV=`eval "echo $VV"`
         if test -n "$VV"; then
@@ -4116,14 +4116,12 @@
     CPUNAME_FOR_BUILD="$CPUNAME"
     CPU_FOR_BUILD="$CPU"
     CXX_FOR_BUILD="$CXX"
-    DISABLE_PYTHON_FOR_BUILD="$DISABLE_PYTHON"
     GUI_FOR_BUILD="$GUI"
     INPATH_FOR_BUILD="$INPATH"
     MACOSX_DEPLOYMENT_TARGET_FOR_BUILD="$MACOSX_DEPLOYMENT_TARGET"
     OS_FOR_BUILD="$OS"
     OUTDIR_FOR_BUILD="$OUTDIR"
     OUTPATH_FOR_BUILD="$OUTPATH"
-    PYTHON_FOR_BUILD="$PYTHON"
     WORKDIR_FOR_BUILD="$WORKDIR"
 fi
 AC_SUBST(COM_FOR_BUILD)
@@ -4136,7 +4134,6 @@
 AC_SUBST(INPATH_FOR_BUILD)
 AC_SUBST(OUTPATH_FOR_BUILD)
 AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD)
-AC_SUBST([PYTHON_FOR_BUILD])
 
 AC_SUBST(OUTDIR_FOR_BUILD)
 AC_SUBST(WORKDIR_FOR_BUILD)
@@ -7282,21 +7279,13 @@
 
 case "$enable_python" in
 no|disable)
-    if test $build_os = cygwin; then
-        # Python is required to build nss. In theory we could separate the build-time Python
-        # requirement from the choice whether to include Python stuff in the installer, but why
-        # bother?
-        AC_MSG_ERROR([Python is required at build time when building on Windows])
-    fi
     enable_python=no
     AC_MSG_RESULT([none])
-    DISABLE_PYTHON=TRUE
     ;;
 ""|yes|auto)
     if test "$DISABLE_SCRIPTING" = TRUE -a $build_os != cygwin; then
         AC_MSG_RESULT([no, overridden by --disable-scripting])
         enable_python=no
-        DISABLE_PYTHON=TRUE
     elif test $build_os = cygwin; then
         dnl When building on Windows we don't attempt to use any installed
         dnl "system"  Python.
@@ -7330,8 +7319,6 @@
     AC_MSG_ERROR([Incorrect --enable-python option])
     ;;
 esac
-
-AC_SUBST(DISABLE_PYTHON)
 
 if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then
     AC_MSG_ERROR([Must use internal Python when building with MSVC])
@@ -7381,24 +7368,6 @@
 
         if test "$PYTHON" = :; then
             enable_python=internal
-
-            if test $_os = Darwin; then
-                # See the fixme in gbuild.mk
-
-                # There must be a system Python, 2.6 should be fine (?), to run build-time Python scripts
-                # like filter/source/svg/js2hxx.py. (Is that the only build-time Python script?) If we
-                # don't do this, PYTHON will stay with the value ":" which of course makes runing
-                # build-time Python scripts rather ineffective.
-
-                # Unset variables set by the above AM_PATH_PYTHON so that we acutally do check anew
-                # Finding an (old) system Python should not confuse our already decided intent to build an
-                # internal Python 3.3, that is directed by enable_python = internal.
-                unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON
-                AM_PATH_PYTHON([2.6])
-            else
-                # For Linux it works to use the internally built Python, see gbuild.mk
-                :
-            fi
         else
             enable_python=system
         fi
@@ -7512,6 +7481,7 @@
     fi
     ;;
 no)
+    DISABLE_PYTHON=TRUE
     SYSTEM_PYTHON=NO
     ;;
 *)
@@ -7519,14 +7489,7 @@
     ;;
 esac
 
-dnl Cross-build of python requires python that is runnable on the build
-dnl platform, because it is used in the build process
-if test "$cross_compiling" = yes; then
-    if test "$DISABLE_PYTHON" = no -a "$SYSTEM_PYTHON" = no -a "$DISABLE_PYTHON_FOR_BUILD" = yes; then
-        AC_MSG_ERROR([Cross-build of python requires python that is runnable on the build platform. You must not use --disable-python for the 'build' config.])
-    fi
-fi
-
+AC_SUBST(DISABLE_PYTHON)
 AC_SUBST(SYSTEM_PYTHON)
 AC_SUBST(PYTHON_CFLAGS)
 AC_SUBST(PYTHON_LIBS)
diff --git a/nss/ExternalProject_nss.mk b/nss/ExternalProject_nss.mk
index 7de780b..6e9b363 100644
--- a/nss/ExternalProject_nss.mk
+++ b/nss/ExternalProject_nss.mk
@@ -50,7 +50,7 @@
 
 
 else
-$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure)
+$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
 	$(call gb_ExternalProject_run,build,\
 		CC="$(CC) $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-shared-libgcc)" \
 		CXX="$(CXX) $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-shared-libgcc)" \
@@ -58,13 +58,13 @@
 		OS_TARGET=WINNT RC="$(WINDRES)" OS_RELEASE="5.0" \
 		IMPORT_LIB_SUFFIX=dll.a \
 		NSPR_CONFIGURE_OPTS="--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --enable-shared --disable-static" \
-		NSINSTALL="$(PYTHON_FOR_BUILD) $(SRCDIR)/nss/nsinstall.py" \
+		NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/nss/nsinstall.py" \
 		$(MAKE) -j1 nss_build_all \
 	,mozilla/security/nss)
 
 endif
 else # OS!=WNT
-$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure)
+$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
 	$(call gb_ExternalProject_run,build,\
 		$(if $(filter FREEBSD LINUX MACOSX,$(OS)),$(if $(filter X,$(CPU)),USE_64=1)) \
 		$(if $(filter MACOSX,$(OS)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH) \
@@ -72,7 +72,7 @@
 		$(if $(filter SOLARIS,$(OS)),NS_USE_GCC=1) \
 		$(if $(filter YES,$(CROSS_COMPILING)),\
 		$(if $(filter MACOSXP,$(OS)$(CPU)),CPU_ARCH=ppc) \
-		NSINSTALL="$(PYTHON_FOR_BUILD) $(SRCDIR)/nss/nsinstall.py") \
+		NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/nss/nsinstall.py") \
 		NSDISTMODE=copy \
 		$(MAKE) -j1 nss_build_all \
 	,mozilla/security/nss)
diff --git a/solenv/gbuild/ExternalExecutable.mk b/solenv/gbuild/ExternalExecutable.mk
index c62b4c6..d29a4fe 100644
--- a/solenv/gbuild/ExternalExecutable.mk
+++ b/solenv/gbuild/ExternalExecutable.mk
@@ -101,7 +101,7 @@
 #
 # Optionally set a specific executable call to use.
 # Example:
-# 	$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
+# 	$(call gb_ExternalExecutable_set_external,genbrk,$(SYSTEM_GENBRK))
 #
 # gb_ExternalExecutable_set_external executable call?
 define gb_ExternalExecutable_set_external

-- 
To view, visit https://gerrit.libreoffice.org/2563
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c6c53fbee06cd1ecccf878a5c080274bfd950c1
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Matúš Kukan <matus.kukan at gmail.com>



More information about the LibreOffice mailing list