summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/guile.scm22
-rw-r--r--gnu/packages/patches/guile-bytestructures-name-clash.patch31
2 files changed, 51 insertions, 2 deletions
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
+  )