Commit: c70eb30240f8b5d5a8f2ac509f0eb585936142b5
Author: Sergey Sharybin
Date:   Tue Aug 28 18:28:05 2018 +0200
Branches: master
https://developer.blender.org/rBc70eb30240f8b5d5a8f2ac509f0eb585936142b5

Build environment: Make sure Python is linkign against static Zlib

There is system-wide libz development package installed by default,
needed for some other dependencies. This patch ensures Python will
use our own self-compiled Zlib.

===================================================================

M       build_files/build_environment/cmake/python.cmake
M       build_files/build_environment/cmake/zlib.cmake
A       build_files/build_environment/patches/python_linux.diff

===================================================================

diff --git a/build_files/build_environment/cmake/python.cmake 
b/build_files/build_environment/cmake/python.cmake
index 0e3356e343d..9d0edd9246e 100644
--- a/build_files/build_environment/cmake/python.cmake
+++ b/build_files/build_environment/cmake/python.cmake
@@ -93,13 +93,14 @@ else()
        else()
                set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl")
                set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
-               set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include 
-I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include")
-               set(PYTHON_LDFLAGS "-L${LIBDIR}/sqlite/lib 
-L${LIBDIR}/bzip2/lib -L${LIBDIR}/lzma/lib")
+               set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include 
-I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include -I${LIBDIR}/zlib/include")
+               set(PYTHON_LDFLAGS "-L${LIBDIR}/sqlite/lib 
-L${LIBDIR}/bzip2/lib -L${LIBDIR}/lzma/lib -L${LIBDIR}/zlib/lib")
                set(PYTHON_CONFIGURE_EXTRA_ENV
                        export CFLAGS=${PYTHON_CFLAGS} &&
                        export CPPFLAGS=${PYTHON_CFLAGS} &&
                        export LDFLAGS=${PYTHON_LDFLAGS})
                set(PYTHON_BINARY 
${BUILD_DIR}/python/src/external_python/python)
+               set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d 
${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_linux.diff)
        endif()
 
        ExternalProject_Add(external_python
@@ -179,5 +180,6 @@ if(UNIX AND NOT APPLE)
                external_lzma
                external_ssl
                external_sqlite
+               external_zlib
        )
 endif()
diff --git a/build_files/build_environment/cmake/zlib.cmake 
b/build_files/build_environment/cmake/zlib.cmake
index b768293487a..7bf1c45e359 100644
--- a/build_files/build_environment/cmake/zlib.cmake
+++ b/build_files/build_environment/cmake/zlib.cmake
@@ -46,4 +46,10 @@ else()
                        DEPENDEES install
                )
        endif()
+       if (UNIX AND NOT APPLE)
+               ExternalProject_Add_Step(external_zlib after_install
+                       COMMAND ${CMAKE_COMMAND} -E copy 
${LIBDIR}/zlib/lib/libz.a ${LIBDIR}/zlib/lib/libz_pic.a
+                       DEPENDEES install
+               )
+       endif()
 endif()
diff --git a/build_files/build_environment/patches/python_linux.diff 
b/build_files/build_environment/patches/python_linux.diff
new file mode 100644
index 00000000000..3c65e12111f
--- /dev/null
+++ b/build_files/build_environment/patches/python_linux.diff
@@ -0,0 +1,29 @@
+diff --git a/setup.py.orig b/setup.py
+index a97a755..ee2bfad 100644
+--- a/setup.py.orig
++++ b/setup.py
+@@ -1422,13 +1422,13 @@ class PyBuildExt(build_ext):
+                         version = line.split()[2]
+                         break
+             if version >= version_req:
+-                if (self.compiler.find_library_file(lib_dirs, 'z')):
++                if (self.compiler.find_library_file(lib_dirs, 'z_pic')):
+                     if host_platform == "darwin":
+                         zlib_extra_link_args = ('-Wl,-search_paths_first',)
+                     else:
+                         zlib_extra_link_args = ()
+                     exts.append( Extension('zlib', ['zlibmodule.c'],
+-                                           libraries = ['z'],
++                                           libraries = ['z_pic'],
+                                            extra_link_args = 
zlib_extra_link_args))
+                     have_zlib = True
+                 else:
+@@ -1442,7 +1442,7 @@ class PyBuildExt(build_ext):
+         # crc32 if we have it.  Otherwise binascii uses its own.
+         if have_zlib:
+             extra_compile_args = ['-DUSE_ZLIB_CRC32']
+-            libraries = ['z']
++            libraries = ['z_pic']
+             extra_link_args = zlib_extra_link_args
+         else:
+             extra_compile_args = []

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to