bump product version to 4.1.6.2
[LibreOffice.git] / python3 / ExternalProject_python3.mk
blobf672d71d3c168fd4158704307990b0bb8e2f0845
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 $(eval $(call gb_ExternalProject_ExternalProject,python3))
12 $(eval $(call gb_ExternalProject_use_externals,python3,\
13 expat \
14 openssl \
15 zlib \
18 $(eval $(call gb_ExternalProject_register_targets,python3,\
19 build \
20 $(if $(filter MACOSX,$(OS)),\
21 fixscripts \
22 fixinstallnames \
23 executables \
24 ) \
27 ifeq ($(OS)$(COM),WNTMSC)
29 # TODO: using Debug configuration and related mangling of pyconfig.h
31 # at least for MSVC 2008 it is necessary to clear MAKEFLAGS because
32 # nmake is invoked
33 $(call gb_ExternalProject_get_state_target,python3,build) :
34 ifeq ($(VCVER),110)
35 $(call gb_ExternalProject_run,build,\
36 MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
37 /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
38 /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
39 /p:PlatformToolset=v110 /p:VisualStudioVersion=11.0 \
40 && cd $(EXTERNAL_WORKDIR) \
41 && ln -s PCbuild LO_lib \
42 ,PCBuild)
43 else ifeq ($(VCVER),100)
44 $(call gb_ExternalProject_run,build,\
45 MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
46 /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
47 /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
48 /ToolsVersion:4.0 \
49 && cd $(EXTERNAL_WORKDIR) \
50 && ln -s PCbuild LO_lib \
51 ,PCBuild)
52 else ifeq ($(VCVER),90)
53 $(call gb_ExternalProject_run,build,\
54 MAKEFLAGS= $(COMPATH)/vcpackages/vcbuild.exe pcbuild.sln \
55 "$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)|$(if $(filter INTEL,$(CPUNAME)),Win32,x64)" \
56 && cd $(EXTERNAL_WORKDIR) \
57 && ln -s PC/VS9.0 LO_lib \
58 ,PC/VS9.0)
59 endif
61 else
63 # this was added in 2004, hopefully is obsolete now (and why only intel anyway)? $(if $(filter SOLARIS-INTEL,$(OS)$(CPUNAME)),--disable-ipv6)
65 # --with-system-expat: this should find the one in the solver (or system)
67 # create a symlink "LO_lib" because the .so are in a directory with platform
68 # specific name like build/lib.linux-x86_64-3.3
70 python3_cflags = $(ZLIB_CFLAGS)
71 ifeq ($(ENABLE_VALGRIND),TRUE)
72 python3_cflags += $(VALGRIND_CFLAGS)
73 endif
75 $(call gb_ExternalProject_get_state_target,python3,build) :
76 $(call gb_ExternalProject_run,build,\
77 ./configure \
78 $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
79 $(if $(filter TRUE,$(ENABLE_VALGRIND)),--with-valgrind) \
80 --prefix=/python-inst \
81 $(if $(filter MACOSX,$(OS)),,--with-system-expat) \
82 $(if $(filter AIX,$(OS)),--disable-ipv6 --with-threads \
83 OPT="-g0 -fwrapv -O3 -Wall") \
84 $(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \
85 $(if $(filter MACOSX,$(OS)), \
86 $(if $(filter INTEL POWERPC,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit) --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
87 --enable-shared \
88 ) \
89 CC="$(strip $(CC) \
90 $(if $(filter NO,$(SYSTEM_OPENSSL)),-I$(call gb_UnpackedTarball_get_dir,openssl)/include) \
91 $(if $(and $(filter NO,$(SYSTEM_OPENSSL)), $(filter-out YES,$(DISABLE_OPENSSL))),-I$(call gb_UnpackedTarball_get_dir,openssl)/include) \
92 $(if $(filter NO,$(SYSTEM_EXPAT)),-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
93 $(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
94 )" \
95 $(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
96 LDFLAGS="$(strip $(LDFLAGS) \
97 $(if $(filter YES,$(SYSTEM_OPENSSL)),, -L$(OUTDIR)/lib) \
98 $(if $(filter YES,$(SYSTEM_EXPAT)),, -L$(OUTDIR)/lib) \
99 $(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
100 $(if $(filter WNT-GCC,$(OS)-$(COM)), -shared-libgcc \
101 $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 -Wl$(COMMA)--export-all-symbols)) \
102 )" \
103 && MAKEFLAGS= $(MAKE) \
104 $(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
105 && ln -s build/lib.* LO_lib \
108 endif
110 ifeq ($(OS),MACOSX)
112 python3_fw_prefix=$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO/LibreOfficePython.framework
114 # rule to allow relocating the whole framework, removing reference to buildinstallation directory
115 $(call gb_ExternalProject_get_state_target,python3,fixscripts) : $(call gb_ExternalProject_get_state_target,python3,build)
116 $(call gb_Output_announce,python3 - remove reference to installroot from scripts,build,CUS,5)
117 $(COMMAND_ECHO)for file in \
118 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3 \
119 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
120 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/idle$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
121 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pydoc$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
122 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)-config \
123 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m-config \
124 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pyvenv-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; do \
125 { rm "$$file" && awk '\
126 BEGIN {print "#!/bin/bash\n\
127 origpath=$$(pwd)\n\
128 bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
129 cd \"$$origpath\"\n\
130 \"$$bindir/../Resources/Python.app/Contents/MacOS/LibreOfficePython\" - $$@ <<EOF"} \
131 FNR==1{next} \
132 {print} \
133 END {print "EOF"}' > "$$file" ; } < "$$file" ; chmod +x "$$file" ; done
134 touch $@
136 $(call gb_ExternalProject_get_state_target,python3,fixinstallnames) : $(call gb_ExternalProject_get_state_target,python3,build)
137 install_name_tool -change \
138 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
139 @executable_path/../../../../LibreOfficePython \
140 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython
141 touch $@
143 # also delete binaries that are symlinked in scp2
144 $(call gb_ExternalProject_get_state_target,python3,executables) : $(call gb_ExternalProject_get_state_target,python3,build)
145 cd $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin ; \
146 for file in python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
147 python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m \
148 pythonw$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; do \
149 install_name_tool -change \
150 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
151 @executable_path/../LibreOfficePython $$file ; done
152 touch $@
154 endif
156 # vim: set noet sw=4 ts=4: