summaryrefslogtreecommitdiff
path: root/python3
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2012-11-26 20:58:16 +0100
committerMichael Stahl <mstahl@redhat.com>2012-11-26 23:14:34 +0100
commitbee01c825b77a57b39e1b6baea6b6fdf1f0052e5 (patch)
treea9d53c666957c0fd7872d3fa4e2a28b7e125a6b0 /python3
parente6f81b1898a59280f41177206b777a7a0d32f3fc (diff)
python3: build LibreOfficePython.framework on MacOS X
Change-Id: I0815aa0f5b50166f626f721be56969c0afd655a8
Diffstat (limited to 'python3')
-rw-r--r--python3/CustomTarget_PythonFramework.mk76
-rw-r--r--python3/ExternalPackage_python3.mk6
-rw-r--r--python3/ExternalProject_python3.mk6
-rw-r--r--python3/Module_python3.mk2
-rw-r--r--python3/UnpackedTarball_python3.mk3
-rw-r--r--python3/Zip_PythonFramework.mk42
6 files changed, 124 insertions, 11 deletions
diff --git a/python3/CustomTarget_PythonFramework.mk b/python3/CustomTarget_PythonFramework.mk
new file mode 100644
index 000000000000..bfeaa154688d
--- /dev/null
+++ b/python3/CustomTarget_PythonFramework.mk
@@ -0,0 +1,76 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Christian Lohmaier <lohmaier+LibreOffice@gmail.com>
+# (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_CustomTarget_CustomTarget,python3/fixscripts))
+$(eval $(call gb_CustomTarget_CustomTarget,python3/fixinstallnames))
+$(eval $(call gb_CustomTarget_CustomTarget,python3/executables))
+
+python3_fw_prefix=$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO/LibreOfficePython.framework
+
+# rule to allow relocating the whole framework, removing reference to buildinstallation directory
+$(call gb_CustomTarget_get_target,python3/fixscripts): $(call gb_ExternalProject_get_target,python3)
+ $(call gb_Output_announce,python3 - remove reference to installroot from scripts,build,CUS,5)
+ $(COMMAND_ECHO)for file in \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/2to3 \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/2to3-$(python3_PYMAJOR).$(python3_PYMINOR) \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/idle$(python3_PYMAJOR).$(python3_PYMINOR) \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/pydoc$(python3_PYMAJOR).$(python3_PYMINOR) \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/python$(python3_PYMAJOR).$(python3_PYMINOR)-config \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/python$(python3_PYMAJOR).$(python3_PYMINOR)m-config \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin/pyvenv-$(python3_PYMAJOR).$(python3_PYMINOR) ; 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/LibreOfficePython\" - $$@ <<EOF"} \
+ FNR==1{next} \
+ {print} \
+ END {print "EOF"}' > "$$file" ; } < "$$file" ; chmod +x "$$file" ; done
+ touch $@
+
+$(call gb_CustomTarget_get_target,python3/fixinstallnames): $(call gb_ExternalProject_get_target,python3)
+ $(call gb_Output_announce,python3 - fix installname,build,CUS,5)
+ install_name_tool -change \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/LibreOfficePython \
+ @executable_path/../../../../LibreOfficePython \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython
+ touch $@
+
+# also delete binaries that are symlinked in scp2
+$(call gb_CustomTarget_get_target,python3/executables): $(call gb_ExternalProject_get_target,python3)
+ $(call gb_Output_announce,python3 - fix installnames in executables,build,CUS,5)
+ cd $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/bin ; \
+ for file in python$(python3_PYMAJOR).$(python3_PYMINOR) \
+ python$(python3_PYMAJOR).$(python3_PYMINOR)m \
+ pythonw$(python3_PYMAJOR).$(python3_PYMINOR) ; do \
+ install_name_tool -change \
+ $(python3_fw_prefix)/Versions/$(python3_PYMAJOR).$(python3_PYMINOR)/LibreOfficePython \
+ @executable_path/../LibreOfficePython $$file ; done
+ touch $@
+
+# vim: set noet sw=4 ts=4:
diff --git a/python3/ExternalPackage_python3.mk b/python3/ExternalPackage_python3.mk
index 7138a60c872e..ef6fe4256ff1 100644
--- a/python3/ExternalPackage_python3.mk
+++ b/python3/ExternalPackage_python3.mk
@@ -39,16 +39,10 @@ else ifeq ($(OS),WNT) # MinGW
$(eval $(call gb_ExternalPackage_add_file,python3,bin/python.exe,python.exe))
$(eval $(call gb_ExternalPackage_add_file,python3,bin/python3.dll,python3.dll))
else
-ifeq ($(OS),MACOSX)
-# TODO what is this?
-$(eval $(call gb_ExternalPackage_add_file,python3,lib/OOoPython.framework/OOoPython,python))
-$(eval $(call gb_ExternalPackage_add_file,python3,lib/OOoPython.framework/Versions/2.6,OOoPython.framework/Versions/2.6))
-else # ELF UNIX
$(eval $(call gb_ExternalPackage_add_file,python3,bin/python,python))
$(eval $(call gb_ExternalPackage_add_file,python3,lib/libpython3.so,libpython3.so))
$(eval $(call gb_ExternalPackage_add_file,python3,lib/libpython3.3m.so,libpython3.3m.so))
# versioned lib/libpython3.3m.so.1.0 appears to be unnecessary?
-endif
# Unfortunately the python build system does not allow to explicitly enable or
# disable these, it just tries to build them and then prints which did not
diff --git a/python3/ExternalProject_python3.mk b/python3/ExternalProject_python3.mk
index af3653d8fce2..85bbf8eb6dad 100644
--- a/python3/ExternalProject_python3.mk
+++ b/python3/ExternalProject_python3.mk
@@ -59,11 +59,11 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
--with-system-expat \
$(if $(strip $(VALGRIND_CFLAGS)),--with-valgrind) \
- --prefix=/$(if $(filter MACOSX,$(OS)),@__________________________________________________OOO,python-inst) \
+ --prefix=/python-inst \
$(if $(filter AIX,$(OS)),--disable-ipv6 --with-threads CFLAGS="-g0") \
$(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \
$(if $(filter MACOSX,$(OS)), \
- --enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit --enable-framework=/SomeDirThatIsNotLibraryOrSystemOrFrameworks --with-framework-name=LibreOfficePython, \
+ --enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
--enable-shared \
) \
CC="$(strip $(CC) \
@@ -78,7 +78,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(filter WNT-GCC,$(OS)-$(COM)), -shared-libgcc \
$(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 -Wl$(COMMA)--export-all-symbols)) \
)" \
- && MAKEFLAGS=$(if $(VERBOSE)$(verbose),,s) $(MAKE) \
+ && MAKEFLAGS=$(if $(VERBOSE)$(verbose),,s) $(MAKE) $(if $(filter MACOSX,$(OS)), DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
&& ln -s build/lib.* LO_lib \
&& touch $@
diff --git a/python3/Module_python3.mk b/python3/Module_python3.mk
index 336357c0215f..e9da887f6b7a 100644
--- a/python3/Module_python3.mk
+++ b/python3/Module_python3.mk
@@ -15,8 +15,8 @@ ifeq ($(SYSTEM_PYTHON),NO)
$(eval $(call gb_Module_add_targets,python3,\
UnpackedTarball_python3 \
ExternalProject_python3 \
- ExternalPackage_python3 \
Package_python3_mk \
+ $(if $(filter MACOSX,$(OS)),Zip_PythonFramework CustomTarget_PythonFramework,ExternalPackage_python3) \
))
endif
diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index d519d66027d1..d235e0accce8 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -11,7 +11,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,python3))
#FIXME configure
PYTHON3_TARBALL := b3b2524f72409d919a4137826a870a8f-Python-3.3.0.tar.bz2
-
+python3_PYMAJOR=3
+python3_PYMINOR=3
$(eval $(call gb_UnpackedTarball_set_tarball,python3,$(PYTHON3_TARBALL)))
$(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
diff --git a/python3/Zip_PythonFramework.mk b/python3/Zip_PythonFramework.mk
new file mode 100644
index 000000000000..18fc24a698f2
--- /dev/null
+++ b/python3/Zip_PythonFramework.mk
@@ -0,0 +1,42 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Christian Lohmaier <lohmaier+LibreOffice@gmail.com>
+# (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Zip_Zip,LibreOfficePython.framework,$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO))
+
+$(eval $(call gb_Zip_add_dependencies,LibreOfficePython.framework,\
+ $(call gb_CustomTarget_get_target,python3/fixscripts) \
+ $(call gb_CustomTarget_get_target,python3/fixinstallnames) \
+ $(call gb_CustomTarget_get_target,python3/executables) \
+))
+
+$(eval $(call gb_Zip_add_file,LibreOfficePython.framework,LibreOfficePython.framework))
+
+# preserve links to not duplicate stuff in the zip...
+# links are not preserved when unpacking, need to be created in scp2
+$(eval $(call gb_Zip_add_commandoptions,LibreOfficePython.framework,-y))
+
+# vim: set noet sw=4 ts=4: