guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/05: gnu: python: Simplify list of configure flags.


From: Ludovic Courtès
Subject: 05/05: gnu: python: Simplify list of configure flags.
Date: Wed, 07 Oct 2015 22:17:02 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit 6a20289d5a38520fd79e80c256a0315c96a46347
Author: Ludovic Courtès <address@hidden>
Date:   Thu Oct 8 00:05:34 2015 +0200

    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.
---
 gnu-system.am                                      |    2 +
 gnu/packages/patches/python-2.7-search-paths.patch |   16 +++++
 gnu/packages/patches/python-3-search-paths.patch   |   19 ++++++
 gnu/packages/python.scm                            |   66 ++++---------------
 4 files changed, 51 insertions(+), 52 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index cdae0ed..b219d73 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -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 \
diff --git a/gnu/packages/patches/python-2.7-search-paths.patch 
b/gnu/packages/patches/python-2.7-search-paths.patch
new file mode 100644
index 0000000..6e5339f
--- /dev/null
+++ b/gnu/packages/patches/python-2.7-search-paths.patch
@@ -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']
diff --git a/gnu/packages/patches/python-3-search-paths.patch 
b/gnu/packages/patches/python-3-search-paths.patch
new file mode 100644
index 0000000..547feae
--- /dev/null
+++ b/gnu/packages/patches/python-3-search-paths.patch
@@ -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[:]
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index b512e77..5dea76f 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -86,7 +86,8 @@
                           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 @@
        ;; 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 @@ data types.")
               (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")
-                             ;; XXX Try removing this patch for python > 3.4.3
-                             (search-patch "python-disable-ssl-test.patch")))
+              (patches (map search-patch
+                            '("python-fix-tests.patch"
+                              ;; XXX Try removing this patch for python > 3.4.3
+                              "python-disable-ssl-test.patch"
+                              "python-3-search-paths.patch")))
               (patch-flags '("-p0"))
               (sha256
                (base32
@@ -293,17 +263,9 @@ data types.")
     (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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]