summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2011-06-06 18:21:14 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2011-06-06 19:29:37 +0200
commite9d4bad4408320425dd0916065f4a484a9393af1 (patch)
treeb9697c7143efcfa8a9151f1427c124cb0c01b69b /python
parent251b4d282b26d65ff17fd404727e9359f495b227 (diff)
allow building internal Python on Mac (needs to be built as framework)
fixes #i111496# (meta), #i111498# & #i111500# (along with the similar commits to the other repos)
Diffstat (limited to 'python')
-rw-r--r--python/Python-2.6.1-arch_i386.patch11
-rw-r--r--python/Python-2.6.1-arch_ppc.patch11
-rw-r--r--python/Python-2.6.1-py8067.patch12
-rw-r--r--python/makefile.mk63
-rw-r--r--python/prj/d.lst16
-rw-r--r--python/pyversion.mk8
6 files changed, 108 insertions, 13 deletions
diff --git a/python/Python-2.6.1-arch_i386.patch b/python/Python-2.6.1-arch_i386.patch
new file mode 100644
index 000000000000..6dca2c327abb
--- /dev/null
+++ b/python/Python-2.6.1-arch_i386.patch
@@ -0,0 +1,11 @@
+--- misc/Python-2.6.1/configure 2010-05-06 20:24:36.000000000 +0200
++++ misc/build/Python-2.6.1/configure 2010-05-06 20:25:17.000000000 +0200
+@@ -4653,7 +4653,7 @@
+ if test "${enable_universalsdk}"; then
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+- UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
++ UNIVERSAL_ARCH_FLAGS="-arch i386"
+ ARCH_RUN_32BIT=""
+
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
diff --git a/python/Python-2.6.1-arch_ppc.patch b/python/Python-2.6.1-arch_ppc.patch
new file mode 100644
index 000000000000..d4073ac9de94
--- /dev/null
+++ b/python/Python-2.6.1-arch_ppc.patch
@@ -0,0 +1,11 @@
+--- misc/Python-2.6.1/configure 2010-05-06 20:24:36.000000000 +0200
++++ misc/build/Python-2.6.1/configure 2010-05-06 20:25:17.000000000 +0200
+@@ -4653,7 +4653,7 @@
+ if test "${enable_universalsdk}"; then
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+- UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
++ UNIVERSAL_ARCH_FLAGS="-arch ppc"
+ ARCH_RUN_32BIT=""
+
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
diff --git a/python/Python-2.6.1-py8067.patch b/python/Python-2.6.1-py8067.patch
new file mode 100644
index 000000000000..7a88a9348058
--- /dev/null
+++ b/python/Python-2.6.1-py8067.patch
@@ -0,0 +1,12 @@
+http://bugs.python.org/issue8067 - needed for building on Mac OSX >= 10.6
+--- misc/Python-2.6.1/configure 2010-05-06 20:59:52.000000000 +0200
++++ misc/build/Python-2.6.1/configure 2010-05-06 20:59:46.000000000 +0200
+@@ -2120,6 +2120,8 @@
+ # has no effect, don't bother defining them
+ Darwin/[6789].*)
+ define_xopen_source=no;;
++ Darwin/1[0-9].*)
++ define_xopen_source=no;;
+ # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
+ # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
+ # or has another value. By not (re)defining it, the defaults come in place.
diff --git a/python/makefile.mk b/python/makefile.mk
index f51e7e88398f..b43147dd3943 100644
--- a/python/makefile.mk
+++ b/python/makefile.mk
@@ -40,8 +40,8 @@ TARGET=so_python
.IF "$(SYSTEM_PYTHON)" == "YES"
all:
- @echo "An already available installation of python should exist on your system."
- @echo "Therefore the version provided here does not need to be built in addition."
+ @echo "An already available installation of python should exist on your system."
+ @echo "Therefore the version provided here does not need to be built in addition."
.ENDIF
# --- Files --------------------------------------------------------
@@ -81,14 +81,27 @@ python_LDFLAGS+=$(ARCH_FLAGS)
python_CFLAGS=-g0
.ENDIF
-CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
+CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
+
.IF "$(OS)$(CPU)" == "SOLARISI"
CONFIGURE_ACTION += --disable-ipv6
.ENDIF
+
+.IF "$(OS)" == "MACOSX"
+PATCH_FILES+=Python-2.6.1-py8067.patch
+# don't build dual-arch version as OOo itself is not universal binary either
+PATCH_FILES+=Python-2.6.1-arch_$(eq,$(CPU),I i386 ppc).patch
+
+MACDEVSDK*=/Developer/SDKs/MacOSX10.4u.sdk
+CONFIGURE_ACTION+=--enable-universalsdk=$(MACDEVSDK) --with-universal-archs=32-bit --enable-framework=/python-inst --with-framework-name=OOoPython
+ALLTAR: $(MISC)/OOoPython.framework.zip
+
+.ENDIF
+
.IF "$(OS)"=="AIX"
CONFIGURE_ACTION += --disable-ipv6 --with-threads
.ENDIF
-BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
+BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install DESTDIR=$(MYCWD) && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
.ELSE
# ----------------------------------
# WINDOWS
@@ -182,9 +195,47 @@ $(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
ALLTAR : $(PYVERSIONFILE)
.ENDIF # "$(L10N_framework)"==""
+# rule to allow relocating the whole framework, removing reference to buildinstallation directory
+$(PACKAGE_DIR)/fixscripts: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
+ @echo remove build installdir from scripts
+ $(COMMAND_ECHO)for file in \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/bin/2to3 \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/bin/idle$(PYMAJOR).$(PYMINOR) \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/bin/pydoc$(PYMAJOR).$(PYMINOR) \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/bin/python$(PYMAJOR).$(PYMINOR)-config \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/bin/smtpd$(PYMAJOR).$(PYMINOR).py ; do \
+ {{ rm "$$file" && awk '\
+ BEGIN {{print "\
+#!/bin/bash\n\
+origpath=$$(pwd)\n\
+bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
+cd \"$$origpath\"\n\
+\"$$bindir/../Resources/Python.app/Contents/MacOS/OOoPython\" - $$@ <<EOF"}} \
+ FNR==1{{next}} \
+ {{print}} \
+ END {{print "EOF"}}' > "$$file" ; }} < "$$file" ; chmod +x "$$file" ; done
+ @touch $@
+
+$(PACKAGE_DIR)/fixinstallnames: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
+ @echo remove build installdir from OOoPython
+ $(COMMAND_ECHO)install_name_tool -change \
+ /python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/OOoPython \
+ @executable_path/../../../../OOoPython \
+ $(MYCWD)/python-inst/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/Resources/Python.app/Contents/MacOS/OOoPython
+ @touch $@
+
+$(MISC)/OOoPython.framework.zip: $(PACKAGE_DIR)/fixinstallnames $(PACKAGE_DIR)/fixscripts
+ @-rm -f $@
+ @echo creating $@
+ $(COMMAND_ECHO)cd $(MISC)/build/python-inst && find OOoPython.framework \
+ -not -type l -not -name Info.plist.in \
+ -not -name pythonw$(PYMAJOR).$(PYMINOR) \
+ -not -name python$(PYMAJOR).$(PYMINOR) -print0 | \
+ xargs -0 zip $(ZIP_VERBOSITY) ../../$(@:f)
$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
- -rm -f $@
- cat $? > $@
+ @-rm -f $@
+ @echo process $@
+ $(COMMAND_ECHO)sed 's#%%replaceme%%#$(MYCWD)/python-inst#g' < pyversion.mk > $@
.ENDIF # DISABLE_PYTHON != TRUE
diff --git a/python/prj/d.lst b/python/prj/d.lst
index 245ddb49a4d3..749515037664 100644
--- a/python/prj/d.lst
+++ b/python/prj/d.lst
@@ -1,3 +1,14 @@
+# MACOSX - start
+mkdir: %_DEST%\lib\OOoPython.framework\Versions\2.6\include\python2.6
+
+..\%__SRC%\misc\build\python-inst\OOoPython.framework\OOoPython %_DEST%\lib\OOoPython.framework\OOoPython
+..\%__SRC%\misc\build\python-inst\OOoPython.framework\Versions\2.6\* %_DEST%\lib\OOoPython.framework\Versions\2.6\*
+..\%__SRC%\misc\build\python-inst\OOoPython.framework\Versions\2.6\include\python2.6\* %_DEST%\lib\OOoPython.framework\Versions\2.6\include\python2.6\*
+..\%__SRC%\misc\OOoPython.framework.zip %_DEST%\bin\OOoPython.framework.zip
+# MACOSX - end
+
+..\%__SRC%\misc\pyversion.mk %_DEST%\inc\pyversion.mk
+
mkdir: %_DEST%\lib\python
mkdir: %_DEST%\lib\python\lib-old
mkdir: %_DEST%\lib\python\lib-tk
@@ -69,8 +80,6 @@ mkdir: %_DEST%\lib\python\ctypes\macholib
..\%__SRC%\misc\build\Python-2.6.1\Lib\ctypes\macholib\* %_DEST%\lib\python\ctypes\macholib\*
..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\etree\* %_DEST%\lib\python\xml\etree
-..\pyversion.mk %_DEST%\inc\pyversion.mk
-
..\%__SRC%\misc\build\Python-2.6.1\Include\* %_DEST%\inc\python\*
#unix ONLY !
@@ -81,9 +90,6 @@ mkdir: %_DEST%\lib\python\ctypes\macholib
..\%__SRC%\misc\build\python-inst\lib\libpython2.6.so.1.0 %_DEST%\lib\libpython2.6.so.1.0
symlink: %_DEST%\lib\libpython2.6.so.1.0 %_DEST%\lib\libpython2.6.so
-# MacOS X
-..\%__SRC%\misc\build\python-inst\lib\libpython2.6.dylib %_DEST%\lib\libpython2.6.dylib
-
#MingW ONLY !
..\%__SRC%\misc\build\python-inst\bin\python.exe %_DEST%\bin\python.exe
..\%__SRC%\misc\build\Python-2.6.1\libpython2.6.dll %_DEST%\bin\libpython2.6.dll
diff --git a/python/pyversion.mk b/python/pyversion.mk
index 71b5acffd278..baba53838d3f 100644
--- a/python/pyversion.mk
+++ b/python/pyversion.mk
@@ -7,11 +7,15 @@ PYVERSION=$(PYMAJOR).$(PYMINOR).$(PYMICRO)
.IF "$(GUI)" == "UNX"
.IF "$(OS)" == "MACOSX"
-PY_FULL_DLL_NAME=libpython$(PYMAJOR).$(PYMINOR).dylib
+PY_FULL_DLL_NAME=libpython$(PYMAJOR).$(PYMINOR).a
+PYTHONLIB=-F$(SOLARLIBDIR) -framework OOoPython
+CFLAGS+=-I$(SOLARLIBDIR)/OOoPython.framework/Versions/$(PYMAJOR).$(PYMINOR)/include/python$(PYMAJOR).$(PYMINOR)
+# needed to fix install_name in pyuno
+PYTHON_MAKEINSTALLDIR=%%replaceme%%
.ELSE
PY_FULL_DLL_NAME=libpython$(PYMAJOR).$(PYMINOR).so.1.0
-.ENDIF
PYTHONLIB=-lpython$(PYMAJOR).$(PYMINOR)
+.ENDIF
.ELSE
.IF "$(COM)" == "GCC"
PY_FULL_DLL_NAME=libpython$(PYMAJOR).$(PYMINOR).dll