fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / external / python3 / ExternalProject_python3.mk
blob29179d5c03b985eb9cfd7ec9a4d00fb29360727a
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 $(call gb_ExternalProject_run,build,\
35 MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
36 /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
37 /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
38 $(if $(filter 110,$(VCVER)),/p:PlatformToolset=$(if $(filter 80,$(WINDOWS_SDK_VERSION)),v110,v110_xp) \
39 /p:VisualStudioVersion=11.0) \
40 $(if $(filter 120,$(VCVER)),/p:PlatformToolset=v120 \
41 /p:VisualStudioVersion=12.0 /ToolsVersion:12.0) \
42 ,PCBuild)
44 else
46 # this was added in 2004, hopefully is obsolete now (and why only intel anyway)? $(if $(filter SOLARIS-INTEL,$(OS)$(CPUNAME)),--disable-ipv6)
48 # --with-system-expat: this should find the one in the solver (or system)
50 # create a symlink "LO_lib" because the .so are in a directory with platform
51 # specific name like build/lib.linux-x86_64-3.3
53 python3_cflags = $(ZLIB_CFLAGS)
54 ifneq (,$(ENABLE_VALGRIND))
55 python3_cflags += $(VALGRIND_CFLAGS)
56 endif
58 $(call gb_ExternalProject_get_state_target,python3,build) :
59 $(call gb_ExternalProject_run,build,\
60 ./configure \
61 $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
62 $(if $(ENABLE_VALGRIND),--with-valgrind) \
63 --prefix=/python-inst \
64 $(if $(filter MACOSX,$(OS)),,--with-system-expat) \
65 $(if $(filter AIX,$(OS)), \
66 --disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall", \
67 $(if $(gb_Module_CURRENTMODULE_DEBUG_ENABLED), \
68 OPT="$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS)")) \
69 $(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \
70 $(if $(filter MACOSX,$(OS)), \
71 $(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) \
72 --with-universal-archs=intel \
73 ) \
74 --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
75 --enable-shared \
76 ) \
77 CC="$(strip $(CC) \
78 $(if $(SYSTEM_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include \
79 $(if $(DISABLE_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include)) \
80 $(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
81 $(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
82 )" \
83 $(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
84 $(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX)") \
85 LDFLAGS="$(strip $(LDFLAGS) \
86 $(if $(SYSTEM_OPENSSL),,-L$(call gb_UnpackedTarball_get_dir,openssl)) \
87 $(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
88 $(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
89 $(if $(filter WNT-GCC,$(OS)-$(COM)), -shared-libgcc \
90 $(if $(MINGW_SHARED_GCCLIB),-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 -Wl$(COMMA)--export-all-symbols)) \
91 $(gb_LTOFLAGS) \
92 )" \
93 && MAKEFLAGS= $(MAKE) \
94 $(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
95 && ln -s build/lib.* LO_lib \
98 endif
100 ifeq ($(OS),MACOSX)
102 python3_fw_prefix=$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO/LibreOfficePython.framework
104 # rule to allow relocating the whole framework, removing reference to buildinstallation directory
105 $(call gb_ExternalProject_get_state_target,python3,fixscripts) : $(call gb_ExternalProject_get_state_target,python3,build)
106 $(call gb_Output_announce,python3 - remove reference to installroot from scripts,build,CUS,5)
107 $(COMMAND_ECHO)for file in \
108 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3 \
109 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
110 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/idle$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
111 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pydoc$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
112 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)-config \
113 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m-config \
114 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pyvenv-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; do \
115 { rm "$$file" && $(gb_AWK) '\
116 BEGIN {print "#!/bin/bash\n\
117 origpath=$$(pwd)\n\
118 bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
119 cd \"$$origpath\"\n\
120 \"$$bindir/../Resources/Python.app/Contents/MacOS/LibreOfficePython\" - $$@ <<EOF"} \
121 FNR==1{next} \
122 {print} \
123 END {print "EOF"}' > "$$file" ; } < "$$file" ; chmod +x "$$file" ; done
124 touch $@
126 $(call gb_ExternalProject_get_state_target,python3,fixinstallnames) : $(call gb_ExternalProject_get_state_target,python3,build)
127 $(INSTALL_NAME_TOOL) -change \
128 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
129 @executable_path/../../../../LibreOfficePython \
130 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython
131 for file in $(shell find $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload -name "*.so") ; do \
132 $(INSTALL_NAME_TOOL) -change \
133 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
134 @loader_path/../../../LibreOfficePython $$file ; done
135 touch $@
137 # also delete binaries that are symlinked in scp2
138 $(call gb_ExternalProject_get_state_target,python3,executables) : $(call gb_ExternalProject_get_state_target,python3,build)
139 cd $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin ; \
140 for file in python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
141 python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m \
142 pythonw$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; do \
143 $(INSTALL_NAME_TOOL) -change \
144 $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
145 @executable_path/../LibreOfficePython $$file ; done
146 touch $@
148 endif
150 # vim: set noet sw=4 ts=4: