gnu: python: Simplify list of configure flags.

* gnu/packages/patches/python-2.7-search-paths.patch,
  gnu/packages/patches/python-3-search-paths.patch: New files.
* gnu-system.am (dist_patch_DATA): Add them.
* gnu/packages/python.scm (python-2)[source]: Use first patch.
  [arguments]: Remove now unneeded CPPFLAGS and LDFLAGS.
  (python)[source]: Use second patch.
  (python-minimal)[arguments]: Remove CPPFLAGS and LDFLAGS.
This commit is contained in:
Ludovic Courtès 2015-10-08 00:05:34 +02:00
parent afa181fff4
commit 6a20289d5a
4 changed files with 51 additions and 52 deletions

View File

@ -604,6 +604,8 @@ dist_patch_DATA = \
gnu/packages/patches/pybugz-encode-error.patch \ gnu/packages/patches/pybugz-encode-error.patch \
gnu/packages/patches/pybugz-stty.patch \ gnu/packages/patches/pybugz-stty.patch \
gnu/packages/patches/pyqt-configure.patch \ gnu/packages/patches/pyqt-configure.patch \
gnu/packages/patches/python-2.7-search-paths.patch \
gnu/packages/patches/python-3-search-paths.patch \
gnu/packages/patches/python-disable-ssl-test.patch \ gnu/packages/patches/python-disable-ssl-test.patch \
gnu/packages/patches/python-fix-tests.patch \ gnu/packages/patches/python-fix-tests.patch \
gnu/packages/patches/python2-rdflib-drop-sparqlwrapper.patch \ gnu/packages/patches/python2-rdflib-drop-sparqlwrapper.patch \

View File

@ -0,0 +1,16 @@
Make sure the build system honors CPATH and LIBRARY_PATH when looking for
headers and libraries.
--- Python-2.7.10/setup.py 2015-10-07 18:33:18.125153186 +0200
+++ Python-2.7.10/setup.py 2015-10-07 18:33:47.497347552 +0200
@@ -526,6 +526,10 @@ class PyBuildExt(build_ext):
inc_dirs += ['/system/include', '/atheos/autolnk/include']
inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
+ # Always honor these variables.
+ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
+
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
if host_platform in ['osf1', 'unixware7', 'openunix8']:
lib_dirs += ['/usr/ccs/lib']

View File

@ -0,0 +1,19 @@
Make sure the build system honors CPATH and LIBRARY_PATH when looking for
headers and libraries.
--- setup.py 2015-10-07 23:32:58.891329173 +0200
+++ setup.py 2015-10-07 23:46:29.653349924 +0200
@@ -507,11 +507,8 @@ class PyBuildExt(build_ext):
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
if not cross_compiling:
- lib_dirs = self.compiler.library_dirs + [
- '/lib64', '/usr/lib64',
- '/lib', '/usr/lib',
- ]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs = os.getenv('CPATH', '').split(os.pathsep)
else:
lib_dirs = self.compiler.library_dirs[:]
inc_dirs = self.compiler.include_dirs[:]

View File

@ -86,7 +86,8 @@
version "/Python-" version ".tar.xz")) version "/Python-" version ".tar.xz"))
(sha256 (sha256
(base32 (base32
"1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw")))) "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))
(patches (list (search-patch "python-2.7-search-paths.patch")))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:tests? #f `(#:tests? #f
@ -132,43 +133,10 @@
;; such file or directory ;; such file or directory
#:test-target "test" #:test-target "test"
#:configure-flags #:configure-flags
(let ((bz2 (assoc-ref %build-inputs "bzip2")) (list "--enable-shared" ;allow embedding
(gdbm (assoc-ref %build-inputs "gdbm")) "--with-system-ffi" ;build ctypes
(libffi (assoc-ref %build-inputs "libffi")) (string-append "LDFLAGS=-Wl,-rpath="
(sqlite (assoc-ref %build-inputs "sqlite")) (assoc-ref %outputs "out") "/lib"))
(openssl (assoc-ref %build-inputs "openssl"))
(readline (assoc-ref %build-inputs "readline"))
(zlib (assoc-ref %build-inputs "zlib"))
(tk (assoc-ref %build-inputs "tk"))
(tcl (assoc-ref %build-inputs "tcl"))
(out (assoc-ref %outputs "out")))
(list "--enable-shared" ; allow embedding
"--with-system-ffi" ; build ctypes
;; configure/setup.py doesn't use pkg-config to find Tcl/Tk.
(string-append "--with-tcltk-includes=-I" tk "/include -I"
tcl "/include")
(string-append "--with-tcltk-libs=-L" tk "/lib -ltk" ""
,(version-prefix (package-version tk) 2)
" -L" tcl "/lib -ltcl"
,(version-prefix (package-version tcl) 2))
(string-append "CPPFLAGS="
"-I" bz2 "/include "
"-I" gdbm "/include "
"-I" sqlite "/include "
"-I" openssl "/include "
"-I" readline "/include "
"-I" zlib "/include")
(string-append "LDFLAGS="
"-L" bz2 "/lib "
"-L" gdbm "/lib "
"-L" libffi "/lib "
"-L" sqlite "/lib "
"-L" openssl "/lib "
"-L" readline "/lib "
"-L" zlib "/lib "
"-Wl,-rpath=" out "/lib")))
#:modules ((ice-9 ftw) #:modules ((ice-9 ftw)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
@ -257,9 +225,11 @@ data types.")
(method url-fetch) (method url-fetch)
(uri (string-append "https://www.python.org/ftp/python/" (uri (string-append "https://www.python.org/ftp/python/"
version "/Python-" version ".tar.xz")) version "/Python-" version ".tar.xz"))
(patches (list (search-patch "python-fix-tests.patch") (patches (map search-patch
;; XXX Try removing this patch for python > 3.4.3 '("python-fix-tests.patch"
(search-patch "python-disable-ssl-test.patch"))) ;; XXX Try removing this patch for python > 3.4.3
"python-disable-ssl-test.patch"
"python-3-search-paths.patch")))
(patch-flags '("-p0")) (patch-flags '("-p0"))
(sha256 (sha256
(base32 (base32
@ -293,17 +263,9 @@ data types.")
(arguments (arguments
(substitute-keyword-arguments (package-arguments python) (substitute-keyword-arguments (package-arguments python)
((#:configure-flags _) ((#:configure-flags _)
`(let ((openssl (assoc-ref %build-inputs "openssl")) `(list "--enable-shared"
(zlib (assoc-ref %build-inputs "zlib")) (string-append "LDFLAGS=-Wl,-rpath="
(out (assoc-ref %outputs "out"))) (assoc-ref %outputs "out") "/lib")))))
(list "--enable-shared"
(string-append "CPPFLAGS="
"-I" openssl "/include "
"-I" zlib "/include ")
(string-append "LDFLAGS="
"-L" openssl "/lib "
"-L" zlib "/lib "
"-Wl,-rpath=" out "/lib"))))))
;; OpenSSL is a mandatory dependency of Python 3.x, for urllib; ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
;; zlib is required by 'zipimport', used by pip. ;; zlib is required by 'zipimport', used by pip.