diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-07-14 23:20:06 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-04-04 13:52:55 +0200 |
commit | e84c6947a949d9bfd26d8032e2b8e7280fe3265c (patch) | |
tree | a6dc3159bf1c478e1ac858df6a6bf9f1fa1b33c3 | |
parent | 4b412aeb4c9f30a22e1f003ae89af609b1bf3ef0 (diff) |
libffi: build DLL on Windows
The build setup is rather horrible, with some minimal gcc MSVC
wrapper. But the DLL is a prerequisite for the Python 3.8 build,
which dropped the internal libffi.
It's also possible to build it statically, but then you have to
patch the Python 3 _ctypes msbuild properties.
This also defaults to explicit --build and --host settings, even
without a cross build, because the predicted name would otherwise
differ (*-unknown-* instead of *-pc-*).
Additionally a "make install" also fails...
Change-Id: Ifb7dac840e23efffb9a5e342560aef9e11e0db79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98436
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit 883068462fe5bcbb01a8e14736fc06d0c3695c62)
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | external/libffi/ExternalPackage_libffi.mk | 20 | ||||
-rw-r--r-- | external/libffi/ExternalProject_libffi.mk | 29 | ||||
-rw-r--r-- | external/libffi/Module_libffi.mk | 1 |
4 files changed, 45 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index b6f0b4597471..ab08382b67d7 100644 --- a/configure.ac +++ b/configure.ac @@ -8983,7 +8983,7 @@ internal) fi AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"3.7.7"]) BUILD_TYPE="$BUILD_TYPE PYTHON" - if test "$OS" = LINUX; then + if test "$OS" = LINUX -o "$OS" = WNT ; then BUILD_TYPE="$BUILD_TYPE LIBFFI" fi # Embedded Python dies without Home set diff --git a/external/libffi/ExternalPackage_libffi.mk b/external/libffi/ExternalPackage_libffi.mk new file mode 100644 index 000000000000..212e63aa36af --- /dev/null +++ b/external/libffi/ExternalPackage_libffi.mk @@ -0,0 +1,20 @@ +# -*- 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/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,libffi,libffi)) + +$(eval $(call gb_ExternalPackage_use_external_project,libffi,libffi)) + +ifeq ($(COM),MSC) +$(eval $(call gb_ExternalPackage_add_files,libffi,$(LIBO_LIB_FOLDER),\ + $(HOST_PLATFORM)/.libs/libffi-7.dll \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/libffi/ExternalProject_libffi.mk b/external/libffi/ExternalProject_libffi.mk index bdf8fe61eb76..0ff625ea3e20 100644 --- a/external/libffi/ExternalProject_libffi.mk +++ b/external/libffi/ExternalProject_libffi.mk @@ -14,17 +14,34 @@ $(eval $(call gb_ExternalProject_register_targets,libffi,\ )) # set prefix so that it ends up in libffi.pc so that pkg-config in python3 works +# For a static Windows build, change CPPFLAGS to include -D_LIB and --disable-static +# Also remove the ExternalPackage in that case + +libffi_WIN_PLATFORM := $(strip \ + $(if $(filter INTEL,$(CPUNAME)),32) \ + $(if $(filter X86_64,$(CPUNAME)),64) \ + $(if $(filter ARM64,$(CPUNAME)),arm64) \ + ) $(call gb_ExternalProject_get_state_target,libffi,build): $(call gb_ExternalProject_run,build,\ + export LIB="$(ILIB)" && \ ./configure \ --enable-option-checking=fatal \ - $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ - --enable-static \ - --disable-shared \ - --with-pic \ - --enable-portable-binary \ - CC="$(CC) $(if $(filter LINUX,$(OS)),-fvisibility=hidden)" \ + --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ + $(if $(filter LINUX,$(OS)), \ + --disable-shared \ + CC="$(CC) -fvisibility=hidden" \ + --with-pic \ + --enable-portable-binary) \ + $(if $(filter WNT,$(OS)), \ + --disable-static \ + CC="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \ + CXX="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \ + LD='link' \ + CPP='cl -nologo -EP' \ + CXXCPP='cl -nologo -EP' \ + CPPFLAGS="-DFFI_BUILDING_DLL $(SOLARINC)") \ --prefix=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \ --disable-docs \ && $(MAKE) \ diff --git a/external/libffi/Module_libffi.mk b/external/libffi/Module_libffi.mk index 739fd4197000..ace75480abe3 100644 --- a/external/libffi/Module_libffi.mk +++ b/external/libffi/Module_libffi.mk @@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,libffi)) $(eval $(call gb_Module_add_targets,libffi,\ UnpackedTarball_libffi \ ExternalProject_libffi \ + ExternalPackage_libffi \ )) # vim: set noet sw=4 ts=4: |