diff options
-rw-r--r-- | config_host.mk.in | 7 | ||||
-rw-r--r-- | configure.in | 48 | ||||
-rw-r--r-- | external/mingw-dlls/makefile.mk | 4 | ||||
-rw-r--r-- | pyuno/CustomTarget_pyversion.mk | 8 | ||||
-rw-r--r-- | pyuno/CustomTarget_zipcore.mk | 15 | ||||
-rwxr-xr-x | pyuno/Module_pyuno.mk | 17 | ||||
-rw-r--r-- | pyuno/Package_zipcore.mk | 9 | ||||
-rw-r--r-- | pyuno/zipcore/python.cxx | 4 | ||||
-rw-r--r-- | scp2/InstallModule_python.mk | 9 | ||||
-rw-r--r-- | scp2/source/python/file_python.scp | 44 | ||||
-rw-r--r-- | scp2/source/python/module_python.scp | 3 |
11 files changed, 148 insertions, 20 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index ecc304292d82..fbbcfacd0e23 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -338,8 +338,13 @@ export MINGW_PIXMAN_DLL=@MINGW_PIXMAN_DLL@ export MINGW_PLC4_DLL=@MINGW_PLC4_DLL@ export MINGW_PLDS4_DLL=@MINGW_PLDS4_DLL@ export MINGW_PNG15_DLL=@MINGW_PNG15_DLL@ +export MINGW_PYTHON_DLL=@MINGW_PYTHON_DLL@ +export MINGW_PYTHON_EXE=@MINGW_PYTHON_EXE@ +export MINGW_PYTHON_MAJOR_VERSION=@MINGW_PYTHON_MAJOR_VERSION@ +export MINGW_PYVERSION=@MINGW_PYVERSION@ export MINGW_RAPTOR_DLL=@MINGW_RAPTOR_DLL@ export MINGW_RASQAL_DLL=@MINGW_RASQAL_DLL@ +export MINGW_READLINE_DLL=@MINGW_READLINE_DLL@ export MINGW_REDLAND_DLL=@MINGW_REDLAND_DLL@ export MINGW_SHARED_GCCLIB=@MINGW_SHARED_GCCLIB@ export MINGW_SHARED_GXXLIB=@MINGW_SHARED_GXXLIB@ @@ -348,7 +353,9 @@ export MINGW_SQLITE3_DLL=@MINGW_SQLITE3_DLL@ export MINGW_SSH2_DLL=@MINGW_SSH2_DLL@ export MINGW_SSL3_DLL=@MINGW_SSL3_DLL@ export MINGW_SSL_DLL=@MINGW_SSL_DLL@ +export MINGW_SYSROOT=@MINGW_SYSROOT@ export MINGW_TASN1_DLL=@MINGW_TASN1_DLL@ +export MINGW_TERMCAP_DLL=@MINGW_TERMCAP_DLL@ export MINGW_ZLIB_DLL=@MINGW_ZLIB_DLL@ export MINIZIP_CFLAGS=@MINIZIP_CFLAGS@ export MINIZIP_LIBS=@MINIZIP_LIBS@ diff --git a/configure.in b/configure.in index 011aa2202112..d8ab8abd48e2 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil -*- +2dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil -*- dnl configure.in serves as input for the GNU autoconf package dnl in order to create a configure script. @@ -4445,6 +4445,19 @@ fi AC_SUBST([VALGRIND_CFLAGS]) dnl =================================================================== +dnl Set the MinGW sys-root +dnl =================================================================== +if test "$WITH_MINGW" = "yes"; then + for sysroot in /usr/i686-w64-mingw32/sys-root/mingw; do + if test -d "$sysroot"; then + MINGW_SYSROOT="$sysroot" + break + fi + done +fi +AC_SUBST([MINGW_SYSROOT]) + +dnl =================================================================== dnl Set the MinGW include directories dnl =================================================================== if test "$WITH_MINGW" = "yes"; then @@ -6678,17 +6691,24 @@ if test $enable_python = system; then else dnl How to find out the cross-compilation Python installation path? dnl Let's hardocode what we know for different distributions for now... - - for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw; do - for python_version in 2.6; do - if test -f ${python_sysroot}/include/python${python_version}/Python.h; then - PYTHON_CFLAGS="-I${python_sysroot}/include/python$python_version" - PYTHON_LIBS="-L${python_sysroot}lib -lpython$python_version $python_libs" - break - fi - done - test -n "$PYTHON_CFLAGS" && break + for python_version in 2.6; do + if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then + PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version" + PYTHON_LIBS="-L${MINGW_SYSROOT}lib -lpython$python_version $python_libs" + MINGW_PYTHON_EXE=python.exe + libo_MINGW_CHECK_DLL([PYTHON], [libpython$python_version]) + libo_MINGW_CHECK_DLL([READLINE], [libreadline6]) + libo_MINGW_CHECK_DLL([TERMCAP], [libtermcap]) + # could we somehow extract the really mingw python version from + # actual distro package? + # 2.6.2 currently on OpenSUSE 12.1? + # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch + MINGW_PYTHON_MAJOR_VERSION="$python_version" + MINGW_PYVERSION=$python_version.2 + break + fi done + test -n "$PYTHON_CFLAGS" && break fi fi @@ -6742,6 +6762,12 @@ fi AC_SUBST(SYSTEM_PYTHON) AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LIBS) +AC_SUBST([MINGW_PYTHON_EXE]) +AC_SUBST([MINGW_PYTHON_DLL]) +AC_SUBST([MINGW_READLINE_DLL]) +AC_SUBST([MINGW_TERMCAP_DLL]) +AC_SUBST(MINGW_PYVERSION) +AC_SUBST(MINGW_PYTHON_MAJOR_VERSION) dnl =================================================================== dnl Check for system Berkeley db diff --git a/external/mingw-dlls/makefile.mk b/external/mingw-dlls/makefile.mk index 5f1722a196fe..7fe6b4aab0d2 100644 --- a/external/mingw-dlls/makefile.mk +++ b/external/mingw-dlls/makefile.mk @@ -74,17 +74,21 @@ MINGW_DLLS:= \ $(MINGW_NSS3_DLL) \ $(MINGW_NSSUTIL3_DLL) \ $(MINGW_PIXMAN_DLL) \ + $(MINGW_PYTHON_DLL) \ + $(MINGW_PYTHON_EXE) \ $(MINGW_PLC4_DLL) \ $(MINGW_PLDS4_DLL) \ $(MINGW_PNG15_DLL) \ $(MINGW_RAPTOR_DLL) \ $(MINGW_RASQAL_DLL) \ + $(MINGW_READLINE_DLL) \ $(MINGW_REDLAND_DLL) \ $(MINGW_SQLITE3_DLL) \ $(MINGW_SSH2_DLL) \ $(MINGW_SSL3_DLL) \ $(MINGW_SSL_DLL) \ $(MINGW_TASN1_DLL) \ + $(MINGW_TERMCAP_DLL) \ $(MINGW_ZLIB_DLL) .IF "$(MINGW_SHARED_GCCLIB)" == "YES" diff --git a/pyuno/CustomTarget_pyversion.mk b/pyuno/CustomTarget_pyversion.mk index 8766e7e348b9..41b26c1831da 100644 --- a/pyuno/CustomTarget_pyversion.mk +++ b/pyuno/CustomTarget_pyversion.mk @@ -29,7 +29,15 @@ $(eval $(call gb_CustomTarget_CustomTarget,pyuno/pyversion)) $(call gb_CustomTarget_get_target,pyuno/pyversion) : \ $(call gb_CustomTarget_get_workdir,pyuno/pyversion)/pyversion.hxx +# system python +ifeq ($(SYSTEM_PYTHON),YES) +# mingw: MINGW_PYVERSION is defined in configure +ifeq ($(GUI)$(COM),WNTGCC) +PYVERSION=$(MINGW_PYVERSION) +endif +else include $(OUTDIR)/inc/pyversion.Makefile +endif $(call gb_CustomTarget_get_workdir,pyuno/pyversion)/pyversion.hxx : $(SRCDIR)/pyuno/zipcore/pyversion.inc | \ $(call gb_CustomTarget_get_workdir,pyuno/pyversion)/.dir diff --git a/pyuno/CustomTarget_zipcore.mk b/pyuno/CustomTarget_zipcore.mk index ba220845b6f5..98e3c292fc2f 100644 --- a/pyuno/CustomTarget_zipcore.mk +++ b/pyuno/CustomTarget_zipcore.mk @@ -26,7 +26,18 @@ $(eval $(call gb_CustomTarget_CustomTarget,pyuno/zipcore)) +# system python (only mingw) +ifeq ($(SYSTEM_PYTHON),YES) +# mingw: MINGW_PYVERSION and MINGW_SYSROOT are defined in configure +ifeq ($(GUI)$(COM),WNTGCC) +PYVERSION=$(MINGW_PYVERSION) +pyuno_PYTHON_LIB_DIR=$(MINGW_SYSROOT)/lib/python$(MINGW_PYTHON_MAJOR_VERSION) +endif +else include $(OUTDIR)/inc/pyversion.Makefile +pyuno_PYTHON_LIB_DIR=$(OUTDIR)/lib/python +endif + pyuno_PYTHON_ARCHIVE_NAME:=python-core-$(PYVERSION).zip FIND=find GREP=grep @@ -36,12 +47,12 @@ $(call gb_CustomTarget_get_target,pyuno/zipcore) : \ # capture the files to have them in prerequisite list pyuno_zipcore_FINDLIBFILES:=\ - $(shell $(FIND) $(OUTDIR)/lib/python -type f| $(GREP) -v "\.pyc" | $(GREP) -v "\.py~" | $(GREP) -v .orig | $(GREP) -v _failed) + $(shell $(FIND) $(pyuno_PYTHON_LIB_DIR) -type f| $(GREP) -v "\.pyc" | $(GREP) -v "\.py~" | $(GREP) -v .orig | $(GREP) -v _failed) # create zip archive $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/$(pyuno_PYTHON_ARCHIVE_NAME) : $(pyuno_zipcore_FINDLIBFILES) | \ $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/.dir $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ZIP,1) - cd $(OUTDIR)/lib/python && zip $@ $(shell cd $(OUTDIR)/lib/python && $(FIND) . -type f | $(GREP) -v "\.pyc" | $(GREP) -v "\.py~" | $(GREP) -v .orig | $(GREP) -v _failed) + cd $(pyuno_PYTHON_LIB_DIR) && zip $@ $(shell cd $(pyuno_PYTHON_LIB_DIR) && $(FIND) . -type f | $(GREP) -v "\.pyc" | $(GREP) -v "\.py~" | $(GREP) -v .orig | $(GREP) -v _failed) # vim: set noet sw=4 ts=4: diff --git a/pyuno/Module_pyuno.mk b/pyuno/Module_pyuno.mk index 06356e2b491f..723b08530c32 100755 --- a/pyuno/Module_pyuno.mk +++ b/pyuno/Module_pyuno.mk @@ -41,7 +41,11 @@ $(eval $(call gb_Module_add_targets,pyuno,\ )) endif -ifneq ($(SYSTEM_PYTHON),YES) +# +# Windows: only --enable-python=internal possible +# mingw: both cases possible: internal && system +# that why it makes sense to handle the next 3 targets +# with SYSTEM_PYTHON=YES and SYSTEM_PYTHON=NO # zipcore: pyuno/python.exe on Windows # zipcore: pyversion.hxx on Windows @@ -52,6 +56,7 @@ $(eval $(call gb_Module_add_targets,pyuno,\ )) endif +ifneq ($(SYSTEM_PYTHON),YES) # zipcore: python.sh on Unix ifeq ($(GUI),UNX) @@ -76,6 +81,16 @@ $(eval $(call gb_Module_add_targets,pyuno,\ )) endif +else # SYSTEM_PYTHON + +# previous two targets has to be executed also with system-python on mingw +ifeq ($(OS)$(COM),WNTGCC) +$(eval $(call gb_Module_add_targets,pyuno,\ + CustomTarget_zipcore \ + Package_zipcore \ +)) +endif + endif # SYSTEM_PYTHON endif # DISABLE_PYTHON diff --git a/pyuno/Package_zipcore.mk b/pyuno/Package_zipcore.mk index 9069a8fdd32c..3666ad7a7252 100644 --- a/pyuno/Package_zipcore.mk +++ b/pyuno/Package_zipcore.mk @@ -26,7 +26,16 @@ $(eval $(call gb_Package_Package,python_zipcore,$(call gb_CustomTarget_get_workdir,pyuno/zipcore))) +# system python +ifeq ($(SYSTEM_PYTHON),YES) +# mingw: MINGW_PYVERSION is defined in configure +ifeq ($(GUI)$(COM),WNTGCC) +PYVERSION=$(MINGW_PYVERSION) +endif +else include $(OUTDIR)/inc/pyversion.Makefile +endif + pyuno_PYTHON_ARCHIVE_NAME:=python-core-$(PYVERSION).zip $(eval $(call gb_Package_add_file,python_zipcore,bin/$(pyuno_PYTHON_ARCHIVE_NAME),$(pyuno_PYTHON_ARCHIVE_NAME))) diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index cffee38e058b..f4d3024024b6 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -138,11 +138,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t pythonexe[MAX_PATH]; wchar_t * pythonexeEnd = tools::buildPath( pythonexe, path, pathEnd, -#ifdef __MINGW32__ - MY_STRING(L"\\python-core-" MY_PYVERSION L"\\bin\\python.bin")); -#else MY_STRING(L"\\python-core-" MY_PYVERSION L"\\bin\\python.exe")); -#endif if (pythonexeEnd == NULL) { exit(EXIT_FAILURE); } diff --git a/scp2/InstallModule_python.mk b/scp2/InstallModule_python.mk index 53d08911fba9..9a2004b405ec 100644 --- a/scp2/InstallModule_python.mk +++ b/scp2/InstallModule_python.mk @@ -40,6 +40,15 @@ else ifeq ($(SYSTEM_PYTHON),YES) $(eval $(call gb_InstallModule_add_defs,scp2/python,\ -DSYSTEM_PYTHON \ )) + +# mingw: mix mode copy file from system python to installation set +ifeq ($(GUI)$(COM),WNTGCC) +$(eval $(call gb_InstallModule_add_defs,scp2/python,\ + -DPYVERSION=$(MINGW_PYVERSION) \ + -DMINGW_SYSTEM_PYTHON \ +)) +endif + else include $(OUTDIR)/inc/pyversion.Makefile diff --git a/scp2/source/python/file_python.scp b/scp2/source/python/file_python.scp index 47ab5fecb93b..8ffc79c7c20a 100644 --- a/scp2/source/python/file_python.scp +++ b/scp2/source/python/file_python.scp @@ -310,7 +310,7 @@ Unixlink gid_Unixlink_Python_libpython Styles = (); End #endif //MACOSX -#endif +#endif //SYSTEM_PYTHON #ifdef UNX @@ -324,5 +324,47 @@ End #endif +#ifdef MINGW_SYSTEM_PYTHON + +// python_wrapper.exe +File gid_File_Py_Bin_Python + BIN_FILE_BODY; + Name = EXENAME(pyuno/python); + Dir = gid_Brand_Dir_Program; + Styles = (PACKED); +End + +Directory gid_Dir_Py_PythonCore + ParentID = gid_Brand_Dir_Program; + HostName = STRING(CONCAT2(python-core-,PYVERSION)); +End + +Directory gid_Dir_Py_PythonCore_Lib + ParentID = gid_Dir_Py_PythonCore; + HostName = "lib"; +End + +File gid_File_Py_Python_Core + TXT_FILE_BODY; + Dir = gid_Dir_Py_PythonCore_Lib; + Name = STRING(CONCAT3(python-core-,PYVERSION,.zip)); + Styles = (ARCHIVE); +End + +Directory gid_Dir_Py_PythonCore_Bin + ParentID = gid_Dir_Py_PythonCore; + HostName = bin; +End + +File gid_File_Py_Python_Bin + BIN_FILE_BODY; + Dir = gid_Dir_Py_PythonCore_Bin; + Name = EXENAME(python); + Styles = (PACKED); +End + + +#endif //MINGW_SYSTEM_PYTHON + // DISABLE_PYUNO #endif diff --git a/scp2/source/python/module_python.scp b/scp2/source/python/module_python.scp index 0f15826b90ad..d379f2744f6d 100644 --- a/scp2/source/python/module_python.scp +++ b/scp2/source/python/module_python.scp @@ -41,7 +41,8 @@ Module gid_Module_Optional_Pyuno gid_Dir_PythonFramework_Versions_ver_lib, gid_Dir_PythonFramework_Versions_ver_lib_pythonver, gid_Dir_PythonFramework_Versions_ver_lib_pythonver_config, - gid_Dir_Py_PythonCore, gid_Dir_Py_PythonCore_Bin, + gid_Dir_Py_PythonCore, + gid_Dir_Py_PythonCore_Bin, gid_Dir_Py_PythonCore_Lib); Files = (gid_File_Pyuno, gid_File_Lib_Pyuno, |