Kaydet (Commit) e482672b authored tarafından Matúš Kukan's avatar Matúš Kukan Kaydeden (comit) David Ostrovsky

use system python for building if possible

Also simplifies configure, hopefully without any mistake;)

Change-Id: I5c6c53fbee06cd1ecccf878a5c080274bfd950c1
Reviewed-on: https://gerrit.libreoffice.org/2563Reviewed-by: 's avatarDavid Ostrovsky <David.Ostrovsky@gmx.de>
Tested-by: 's avatarDavid Ostrovsky <David.Ostrovsky@gmx.de>
üst 5a2cfa67
......@@ -2754,32 +2754,8 @@ endef
endif # SYSTEM_UCPP
# TODO what do do with gb_PYTHON_PRECOMMAND? Move here?
ifeq ($(SYSTEM_PYTHON),YES)
ifeq (,$(PYTHON_FOR_BUILD))
define gb_ExternalExecutable__register_python
$(call gb_ExternalExecutable_set_external,python,$(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))
......@@ -2792,7 +2768,14 @@ $(call gb_ExternalExecutable_add_dependencies,python,\
endef
endif # SYSTEM_PYTHON
else
define gb_ExternalExecutable__register_python
$(call gb_ExternalExecutable_set_external,python,$(PYTHON_FOR_BUILD))
endef
endif # PYTHON_FOR_BUILD
ifneq ($(SYSTEM_GENBRK),)
......
......@@ -465,7 +465,6 @@ export PROGRESSTEXTCOLOR=@PROGRESSTEXTCOLOR@
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@
......
......@@ -4019,7 +4019,6 @@ if test "$cross_compiling" = "yes"; then
(
unset COM GUI GUIBASE OS CPU CPUNAME
unset CC CXX SYSBASE CFLAGS
unset PYTHON_CFLAGS PYTHON_LIBS
unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
unset CPPUNIT_CFLAGS CPPUNIT_LIBS
unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
......@@ -4066,10 +4065,10 @@ if test "$cross_compiling" = "yes"; then
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
......@@ -4106,14 +4105,12 @@ else
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)
......@@ -4126,7 +4123,6 @@ AC_SUBST(CXX_FOR_BUILD)
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)
......@@ -7262,29 +7258,42 @@ AC_SUBST(LIBXML_LIBS)
AC_SUBST(XMLLINT)
AC_SUBST([MINGW_LIBXML_DLL])
AC_SUBST([MINGW_ZLIB_DLL])
dnl ===================================================================
dnl Checks for Python
dnl ===================================================================
AC_MSG_CHECKING([which Python to use])
# =====================================================================
# Checking for a Python interpreter with version >= 2.6 needed to build LO.
# Optionally user can pass an option to configure, i. e.
# ./configure PYTHON=/usr/bin/python
# =====================================================================
# This allows a lack of system python with no error, we use internal one in that case.
AM_PATH_PYTHON([2.6],, [:])
if test "$PYTHON" != ":"; then
PYTHON_FOR_BUILD=$PYTHON
fi
AC_SUBST(PYTHON_FOR_BUILD)
# Checks for Python to use for Pyuno
AC_MSG_CHECKING([which Python to use for Pyuno])
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
if test -z $PYTHON_FOR_BUILD; then
# Python is required to build LibreOffice. 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])
AC_MSG_ERROR([Python is required at build time.])
fi
enable_python=no
AC_MSG_RESULT([none])
DISABLE_PYTHON=TRUE
;;
""|yes|auto)
if test "$DISABLE_SCRIPTING" = TRUE -a $build_os != cygwin; then
if test "$DISABLE_SCRIPTING" = TRUE -a -n $PYTHON_FOR_BUILD; then
AC_MSG_RESULT([no, overridden by --disable-scripting])
enable_python=no
DISABLE_PYTHON=TRUE
elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \) \
-a \( "$with_macosx_sdk" = 10.4 -o "$with_macosx_sdk" = 10.5 \); then
# When building against a more recent SDK the ionternal Python can't be compiled, I can't be bothered to fix that for now,
# building against a recent SDK is only for developer's own builds anyway.
AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
enable_python=internal
elif test $build_os = cygwin; then
dnl When building on Windows we don't attempt to use any installed
dnl "system" Python.
......@@ -7294,22 +7303,28 @@ no|disable)
dnl MinGW cross-compilation setups.)
AC_MSG_RESULT([internal])
enable_python=internal
elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \) \
-a \( "$with_macosx_sdk" = 10.4 -o "$with_macosx_sdk" = 10.5 \); then
# When building against a more recent SDK the ionternal Python can't be compiled, I can't be bothered to fix that for now,
# building against a recent SDK is only for developer's own builds anyway.
AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
enable_python=internal
elif test "$cross_compiling" = yes; then
AC_MSG_RESULT([system])
enable_python=system
else
AC_MSG_RESULT([checking below])
enable_python=auto
# Unset variables set by the above AM_PATH_PYTHON so that
# we actually do check anew.
unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON
AM_PATH_PYTHON([3.3],, [:])
if test "$PYTHON" = :; then
AC_MSG_RESULT([internal])
enable_python=internal
else
AC_MSG_RESULT([system])
enable_python=system
fi
fi
;;
internal)
AC_MSG_RESULT([internal])
;;
system)
if test $_os = Darwin -a -z "$PYTHON" -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
if test $_os = Darwin -a -z "$PYTHON_CFLAGS" -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then
AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno])
fi
AC_MSG_RESULT([system])
......@@ -7319,86 +7334,40 @@ system)
;;
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])
fi
if test $enable_python != no; then
BUILD_TYPE="$BUILD_TYPE PYUNO"
fi
if test "$cross_compiling" = yes; then
if test $enable_python = auto; then
enable_python=system
fi
else
if test $enable_python = system -a -z "$PYTHON"; then
if test $_os = Darwin; then
# We already have logic above to make sure the system Python
# is used only when building against SDK 10.6 or newer.
# Make sure we use the 2.6 Python when building against the
# 10.6 SDK.
case $with_macosx_sdk in
10.6)
python_version=2.6;;
10.7|10.8)
python_version=2.7;;
*)
# ???
python_version=2.7;;
esac
PYTHON=python$python_version
PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
PYTHON_LIBS="-framework Python"
else
# This causes an error if no python command is found
AM_PATH_PYTHON([3.3])
fi
elif test $enable_python = auto; then
# We should not come here in a MSVC build, I think?
if test $build_os = cygwin; then
AC_MSG_ERROR([Assertion failed - should not be here in a MSVC build])
fi
# This allows a lack of system Python 3.3 with no error, we check below for a system Python of
# earlier version.
AM_PATH_PYTHON([3.3],, [:])
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.
if test $enable_python = system; then
if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
# We already have logic above to make sure the system Python
# is used only when building against SDK 10.6 or newer.
# 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
# Make sure we use the 2.6 Python when building against the
# 10.6 SDK.
case $with_macosx_sdk in
10.6)
python_version=2.6;;
10.7|10.8)
python_version=2.7;;
*)
# ???
python_version=2.7;;
esac
PYTHON=python$python_version
PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}"
PYTHON_LIBS="-framework Python"
fi
fi
if test $enable_python = system; then
if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
# Fallback: Accept these in the environment, or as set above
# for MacOSX.
:
elif test "$cross_compiling" != yes; then
# Unset variables set by the above AM_PATH_PYTHON so that
# we actually do check anew.
unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON
# This causes an error if no python command is found
AM_PATH_PYTHON([3.3])
python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
......@@ -7500,6 +7469,7 @@ internal)
fi
;;
no)
DISABLE_PYTHON=TRUE
SYSTEM_PYTHON=NO
;;
*)
......@@ -7507,14 +7477,7 @@ no)
;;
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)
......
......@@ -50,7 +50,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
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 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
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 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
$(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)
......
......@@ -101,7 +101,7 @@ endef
#
# 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment