summary refs log tree commit diff
path: root/gnu/packages/guile.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-10-26 18:59:28 -0400
committerLeo Famulari <leo@famulari.name>2016-10-26 19:00:06 -0400
commit02c73adcdf0f29dbecd9a1bb3c9be3626cd5dea9 (patch)
treefb8fadc87f5b82dc35f44831af8b79eec37887b3 /gnu/packages/guile.scm
parenta19da40630138acea7169491a6926e00cf7d301b (diff)
parent5d73e3000030006b00e7e6644f3ced5d6176376e (diff)
downloadguix-02c73adcdf0f29dbecd9a1bb3c9be3626cd5dea9.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/guile.scm')
-rw-r--r--gnu/packages/guile.scm81
1 files changed, 81 insertions, 0 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 21f37a10ff..b246d3a6ad 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2016 Eraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
+;;; Copyright © 2016 Amirouche <amirouche@hypermove.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1292,4 +1293,84 @@ is no support for parsing block and inline level HTML.")
 (define-public guile2.2-commonmark
   (package-for-guile-2.2 guile-commonmark))
 
+(define-public guile-bytestructures
+  (package
+    (name "guile-bytestructures")
+    (version "20160726.53127f6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TaylanUB/scheme-bytestructures")
+                    (commit "53127f608caf64b34fa41c389b2743b546fbe9da")))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0l4nx1vp9fkrgrgwjiycj7nx6wfjfd39rqamv4pmq7issi8mrywq"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (source (assoc-ref %build-inputs "source"))
+                (doc (string-append out "/share/doc/scheme-bytestructures"))
+                (scm-files (filter (lambda (path)
+                                     (not (string-prefix? "bytestructures/r7" path)))
+                                   (with-directory-excursion source
+                                     (find-files "bytestructures" "\\.scm$"))))
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild")))
+           ;; Make installation directories.
+           (mkdir-p doc)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (string-append module-dir "/"
+                                                      (substring file 0
+                                                                 (string-rindex file #\.))
+                                                      ".go")))
+                         ;; Install source module.
+                         (mkdir-p (dirname dest-file))
+                         (copy-file file dest-file)
+
+                         ;; Install compiled module.
+                         (mkdir-p (dirname go-file))
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     scm-files)
+
+           ;; Also copy over the README.
+           (install-file "README.md" doc)
+           #t))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (home-page "https://github.com/TaylanUB/scheme-bytestructures")
+    (synopsis "Structured access to bytevector contents for Guile")
+    (description
+     "Guile bytestructures offers a system imitating the type system
+of the C programming language, to be used on bytevectors.  C's type
+system works on raw memory, and Guile works on bytevectors which are
+an abstraction over raw memory.  It's also more powerful than the C
+type system, elevating types to first-class status.")
+    (license gpl3+)))
+
 ;;; guile.scm ends here