diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-01-09 15:06:07 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-01-13 11:14:30 +0100 |
commit | 6b5ce621ff2a82d4fa77d7781d1dabd4b14a4c90 (patch) | |
tree | 2304b0813c598f2318a6183eaa89d705d75a30f0 | |
parent | e17ed7b1e11174a7b3ed1219ce1df8b26372417a (diff) |
python3: bundle libffi for GNU/Linux builds
CPython commit f40d4ddff3c800b3c956a5e8820aabe3aa87cddd "Closes #27979:
Remove bundled copy of libffi" causes a bit of a problem because it
turns out that libffi isn't all that stable; there's libffi.so.5 on
CentOS 6, libffi.so.6 on CentOS 7 and libffi.so.7 on
lo_daily_update_gandalf tinderbox.
So we have to bundle it in LO; it's only used on GNU/Linux currently.
CPython commit 32119e10b792ad7ee4e5f951a2d89ddbaf111cc5 "bpo-35947:
Update Windows to the current version of libffi (GH-11797)" also removes
the libffi for MSVC, so in a future python upgrade we will have to build
libffi for MSVC too.
The libffi fork for MacOSX is still in CPython git master.
(regression from b10be5d48433076f0b7238d818020f708553e114)
Change-Id: Ibc20cf8cd3614cf9941b6970662bd930496776b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86493
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit 79084665f0e351a3f83fdee88071919f05ec9cc3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86500
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | Makefile.fetch | 1 | ||||
-rw-r--r-- | RepositoryExternal.mk | 6 | ||||
-rwxr-xr-x | bin/check-elf-dynamic-objects | 3 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | download.lst | 2 | ||||
-rw-r--r-- | external/Module_external.mk | 1 | ||||
-rw-r--r-- | external/libffi/ExternalProject_libffi.mk | 33 | ||||
-rw-r--r-- | external/libffi/Makefile | 7 | ||||
-rw-r--r-- | external/libffi/Module_libffi.mk | 17 | ||||
-rw-r--r-- | external/libffi/README | 3 | ||||
-rw-r--r-- | external/libffi/UnpackedTarball_libffi.mk | 14 | ||||
-rw-r--r-- | external/python3/ExternalProject_python3.mk | 13 | ||||
-rw-r--r-- | readlicense_oo/license/license.xml | 23 |
13 files changed, 121 insertions, 5 deletions
diff --git a/Makefile.fetch b/Makefile.fetch index d8d63cbb9523..0932b761adaf 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -154,6 +154,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,LIBASSUAN,LIBASSUAN_TARBALL) \ $(call fetch_Optional,LIBEOT,LIBEOT_TARBALL) \ $(call fetch_Optional,LIBEXTTEXTCAT,LIBEXTTEXTCAT_TARBALL) \ + $(call fetch_Optional,LIBFFI,LIBFFI_TARBALL) \ $(call fetch_Optional,LIBGPGERROR,LIBGPGERROR_TARBALL) \ $(call fetch_Optional,LIBLANGTAG,LANGTAGREG_TARBALL) \ $(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 8561ba84a0ea..9f172d6af448 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3169,6 +3169,12 @@ endif endef +# this is only used by python currently +define gb_ExternalProject__use_libffi +$(call gb_ExternalProject_use_external_project,$(1),libffi) + +endef + endif # SYSTEM_PYTHON # ORCUS diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects index d1b7ab5522f4..c619fc0cdfc5 100755 --- a/bin/check-elf-dynamic-objects +++ b/bin/check-elf-dynamic-objects @@ -111,9 +111,6 @@ local file="$1" # skip the majority of files, no ELF binaries here skip=1 ;; - */_ctypes.cpython-*.so) - whitelist="${whitelist} libffi.so.6" # TODO dubious? - ;; */_uuid.cpython-*.so) whitelist="${whitelist} libuuid.so.1" ;; diff --git a/configure.ac b/configure.ac index c239b1f66794..a14eff9b893a 100644 --- a/configure.ac +++ b/configure.ac @@ -8765,6 +8765,9 @@ internal) fi AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"]) BUILD_TYPE="$BUILD_TYPE PYTHON" + if test "$OS" = LINUX; then + BUILD_TYPE="$BUILD_TYPE LIBFFI" + fi # Embedded Python dies without Home set if test "$HOME" = ""; then export HOME="" diff --git a/download.lst b/download.lst index f1769774540a..8895fc25a1b0 100644 --- a/download.lst +++ b/download.lst @@ -146,6 +146,8 @@ export LIBEOT_SHA256SUM := cf5091fa8e7dcdbe667335eb90a2cfdd0a3fe8f8c7c8d1ece44d9 export LIBEOT_TARBALL := libeot-0.01.tar.bz2 export LIBEXTTEXTCAT_SHA256SUM := 13fdbc9d4c489a4d0519e51933a1aa21fe3fb9eb7da191b87f7a63e82797dac8 export LIBEXTTEXTCAT_TARBALL := libexttextcat-3.4.5.tar.xz +export LIBFFI_SHA256SUM := 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056 +export LIBFFI_TARBALL := libffi-3.3.tar.gz export LIBGPGERROR_SHA256SUM := 4f93aac6fecb7da2b92871bb9ee33032be6a87b174f54abf8ddf0911a22d29d2 export LIBGPGERROR_TARBALL := libgpg-error-1.27.tar.bz2 export LIBLANGTAG_SHA256SUM := d6242790324f1432fb0a6fae71b6851f520b2c5a87675497cf8ea14c2924d52e diff --git a/external/Module_external.mk b/external/Module_external.mk index 10ed2a6e54db..baf7215b2b70 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \ $(call gb_Helper_optional,LIBEOT,libeot) \ $(call gb_Helper_optional,LIBEXTTEXTCAT,libexttextcat) \ + $(call gb_Helper_optional,LIBFFI,libffi) \ $(call gb_Helper_optional,LIBGPGERROR,libgpg-error) \ $(call gb_Helper_optional,LIBLANGTAG,liblangtag) \ $(call gb_Helper_optional,LIBNUMBERTEXT,libnumbertext) \ diff --git a/external/libffi/ExternalProject_libffi.mk b/external/libffi/ExternalProject_libffi.mk new file mode 100644 index 000000000000..bdf8fe61eb76 --- /dev/null +++ b/external/libffi/ExternalProject_libffi.mk @@ -0,0 +1,33 @@ +# -*- 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_ExternalProject_ExternalProject,libffi)) + +$(eval $(call gb_ExternalProject_register_targets,libffi,\ + build \ +)) + +# set prefix so that it ends up in libffi.pc so that pkg-config in python3 works + +$(call gb_ExternalProject_get_state_target,libffi,build): + $(call gb_ExternalProject_run,build,\ + ./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)" \ + --prefix=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \ + --disable-docs \ + && $(MAKE) \ + ) + +# vim: set noet sw=4 ts=4: diff --git a/external/libffi/Makefile b/external/libffi/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/libffi/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/libffi/Module_libffi.mk b/external/libffi/Module_libffi.mk new file mode 100644 index 000000000000..739fd4197000 --- /dev/null +++ b/external/libffi/Module_libffi.mk @@ -0,0 +1,17 @@ +# -*- 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_Module_Module,libffi)) + +$(eval $(call gb_Module_add_targets,libffi,\ + UnpackedTarball_libffi \ + ExternalProject_libffi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libffi/README b/external/libffi/README new file mode 100644 index 000000000000..cdf7fa937bc8 --- /dev/null +++ b/external/libffi/README @@ -0,0 +1,3 @@ +libffi is required to build CPython's ctypes module + +https://sourceware.org/libffi/ diff --git a/external/libffi/UnpackedTarball_libffi.mk b/external/libffi/UnpackedTarball_libffi.mk new file mode 100644 index 000000000000..5d0582329ac5 --- /dev/null +++ b/external/libffi/UnpackedTarball_libffi.mk @@ -0,0 +1,14 @@ +# -*- 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_UnpackedTarball_UnpackedTarball,libffi)) + +$(eval $(call gb_UnpackedTarball_set_tarball,libffi,$(LIBFFI_TARBALL))) + +# vim: set noet sw=4 ts=4: diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk index 5350f9e4c5d9..6c958431cd97 100644 --- a/external/python3/ExternalProject_python3.mk +++ b/external/python3/ExternalProject_python3.mk @@ -11,6 +11,7 @@ $(eval $(call gb_ExternalProject_ExternalProject,python3)) $(eval $(call gb_ExternalProject_use_externals,python3,\ expat \ + $(if $(filter LINUX,$(OS)),libffi) \ openssl \ zlib \ )) @@ -52,8 +53,12 @@ else # OPENSSL_INCLUDES OPENSSL_LDFLAGS OPENSSL_LIBS cannot be set via commandline! # use --with-openssl instead, which requires include/ and lib/ subdirs. -# TODO: libffi has different SONAME on CentOS 6 vs. 7, so we better use -# --without-system-ffi. However, that doesn't actually do anything on Linux :( +# libffi is not all that stable, with 3 different SONAMEs currently, so we +# have to bundle it; --without-system-ffi does not work any more on Linux. +# Unfortuantely (as of 3.7) pkg-config is used to locate libffi so we do some +# hacks to find the libffi.pc in workdir by overriding PKG_CONFIG_LIBDIR. +# Also, pkg-config is only used to find the headers, the libdir needs to be +# passed extra. # create a symlink "LO_lib" because the .so are in a directory with platform # specific name like build/lib.linux-x86_64-3.3 @@ -91,6 +96,9 @@ $(call gb_ExternalProject_get_state_target,python3,build) : $(if $(SYSTEM_OPENSSL)$(DISABLE_OPENSSL),,\ --with-openssl=$(call gb_UnpackedTarball_get_dir,openssl) \ ) \ + $(if $(filter LINUX,$(OS)), \ + PKG_CONFIG_LIBDIR="$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)$${PKG_CONFIG_LIBDIR:+:$$PKG_CONFIG_LIBDIR}" \ + ) \ CC="$(strip $(CC) \ $(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \ $(if $(SYSBASE), -I$(SYSBASE)/usr/include) \ @@ -98,6 +106,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) : $(if $(python3_cflags),CFLAGS='$(python3_cflags)') \ $(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \ LDFLAGS="$(strip $(LDFLAGS) \ + $(if $(filter LINUX,$(OS)),-L$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs) \ $(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \ $(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \ $(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \ diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index 79dc0378112b..7ad0a91c67f1 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -1686,6 +1686,29 @@ ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</p> </div> + <div class ="LIBFFI"> + <h2>libffi</h2> + <p>The following software may be included in this product: libffi</p> + <p>The libffi project code is covered by the MIT license:</p> + <p>libffi - Copyright (c) 1996-2019 Anthony Green, Red Hat, Inc and others.</p> + <p>See source files for details.</p> + <p>Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions:</p> + <p>The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software.</p> + <p>THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> + </div> <div class="PYTHON"> <h2>Python</h2> <p>The following software may be included in this product: Python. Use of any of this software is governed by |