all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Amirouche Boubekki <amirouche.boubekki@gmail.com>
To: Kei Kebreau <kei@openmailbox.org>, guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] Add scheme-bytestructures
Date: Wed, 19 Oct 2016 07:18:37 +0000	[thread overview]
Message-ID: <CAL7_Mo8ChzCQZA+BQCPxQZZKDUH_8KnC08HAp--xwVwbfp-eJg@mail.gmail.com> (raw)
In-Reply-To: <877f95ivf9.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 738 bytes --]

Updated the patch.

On Tue, Oct 18, 2016 at 4:28 PM Ludovic Courtès <ludo@gnu.org> wrote:

> Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:
>
> > On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès <ludo@gnu.org> wrote:
> >
>

[...]


> >> Please let’s not list all the files.  :-)  Could it instead use
> >> something like (find-files "bytestructures" "\\.scm$")?
> >>
> >
> > The above is a subset of all files. Do you prefer to use `find-files` and
> > exclude some files?
>
> Whichever is the most concise and most maintainable approach (I suspect
> it’s ‘find-files’ + exclude specific files.)
>
> Ludo’.
>

find-files does the right thing, there is no need to filter what it returns.

[-- Attachment #1.2: Type: text/html, Size: 1712 bytes --]

[-- Attachment #2: 0001-gnu-Add-guile-bytestructures.patch --]
[-- Type: text/x-patch, Size: 4511 bytes --]

From ea88bf4b53a63ba0d54f71622d055c32cd7e346e Mon Sep 17 00:00:00 2001
From: Amirouche <amirouche@hypermove.net>
Date: Sun, 9 Oct 2016 12:31:20 +0200
Subject: [PATCH] gnu: Add guile-bytestructures

* gnu/packages/guile.scm (guile-bytestructures): New variable.
---
 gnu/packages/guile.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 43071e6..a03cb44 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -1267,4 +1267,82 @@ 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 (find-files "bytestructures" "\\.scm$"))
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild")))
+           ;; Make installation directories.
+           (mkdir-p (string-append module-dir "/bytestructures/guile"))
+           (mkdir-p (string-append module-dir "/bytestructures/r6"))
+           (mkdir-p (string-append module-dir "/bytestructures/body"))
+           (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.
+                         (copy-file file dest-file)
+                         ;; Install compiled module.
+                         (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
-- 
2.10.0


  reply	other threads:[~2016-10-19  7:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-09 10:38 [PATCH] Add scheme-bytestructures Amirouche Boubekki
2016-10-10 17:51 ` Kei Kebreau
2016-10-10 20:46   ` Ludovic Courtès
2016-10-11 13:15     ` Taylan Ulrich Bayırlı/Kammer
2016-10-18 13:14     ` Amirouche Boubekki
2016-10-18 14:27       ` Ludovic Courtès
2016-10-19  7:18         ` Amirouche Boubekki [this message]
2016-10-20 14:00           ` Ludovic Courtès
2016-10-20 16:03             ` Amirouche Boubekki
2016-10-24 20:56               ` Ludovic Courtès

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=CAL7_Mo8ChzCQZA+BQCPxQZZKDUH_8KnC08HAp--xwVwbfp-eJg@mail.gmail.com \
    --to=amirouche.boubekki@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=kei@openmailbox.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.