diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-28 19:53:59 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-28 19:55:00 +0300 |
commit | 9fd0060c0f3458e53b38003d1388f16cb56f45d8 (patch) | |
tree | 398b9b6da306cd4554129da4f540a9fcb329429c /build_files | |
parent | c70eb30240f8b5d5a8f2ac509f0eb585936142b5 (diff) |
Build environment: Ensure Python is using static ffi
Surely, need to compile ffi first :)
Good news are: Python seems static enough now!
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/build_environment/CMakeLists.txt | 1 | ||||
-rw-r--r-- | build_files/build_environment/cmake/ffi.cmake | 38 | ||||
-rw-r--r-- | build_files/build_environment/cmake/python.cmake | 1 | ||||
-rw-r--r-- | build_files/build_environment/cmake/versions.cmake | 4 | ||||
-rw-r--r-- | build_files/build_environment/patches/python_linux.diff | 11 |
5 files changed, 54 insertions, 1 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 512d2567754..5270a2e2b3d 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -139,6 +139,7 @@ endif() if(UNIX AND NOT APPLE) include(cmake/bzip2.cmake) + include(cmake/ffi.cmake) include(cmake/lzma.cmake) include(cmake/ssl.cmake) include(cmake/sqlite.cmake) diff --git a/build_files/build_environment/cmake/ffi.cmake b/build_files/build_environment/cmake/ffi.cmake new file mode 100644 index 00000000000..18531fd7906 --- /dev/null +++ b/build_files/build_environment/cmake/ffi.cmake @@ -0,0 +1,38 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_ffi + URL ${FFI_URI} + URL_HASH SHA256=${FFI_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/ffi + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ffi/src/external_ffi/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/ffi + --enable-shared=no + --enable-static=yes + --with-pic + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ffi/src/external_ffi/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ffi/src/external_ffi/ && make install + INSTALL_DIR ${LIBDIR}/ffi +) + +if (UNIX AND NOT APPLE) + ExternalProject_Add_Step(external_ffi after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/ffi/lib/libffi.a ${LIBDIR}/ffi/lib/libffi_pic.a + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake index 9d0edd9246e..cf928ecd794 100644 --- a/build_files/build_environment/cmake/python.cmake +++ b/build_files/build_environment/cmake/python.cmake @@ -177,6 +177,7 @@ if(UNIX AND NOT APPLE) add_dependencies( external_python external_bzip2 + external_ffi external_lzma external_ssl external_sqlite diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index a60c5109057..7ede80a2be9 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -283,6 +283,10 @@ set(BZIP2_VERSION 1.0.6) set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERSION}.orig.tar.bz2) set(BZIP2_HASH d70a9ccd8bdf47e302d96c69fecd54925f45d9c7b966bb4ef5f56b770960afa7) +set(FFI_VERSION 3.2.1) +set(FFI_URI ftp://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz) +set(FFI_HASH d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37) + set(LZMA_VERSION 5.2.4) set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2) set(LZMA_HASH 3313fd2a95f43d88e44264e6b015e7d03053e681860b0d5d3f9baca79c57b7bf) diff --git a/build_files/build_environment/patches/python_linux.diff b/build_files/build_environment/patches/python_linux.diff index 3c65e12111f..24d625c7ceb 100644 --- a/build_files/build_environment/patches/python_linux.diff +++ b/build_files/build_environment/patches/python_linux.diff @@ -1,5 +1,5 @@ diff --git a/setup.py.orig b/setup.py -index a97a755..ee2bfad 100644 +index a97a755..07ce853 100644 --- a/setup.py.orig +++ b/setup.py @@ -1422,13 +1422,13 @@ class PyBuildExt(build_ext): @@ -27,3 +27,12 @@ index a97a755..ee2bfad 100644 extra_link_args = zlib_extra_link_args else: extra_compile_args = [] +@@ -1991,7 +1991,7 @@ class PyBuildExt(build_ext): + print('Header file {} does not exist'.format(ffi_h)) + ffi_lib = None + if ffi_inc is not None: +- for lib_name in ('ffi', 'ffi_pic'): ++ for lib_name in ('ffi_pic', ): + if (self.compiler.find_library_file(lib_dirs, lib_name)): + ffi_lib = lib_name + break |