2012-11-17 00:39:31 +01:00
|
|
|
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
|
|
|
#
|
|
|
|
# This file is part of the LibreOffice project.
|
|
|
|
#
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
#
|
|
|
|
|
2013-05-06 23:46:30 +02:00
|
|
|
$(eval $(call gb_ExternalProject_ExternalProject,python3))
|
2012-11-17 00:39:31 +01:00
|
|
|
|
2012-12-28 11:19:06 -05:00
|
|
|
$(eval $(call gb_ExternalProject_use_externals,python3,\
|
|
|
|
expat \
|
|
|
|
openssl \
|
2013-05-08 14:23:35 +02:00
|
|
|
zlib \
|
2012-12-28 11:19:06 -05:00
|
|
|
))
|
2012-11-17 00:39:31 +01:00
|
|
|
|
|
|
|
$(eval $(call gb_ExternalProject_register_targets,python3,\
|
|
|
|
build \
|
2013-05-04 14:50:51 +02:00
|
|
|
$(if $(filter MACOSX,$(OS)),\
|
|
|
|
fixscripts \
|
|
|
|
fixinstallnames \
|
|
|
|
executables \
|
|
|
|
) \
|
2012-11-17 00:39:31 +01:00
|
|
|
))
|
|
|
|
|
|
|
|
ifeq ($(OS)$(COM),WNTMSC)
|
|
|
|
|
|
|
|
# TODO: using Debug configuration and related mangling of pyconfig.h
|
|
|
|
|
|
|
|
# at least for MSVC 2008 it is necessary to clear MAKEFLAGS because
|
|
|
|
# nmake is invoked
|
|
|
|
$(call gb_ExternalProject_get_state_target,python3,build) :
|
2013-02-21 08:15:39 -06:00
|
|
|
$(call gb_ExternalProject_run,build,\
|
adapt all externals to build against MSVC debug runtime
Add patches and/or tweaks to the following modules:
curl, cppunit, icu, lcms2, libxml2, libxslt, libxmlsec,
lpsolve, nss, openssl, python3
lcms2 has an inconsistency where the .lib and the .dll don't agree on
the .dll name.
openssl gets a honorable mention because apparently it's undocumented
custom build system can build with /MDd if one picks the right
configuration but i couldn't figure out how to do that in an hour of
trying, and just patched the release config instead.
Change-Id: I7854a0fc85247e398d561b4f513d09fe2d1ebb3c
2013-04-14 13:52:56 +02:00
|
|
|
MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
|
|
|
|
/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
|
|
|
|
/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
|
2013-06-04 17:20:44 +02:00
|
|
|
$(if $(filter 100,$(VCVER)), \
|
|
|
|
/ToolsVersion:4.0, \
|
|
|
|
/p:PlatformToolset=v110 /p:VisualStudioVersion=11.0) \
|
2013-02-21 08:15:39 -06:00
|
|
|
&& cd $(EXTERNAL_WORKDIR) \
|
|
|
|
&& ln -s PCbuild LO_lib \
|
|
|
|
,PCBuild)
|
2012-11-17 00:39:31 +01:00
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# this was added in 2004, hopefully is obsolete now (and why only intel anyway)? $(if $(filter SOLARIS-INTEL,$(OS)$(CPUNAME)),--disable-ipv6)
|
|
|
|
|
|
|
|
# --with-system-expat: this should find the one in the solver (or system)
|
|
|
|
|
|
|
|
# create a symlink "LO_lib" because the .so are in a directory with platform
|
|
|
|
# specific name like build/lib.linux-x86_64-3.3
|
|
|
|
|
2013-05-08 14:23:35 +02:00
|
|
|
python3_cflags = $(ZLIB_CFLAGS)
|
2013-10-10 09:55:31 +03:00
|
|
|
ifneq (,$(ENABLE_VALGRIND))
|
2012-11-27 15:35:02 +01:00
|
|
|
python3_cflags += $(VALGRIND_CFLAGS)
|
|
|
|
endif
|
|
|
|
|
2012-11-17 00:39:31 +01:00
|
|
|
$(call gb_ExternalProject_get_state_target,python3,build) :
|
2013-02-21 08:15:39 -06:00
|
|
|
$(call gb_ExternalProject_run,build,\
|
|
|
|
./configure \
|
2012-11-17 00:39:31 +01:00
|
|
|
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
|
2013-10-10 09:55:31 +03:00
|
|
|
$(if $(ENABLE_VALGRIND),--with-valgrind) \
|
2012-11-26 20:58:16 +01:00
|
|
|
--prefix=/python-inst \
|
2013-04-20 17:41:34 -05:00
|
|
|
$(if $(filter MACOSX,$(OS)),,--with-system-expat) \
|
2013-08-28 10:04:08 +02:00
|
|
|
$(if $(filter AIX,$(OS)), \
|
|
|
|
--disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall", \
|
|
|
|
$(if $(gb_Module_CURRENTMODULE_DEBUG_ENABLED), \
|
|
|
|
OPT="$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS)")) \
|
2012-11-17 00:39:31 +01:00
|
|
|
$(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \
|
2012-11-17 14:34:52 +02:00
|
|
|
$(if $(filter MACOSX,$(OS)), \
|
2013-01-02 17:51:37 +02:00
|
|
|
$(if $(filter INTEL POWERPC,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit) --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
|
2012-11-17 14:34:52 +02:00
|
|
|
--enable-shared \
|
|
|
|
) \
|
2012-11-17 00:39:31 +01:00
|
|
|
CC="$(strip $(CC) \
|
2014-02-11 15:57:18 +01:00
|
|
|
$(if $(SYSTEM_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include \
|
2013-08-31 18:55:53 -05:00
|
|
|
$(if $(DISABLE_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include)) \
|
2013-05-07 21:47:18 +02:00
|
|
|
$(if $(filter NO,$(SYSTEM_EXPAT)),-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
|
2012-11-17 00:39:31 +01:00
|
|
|
$(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
|
|
|
|
)" \
|
2012-11-27 15:35:02 +01:00
|
|
|
$(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
|
2012-11-17 00:39:31 +01:00
|
|
|
LDFLAGS="$(strip $(LDFLAGS) \
|
2014-02-11 15:57:18 +01:00
|
|
|
$(if $(SYSTEM_OPENSSL),,-L$(call gb_UnpackedTarball_get_dir,openssl)) \
|
2013-09-19 19:28:36 +02:00
|
|
|
$(if $(filter YES,$(SYSTEM_EXPAT)),, -L$(gb_StaticLibrary_WORKDIR)) \
|
2012-11-17 00:39:31 +01:00
|
|
|
$(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
|
|
|
|
$(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)) \
|
|
|
|
)" \
|
2013-04-18 22:00:55 +02:00
|
|
|
&& MAKEFLAGS= $(MAKE) \
|
|
|
|
$(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
|
2013-02-21 08:15:39 -06:00
|
|
|
&& ln -s build/lib.* LO_lib \
|
|
|
|
)
|
2012-11-17 00:39:31 +01:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-05-04 14:50:51 +02:00
|
|
|
ifeq ($(OS),MACOSX)
|
|
|
|
|
|
|
|
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_ExternalProject_get_state_target,python3,fixscripts) : $(call gb_ExternalProject_get_state_target,python3,build)
|
|
|
|
$(call gb_Output_announce,python3 - remove reference to installroot from scripts,build,CUS,5)
|
|
|
|
$(COMMAND_ECHO)for file in \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3 \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/idle$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pydoc$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)-config \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m-config \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pyvenv-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; 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_ExternalProject_get_state_target,python3,fixinstallnames) : $(call gb_ExternalProject_get_state_target,python3,build)
|
2013-09-13 22:01:26 +02:00
|
|
|
$(INSTALL_NAME_TOOL) -change \
|
2013-05-04 14:50:51 +02:00
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
|
|
|
|
@executable_path/../../../../LibreOfficePython \
|
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
# also delete binaries that are symlinked in scp2
|
|
|
|
$(call gb_ExternalProject_get_state_target,python3,executables) : $(call gb_ExternalProject_get_state_target,python3,build)
|
|
|
|
cd $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin ; \
|
|
|
|
for file in python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
|
|
|
|
python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m \
|
|
|
|
pythonw$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) ; do \
|
2013-09-13 22:01:26 +02:00
|
|
|
$(INSTALL_NAME_TOOL) -change \
|
2013-05-04 14:50:51 +02:00
|
|
|
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
|
|
|
|
@executable_path/../LibreOfficePython $$file ; done
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2012-11-17 00:39:31 +01:00
|
|
|
# vim: set noet sw=4 ts=4:
|