all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: 宋文武 <iyzsong@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 2/2] gnu: libxml2: Build python bindings separately.
Date: Sat, 30 May 2015 17:12:52 +0800	[thread overview]
Message-ID: <1432977172-14658-2-git-send-email-iyzsong@gmail.com> (raw)
In-Reply-To: <1432977172-14658-1-git-send-email-iyzsong@gmail.com>

* gnu/packages/xml.scm (libxml2)[native-inputs]: Remove python.
  [arguments]: Remove.
  (python-libxml2, python2-libxml): New variables.
---
 gnu/packages/xml.scm | 53 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index a4c81b2..22d4e52 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -33,6 +33,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages linux))
 
 (define-public expat
@@ -70,10 +71,7 @@ things the parser might find in the XML document (like start tags).")
     (home-page "http://www.xmlsoft.org/")
     (synopsis "C parser for XML")
     (propagated-inputs `(("zlib" ,zlib))) ; libxml2.la says '-lz'.
-    (native-inputs `(("perl" ,perl)
-                     ("python" ,python-2))) ; incompatible with Python 3 (print syntax)
-
-
+    (native-inputs `(("perl" ,perl)))
     ;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml'
     ;; sub-directory of any given package.
     (native-search-paths (list (search-path-specification
@@ -83,29 +81,40 @@ things the parser might find in the XML document (like start tags).")
                                 (file-pattern "^catalog\\.xml$")
                                 (file-type 'regular))))
     (search-paths native-search-paths)
-
-    (arguments
-     `(#:phases
-        (alist-replace
-         'install
-         (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
-          (let ((install (assoc-ref %standard-phases 'install))
-                (glibc (assoc-ref inputs ,(if (%current-target-system)
-                                              "cross-libc" "libc")))
-                (out (assoc-ref outputs "out")))
-            (apply install args)
-            (chdir "python")
-            (substitute* "setup.py"
-              (("/opt/include")
-               (string-append glibc "/include")))
-            (system* "python" "setup.py" "install"
-                     (string-append "--prefix=" out))))
-        %standard-phases)))
     (description
      "Libxml2 is the XML C parser and toolkit developed for the Gnome project
 (but it is usable outside of the Gnome platform).")
     (license license:x11)))
 
+(define-public python-libxml2
+  (package (inherit libxml2)
+    (name "python-libxml2")
+    (build-system python-build-system)
+    (arguments
+     `(;; XXX: Tests are specified in 'Makefile.am', but not in 'setup.py'.
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'build 'configure
+          (lambda* (#:key inputs #:allow-other-keys)
+            (chdir "python")
+            (let ((glibc   (assoc-ref inputs ,(if (%current-target-system)
+                                                  "cross-libc" "libc")))
+                  (libxml2 (assoc-ref inputs "libxml2")))
+              (substitute* "setup.py"
+                ;; For 'libxml2/libxml/tree.h'.
+                (("ROOT = r'/usr'")
+                 (format #f "ROOT = r'~a'" libxml2))
+                ;; For 'iconv.h'.
+                (("/opt/include")
+                 (string-append glibc "/include")))))))))
+    (inputs `(("libxml2" ,libxml2)))
+    (synopsis "Python bindings for the libxml2 library")))
+
+(define-public python2-libxml
+  (package-with-python2 python-libxml2))
+
 (define-public libxslt
   (package
     (name "libxslt")
-- 
2.2.1

  reply	other threads:[~2015-05-30  9:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30  9:12 [PATCH 1/2] gnu: libxml2: Update to 2.9.2 宋文武
2015-05-30  9:12 ` 宋文武 [this message]
2015-05-30 16:07   ` [PATCH 2/2] gnu: libxml2: Build python bindings separately Mark H Weaver
2015-05-31  2:29     ` 宋文武
2015-05-31 16:57       ` Mark H Weaver
2015-06-01  1:01         ` 宋文武
2015-05-30 16:00 ` [PATCH 1/2] gnu: libxml2: Update to 2.9.2 Mark H Weaver
2015-05-31  2:20   ` 宋文武

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432977172-14658-2-git-send-email-iyzsong@gmail.com \
    --to=iyzsong@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.