summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-07-25 17:06:51 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-25 17:46:17 +0200
commit726ecfeb3ae9eb4baacf042e2dd34b1e377dccfa (patch)
tree7a90b6472187e2a5bb97362de5ee6314a5df312f /gnu
parent0093b1262b1af6b66cf255112bdad7ed6f8f08e3 (diff)
downloadguix-726ecfeb3ae9eb4baacf042e2dd34b1e377dccfa.tar.gz
gnu: Add guile2.0-bytestructures.
* gnu/packages/patches/guile-bytestructures-name-clash.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/guile.scm (guile-bytestructures)[source]: Use it.
[arguments]: Unpack the source.
[native-inputs]: New field.
(guile2.0-bytestructures): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/guile.scm22
-rw-r--r--gnu/packages/patches/guile-bytestructures-name-clash.patch31
3 files changed, 52 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 60ad007a28..1cc8f08d98 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -668,6 +668,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gsl-test-i686.patch			\
   %D%/packages/patches/gspell-dash-test.patch			\
   %D%/packages/patches/guile-1.8-cpp-4.5.patch			\
+  %D%/packages/patches/guile-bytestructures-name-clash.patch	\
   %D%/packages/patches/guile-default-utf8.patch			\
   %D%/packages/patches/guile-linux-syscalls.patch		\
   %D%/packages/patches/guile-present-coding.patch		\
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index dd852cb3e6..21cc59ef04 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -1543,16 +1543,28 @@ is no support for parsing block and inline level HTML.")
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "04lgh0nk6ddnwgh20hnz4pyhczaik0xbd50kikjsxcwcl46shavb"))))
+                "04lgh0nk6ddnwgh20hnz4pyhczaik0xbd50kikjsxcwcl46shavb"))
+              (patches (search-patches "guile-bytestructures-name-clash.patch"))))
     (build-system trivial-build-system)
     (arguments
      `(#:modules ((guix build utils))
        #:builder
        (begin
          (use-modules (guix build utils)
+                      (ice-9 ftw)
                       (ice-9 match)
                       (ice-9 popen)
                       (ice-9 rdelim))
+         ;; Unpack.
+         (setenv "PATH"
+                 (string-join (list (assoc-ref %build-inputs "tar")
+                                    (assoc-ref %build-inputs "xz"))
+                              "/bin:" 'suffix))
+         (system* "tar" "xf" (assoc-ref %build-inputs "source"))
+         (match (scandir ".")
+           (("." ".." directory)
+            (chdir directory)))
+
          (let* ((out (assoc-ref %outputs "out"))
                 (guile (assoc-ref %build-inputs "guile"))
                 (effective (read-line
@@ -1561,7 +1573,7 @@ is no support for parsing block and inline level HTML.")
                                         "-c" "(display (effective-version))")))
                 (module-dir (string-append out "/share/guile/site/"
                                            effective))
-                (source (assoc-ref %build-inputs "source"))
+                (source (getcwd))
                 (doc (string-append out "/share/doc/scheme-bytestructures"))
                 (sld-files (with-directory-excursion source
                              (find-files "bytestructures/r7" "\\.exports.sld$")))
@@ -1601,6 +1613,9 @@ is no support for parsing block and inline level HTML.")
            ;; Also copy over the README.
            (install-file "README.md" doc)
            #t))))
+    (native-inputs
+     `(("tar" ,tar)
+       ("xz" ,xz)))
     (inputs
      `(("guile" ,guile-2.2)))
     (home-page "https://github.com/TaylanUB/scheme-bytestructures")
@@ -1613,6 +1628,9 @@ an abstraction over raw memory.  It's also more powerful than the C
 type system, elevating types to first-class status.")
     (license license:gpl3+)))
 
+(define-public guile2.0-bytestructures
+  (package-for-guile-2.0 guile-bytestructures))
+
 (define-public guile-aspell
   (package
     (name "guile-aspell")
diff --git a/gnu/packages/patches/guile-bytestructures-name-clash.patch b/gnu/packages/patches/guile-bytestructures-name-clash.patch
new file mode 100644
index 0000000000..ac834dd504
--- /dev/null
+++ b/gnu/packages/patches/guile-bytestructures-name-clash.patch
@@ -0,0 +1,31 @@
+This patch works around a name clash between the 'cstring-pointer' module and
+the 'cstring-module' variable that occurs in Guile 2.0:
+
+  ice-9/boot-9.scm:109:20: re-exporting local variable: cstring-pointer
+
+--- guile-bytestructures-20170402.91d042e-checkout/bytestructures/guile.scm	2017-07-25 17:04:32.858289986 +0200
++++ guile-bytestructures-20170402.91d042e-checkout/bytestructures/guile.scm	2017-07-25 17:04:41.130244725 +0200
+@@ -1,6 +1,6 @@
+ (define-module (bytestructures guile))
+ 
+-(import
++(use-modules
+  (bytestructures guile base)
+  (bytestructures guile vector)
+  (bytestructures guile struct)
+@@ -8,7 +8,7 @@
+  (bytestructures guile pointer)
+  (bytestructures guile numeric)
+  (bytestructures guile string)
+- (bytestructures guile cstring-pointer))
++ ((bytestructures guile cstring-pointer) #:prefix cstr:))
+ (re-export
+  make-bytestructure-descriptor
+  bytestructure-descriptor?
+@@ -75,5 +75,5 @@
+ 
+  bs:string
+ 
+- cstring-pointer
++ cstr:cstring-pointer
+  )