[Libreoffice-commits] .: 2 commits - config_host.mk.in config_host.mk.source configure.in external/mingw-dlls pyuno/CustomTarget_pyversion.mk pyuno/CustomTarget_zipcore.mk pyuno/Module_pyuno.mk pyuno/Package_zipcore.mk pyuno/zipcore scp2/InstallModule_python.mk scp2/source

David Tardon dtardon at kemper.freedesktop.org
Fri Jun 22 04:12:46 PDT 2012


 config_host.mk.in                    |    7 +++++
 config_host.mk.source                |    2 -
 configure.in                         |   48 ++++++++++++++++++++++++++---------
 external/mingw-dlls/makefile.mk      |    4 ++
 pyuno/CustomTarget_pyversion.mk      |    8 +++++
 pyuno/CustomTarget_zipcore.mk        |   15 +++++++++-
 pyuno/Module_pyuno.mk                |   17 +++++++++++-
 pyuno/Package_zipcore.mk             |    9 ++++++
 pyuno/zipcore/python.cxx             |    4 --
 scp2/InstallModule_python.mk         |    9 ++++++
 scp2/source/python/file_python.scp   |   44 +++++++++++++++++++++++++++++++-
 scp2/source/python/module_python.scp |    3 +-
 12 files changed, 149 insertions(+), 21 deletions(-)

New commits:
commit eba629deb755049bba1850c6a32008ceccb9b11e
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Jun 21 08:56:52 2012 +0200

    specify the sourced file with path
    
    "man source" says:
    
    "If filename does not contain a slash, file names  in  PATH  are used to
    find the directory containing file‐ name.  The file searched for in PATH
    need not  be  executable. When  bash  is  not  in posix  mode,  the
    current directory is searched if no file is found in PATH."
    
    Change-Id: I7dc15d30ba925c71d02da2cd8b91ea08192730fc

diff --git a/config_host.mk.source b/config_host.mk.source
index 042ffa2..10dd617 100644
--- a/config_host.mk.source
+++ b/config_host.mk.source
@@ -6,5 +6,5 @@
 
 temp_conf=`mktemp config_host.mk.XXXXXX`
 sed -e 's/^\s*\(export [A-Z0-9_]*=\)\(.*\)$/\1"\2"/' config_host.mk >$temp_conf
-source $temp_conf
+source ./$temp_conf
 rm $temp_conf
commit d712218cc0b658fae66f63c52af7996b714289c9
Author: David Ostrovsky <d.ostrovsky at gmx.de>
Date:   Mon Jun 18 00:04:19 2012 +0200

    fixing pyuno bridge on mingw: packaging system-python
    
    Change-Id: Ib46248d217b0161dc20dde0274842bd7381f0cda

diff --git a/config_host.mk.in b/config_host.mk.in
index ecc3042..fbbcfac 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 011aa22..d8ab8ab 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 5f1722a..7fe6b4a 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 8766e7e..41b26c1 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 ba22084..98e3c29 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 06356e2..723b085 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 9069a8f..3666ad7 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 cffee38..f4d3024 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 53d0891..9a2004b 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 47ab5fe..8ffc79c 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 0f15826..d379f27 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,


More information about the Libreoffice-commits mailing list