#i111498# - python framework support (allow internal Python on Mac OSX) diff -r 31b6df9e33ce python/Python-2.6.1-arch_i386.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/Python-2.6.1-arch_i386.patch Mon May 10 19:34:29 2010 +0200 @@ -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 +@@ -4645,7 +4645,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 -r 31b6df9e33ce python/Python-2.6.1-arch_ppc.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/Python-2.6.1-arch_ppc.patch Mon May 10 19:34:29 2010 +0200 @@ -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 +@@ -4645,7 +4645,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 -r 31b6df9e33ce python/Python-2.6.1-py8067.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/Python-2.6.1-py8067.patch Mon May 10 19:34:29 2010 +0200 @@ -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 +@@ -2118,6 +2118,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 -r 31b6df9e33ce python/Python-2.6.1.patch --- a/python/Python-2.6.1.patch Mon May 10 18:15:30 2010 +0200 +++ b/python/Python-2.6.1.patch Mon May 10 19:34:29 2010 +0200 @@ -143,9 +143,9 @@ s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. ---- misc/Python-2.6.1/Python/thread_pthread.h.orig 2006-06-13 16:04:24.000000000 +0100 -+++ misc/build/Python-2.6.1/Python/thread_pthread.h 2009-03-12 10:55:49.000000000 +0000 -@@ -26,13 +26,18 @@ +--- misc/Python-2.6.1/Python/thread_pthread.h 2006-06-13 17:04:24.000000000 +0200 ++++ misc/build/Python-2.6.1/Python/thread_pthread.h 2010-05-09 23:06:26.000000000 +0200 +@@ -26,6 +26,10 @@ #endif #endif @@ -156,16 +156,7 @@ /* The POSIX spec says that implementations supporting the sem_* family of functions must indicate this by defining _POSIX_SEMAPHORES. */ - #ifdef _POSIX_SEMAPHORES - /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so - we need to add 0 to make it work there as well. */ --#if (_POSIX_SEMAPHORES+0) == -1 -+#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \ -+ (_POSIX_SEMAPHORES+0) == -1 - #define HAVE_BROKEN_POSIX_SEMAPHORES - #else - #include -@@ -44,7 +49,6 @@ +@@ -44,7 +48,6 @@ in default setting. So the process scope is preferred to get enough number of threads to work. */ #ifdef __FreeBSD__ @@ -173,7 +164,7 @@ #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101 #undef PTHREAD_SYSTEM_SCHED_SUPPORTED #endif -@@ -149,6 +153,9 @@ +@@ -149,6 +152,9 @@ { pthread_t th; int status; @@ -183,7 +174,7 @@ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) pthread_attr_t attrs; #endif -@@ -177,7 +184,10 @@ +@@ -177,7 +183,10 @@ #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); #endif @@ -195,7 +186,7 @@ status = pthread_create(&th, #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) &attrs, -@@ -188,6 +198,9 @@ +@@ -188,6 +197,9 @@ (void *)arg ); diff -r 31b6df9e33ce python/makefile.mk --- a/python/makefile.mk Mon May 10 18:15:30 2010 +0200 +++ b/python/makefile.mk Mon May 10 19:34:29 2010 +0200 @@ -76,9 +76,22 @@ .ENDIF CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/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=$(MYCWD)/python-inst --with-framework-name=OOoPython +ALLTAR: $(MISC)/OOoPython.framework.zip + +.ENDIF + BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include .ELSE # ---------------------------------- @@ -149,8 +162,15 @@ ALLTAR : $(PYVERSIONFILE) .ENDIF # "$(L10N_framework)"=="" +$(PACKAGE_DIR)/fixinstallnames: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) + install_name_tool -change $(MYCWD)/python-inst/OOoPython.framework/Versions/2.6/OOoPython @executable_path/../../../../OOoPython $(MYCWD)/python-inst/OOoPython.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/OOoPython + touch $@ + +$(MISC)/OOoPython.framework.zip: $(PACKAGE_DIR)/fixinstallnames + -rm -f $@ + cd $(MISC)/build/python-inst && find OOoPython.framework -not -type l -print0 | xargs -0 zip ../../$(@:f) $(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) -rm -f $@ - cat $? > $@ + sed 's#%%replaceme%%#$(MYCWD)/python-inst#g' < pyversion.mk > $@ diff -r 31b6df9e33ce python/prj/d.lst --- a/python/prj/d.lst Mon May 10 18:15:30 2010 +0200 +++ b/python/prj/d.lst Mon May 10 19:34:29 2010 +0200 @@ -1,3 +1,14 @@ +# MACOSX - start +mkdir: %_DEST%\lib%_EXT%\OOoPython.framework\Versions\2.6\include\python2.6 + +..\%__SRC%\misc\build\python-inst\OOoPython.framework\OOoPython %_DEST%\lib%_EXT%\OOoPython.framework\OOoPython +..\%__SRC%\misc\build\python-inst\OOoPython.framework\Versions\2.6\* %_DEST%\lib%_EXT%\OOoPython.framework\Versions\2.6\* +..\%__SRC%\misc\build\python-inst\OOoPython.framework\Versions\2.6\include\python2.6\* %_DEST%\lib%_EXT%\OOoPython.framework\Versions\2.6\include\python2.6\* +..\%__SRC%\misc\OOoPython.framework.zip %_DEST%\bin%_EXT%\OOoPython.framework.zip +# MACOSX - end + +..\%__SRC%\misc\pyversion.mk %_DEST%\inc%_EXT%\pyversion.mk + mkdir: %_DEST%\lib%_EXT%\python mkdir: %_DEST%\lib%_EXT%\python\lib-old mkdir: %_DEST%\lib%_EXT%\python\lib-tk @@ -69,8 +80,6 @@ ..\%__SRC%\misc\build\Python-2.6.1\Lib\ctypes\macholib\* %_DEST%\lib%_EXT%\python\ctypes\macholib\* ..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\etree\* %_DEST%\lib%_EXT%\python\xml\etree -..\pyversion.mk %_DEST%\inc%_EXT%\pyversion.mk - ..\%__SRC%\misc\build\Python-2.6.1\Include\* %_DEST%\inc%_EXT%\python\* #unix ONLY ! @@ -81,8 +90,6 @@ ..\%__SRC%\misc\build\python-inst\lib\libpython2.6.so.1.0 %_DEST%\lib%_EXT%\libpython2.6.so.1.0 symlink: %_DEST%\lib%_EXT%\libpython2.6.so.1.0 %_DEST%\lib%_EXT%\libpython2.6.so -# MacOS X -..\%__SRC%\misc\build\python-inst\lib\libpython2.6.dylib %_DEST%\lib%_EXT%\libpython2.6.dylib #MingW ONLY ! ..\%__SRC%\misc\build\python-inst\bin\python.exe %_DEST%\bin%_EXT%\python.exe diff -r 31b6df9e33ce python/pyversion.mk --- a/python/pyversion.mk Mon May 10 18:15:30 2010 +0200 +++ b/python/pyversion.mk Mon May 10 19:34:29 2010 +0200 @@ -7,11 +7,15 @@ .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 +PYTHONLIB=-lpython$(PYMAJOR).$(PYMINOR) .ENDIF -PYTHONLIB=-lpython$(PYMAJOR).$(PYMINOR) .ELIF "$(GUI)" == "OS2" PY_FULL_DLL_NAME=python$(PYMAJOR)$(PYMINOR).dll PYTHONLIB=python$(PYMAJOR)$(PYMINOR).lib