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-stty.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-fix-tests.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 @@ (define-public python-2
version "/Python-" version ".tar.xz"))
(sha256
(base32
"1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))))
"1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))
(patches (list (search-patch "python-2.7-search-paths.patch")))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f
@ -132,43 +133,10 @@ (define-public python-2
;; such file or directory
#:test-target "test"
#:configure-flags
(let ((bz2 (assoc-ref %build-inputs "bzip2"))
(gdbm (assoc-ref %build-inputs "gdbm"))
(libffi (assoc-ref %build-inputs "libffi"))
(sqlite (assoc-ref %build-inputs "sqlite"))
(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")))
(list "--enable-shared" ;allow embedding
"--with-system-ffi" ;build ctypes
(string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib"))
#:modules ((ice-9 ftw)
,@%gnu-build-system-modules)
@ -257,9 +225,11 @@ (define-public python
(method url-fetch)
(uri (string-append "https://www.python.org/ftp/python/"
version "/Python-" version ".tar.xz"))
(patches (list (search-patch "python-fix-tests.patch")
(patches (map search-patch
'("python-fix-tests.patch"
;; XXX Try removing this patch for python > 3.4.3
(search-patch "python-disable-ssl-test.patch")))
"python-disable-ssl-test.patch"
"python-3-search-paths.patch")))
(patch-flags '("-p0"))
(sha256
(base32
@ -293,17 +263,9 @@ (define-public python-minimal
(arguments
(substitute-keyword-arguments (package-arguments python)
((#:configure-flags _)
`(let ((openssl (assoc-ref %build-inputs "openssl"))
(zlib (assoc-ref %build-inputs "zlib"))
(out (assoc-ref %outputs "out")))
(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"))))))
`(list "--enable-shared"
(string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib")))))
;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
;; zlib is required by 'zipimport', used by pip.