python3: build LibreOfficePython.framework on MacOS X

Change-Id: I0815aa0f5b50166f626f721be56969c0afd655a8
This commit is contained in:
Christian Lohmaier 2012-11-26 20:58:16 +01:00 committed by Michael Stahl
parent e6f81b1898
commit bee01c825b
7 changed files with 125 additions and 11 deletions

View File

@ -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:

View File

@ -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/python.exe,python.exe))
$(eval $(call gb_ExternalPackage_add_file,python3,bin/python3.dll,python3.dll)) $(eval $(call gb_ExternalPackage_add_file,python3,bin/python3.dll,python3.dll))
else 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,bin/python,python))
$(eval $(call gb_ExternalPackage_add_file,python3,lib/libpython3.so,libpython3.so)) $(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)) $(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? # versioned lib/libpython3.3m.so.1.0 appears to be unnecessary?
endif
# Unfortunately the python build system does not allow to explicitly enable or # 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 # disable these, it just tries to build them and then prints which did not

View File

@ -59,11 +59,11 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
--with-system-expat \ --with-system-expat \
$(if $(strip $(VALGRIND_CFLAGS)),--with-valgrind) \ $(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 AIX,$(OS)),--disable-ipv6 --with-threads CFLAGS="-g0") \
$(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \ $(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \
$(if $(filter MACOSX,$(OS)), \ $(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 \ --enable-shared \
) \ ) \
CC="$(strip $(CC) \ 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 WNT-GCC,$(OS)-$(COM)), -shared-libgcc \
$(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 -Wl$(COMMA)--export-all-symbols)) \ $(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 \ && ln -s build/lib.* LO_lib \
&& touch $@ && touch $@

View File

@ -15,8 +15,8 @@ ifeq ($(SYSTEM_PYTHON),NO)
$(eval $(call gb_Module_add_targets,python3,\ $(eval $(call gb_Module_add_targets,python3,\
UnpackedTarball_python3 \ UnpackedTarball_python3 \
ExternalProject_python3 \ ExternalProject_python3 \
ExternalPackage_python3 \
Package_python3_mk \ Package_python3_mk \
$(if $(filter MACOSX,$(OS)),Zip_PythonFramework CustomTarget_PythonFramework,ExternalPackage_python3) \
)) ))
endif endif

View File

@ -11,7 +11,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,python3))
#FIXME configure #FIXME configure
PYTHON3_TARBALL := b3b2524f72409d919a4137826a870a8f-Python-3.3.0.tar.bz2 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_set_tarball,python3,$(PYTHON3_TARBALL)))
$(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\ $(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\

View File

@ -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:

View File

@ -332,6 +332,7 @@ sub check_logfile
$compareline =~ s/Error\.idl//g; # removing all occurrences of "Error.idl" $compareline =~ s/Error\.idl//g; # removing all occurrences of "Error.idl"
$compareline =~ s/Error\.html//g; # removing all occurrences of "Error.html" $compareline =~ s/Error\.html//g; # removing all occurrences of "Error.html"
$compareline =~ s/error\.py//g; # removing all occurrences of "error.py" $compareline =~ s/error\.py//g; # removing all occurrences of "error.py"
$compareline =~ s/error\.cpython-33\.py[oc]//g; # removing all occurrences of "error-cpython"
$compareline =~ s/libgpg-error-0.dll//g; $compareline =~ s/libgpg-error-0.dll//g;
if ( $compareline =~ /\bError\b/i ) if ( $compareline =~ /\bError\b/i )