all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Claes Wallin (韋嘉誠)" <gnu@clacke.user.lysator.liu.se>
To: guix-devel <guix-devel@gnu.org>
Subject: [PATCH] Add skalibs, execline.
Date: Fri, 26 Jun 2015 02:28:03 +0200	[thread overview]
Message-ID: <CAGv_=BpeYcDfMyjc2pxwEijEJUh3Yxgk7KS-eZKHMv+vrYFo1g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

Adds the common skalibs library and the execline shell-like language.

I'm wondering if the commands of the language belong in bin or if they
maybe should be in libexec/execline. They have pretty generic names
and might clash with other packages.

Either way I think patch #0003 is important, as it makes a script like:

#!/gnu/store/vragmy67fri71aamzp3ifbxf00n27qyy-execline-2.1.2.2/bin/execlineb -P
foreground { sleep 1 } echo blah

... work at all times without writing
/gnu/store/vragmy67fri71aamzp3ifbxf00n27qyy-execline-2.1.2.2/bin/foreground.
Having access to the language without having to have it in $PATH seems
important.

Having to patch, run and redirect the output of a shell command during
the build to make it compile was a fun excercise, as was adding the
PATH wrapper. :-)

Descriptions are my own, inspired by the originals on the homepages,
as the originals are maybe a bit too self-promoting. :-)

[-- Attachment #2: 0001-gnu-Add-skalibs.patch --]
[-- Type: application/octet-stream, Size: 3133 bytes --]

From 9a290c4e798a4668cae65126d48d301b44b96a69 Mon Sep 17 00:00:00 2001
From: Claes Wallin <claes.wallin@greatsinodevelopment.com>
Date: Thu, 25 Jun 2015 12:00:06 +0200
Subject: [PATCH 1/3] gnu: Add skalibs.

 * gnu/package/skarnet.scm (skalibs): New file.
 * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
 gnu-system.am            |  1 +
 gnu/packages/skarnet.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 gnu/packages/skarnet.scm

diff --git a/gnu-system.am b/gnu-system.am
index a420d71..7504b2a 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -273,6 +273,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/search.scm			\
   gnu/packages/serveez.scm			\
   gnu/packages/shishi.scm			\
+  gnu/packages/skarnet.scm			\
   gnu/packages/skribilo.scm			\
   gnu/packages/slang.scm			\
   gnu/packages/slim.scm				\
diff --git a/gnu/packages/skarnet.scm b/gnu/packages/skarnet.scm
new file mode 100644
index 0000000..3bdb90a
--- /dev/null
+++ b/gnu/packages/skarnet.scm
@@ -0,0 +1,54 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Claes Wallin <claes.wallin@greatsinodevelopment.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages skarnet)
+  #:use-module (gnu packages)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu))
+
+(define-public skalibs
+  (package
+    (name "skalibs")
+    (version "2.3.5.1")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "http://skarnet.org/software/skalibs/skalibs-"
+                          version ".tar.gz"))
+      (sha256
+       (base32
+        "1m31wph4qr4mqgv51nzwd9nw0x5vmpkcxr48i216wn3dpy3mvxwy"))))
+    (build-system gnu-build-system)
+    (search-paths
+     (list (search-path-specification
+            (variable "CPATH")
+            (files '("include")))
+           (search-path-specification
+            (variable "LIBRARY_PATH")
+            (files '("lib")))))
+    (arguments
+     '(#:configure-flags '("--enable-force-devr") ; do not analyze /dev/random
+       #:tests? #f)) ; no tests exist
+    (home-page "http://skarnet.org/software/skalibs/")
+    (synopsis "Common libraries for skarnet.org software")
+    (description
+     "General-purpose libraries for minimalist C development, used by all
+      skarnet.org software.")
+    (license isc)))
-- 
2.4.3


[-- Attachment #3: 0002-gnu-Add-execline.patch --]
[-- Type: application/octet-stream, Size: 3836 bytes --]

From 75b13e87271f8b8b0f54562a46aa6e7e437aacb9 Mon Sep 17 00:00:00 2001
From: Claes Wallin <claes.wallin@greatsinodevelopment.com>
Date: Thu, 25 Jun 2015 14:47:41 +0200
Subject: [PATCH 2/3] gnu: Add execline.

 * gnu/package/skarnet.scm (execline): New variable.
---
 gnu/packages/patches/execline-fix-gen-deps.patch | 12 ++++++
 gnu/packages/skarnet.scm                         | 50 ++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 gnu/packages/patches/execline-fix-gen-deps.patch

diff --git a/gnu/packages/patches/execline-fix-gen-deps.patch b/gnu/packages/patches/execline-fix-gen-deps.patch
new file mode 100644
index 0000000..79bdc95
--- /dev/null
+++ b/gnu/packages/patches/execline-fix-gen-deps.patch
@@ -0,0 +1,12 @@
+diff -NurbB execline-2.1.2.2.orig/tools/gen-deps.sh execline-2.1.2.2/tools/gen-deps.sh
+--- execline-2.1.2.2.orig/tools/gen-deps.sh	2015-01-13 23:18:13.000000000 +0100
++++ execline-2.1.2.2/tools/gen-deps.sh	2015-06-25 23:22:17.527553350 +0200
+@@ -71,7 +71,7 @@
+       if echo $dep | grep -q -- \\.o$ ; then
+         dep="src/$dir/$dep"
+       fi
+-      if echo $dep | grep -q '^\${.*_LIB}' ; then
++      if echo $dep | grep -qE '^\${.*_LIB}|^-l|^\${LIB.*}' ; then
+         libs="$libs $dep"
+       else
+         deps="$deps $dep"
diff --git a/gnu/packages/skarnet.scm b/gnu/packages/skarnet.scm
index 3bdb90a..08ebc7a 100644
--- a/gnu/packages/skarnet.scm
+++ b/gnu/packages/skarnet.scm
@@ -52,3 +52,53 @@
      "General-purpose libraries for minimalist C development, used by all
       skarnet.org software.")
     (license isc)))
+
+(define-public execline
+  (package
+    (name "execline")
+    (version "2.1.2.2")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "http://skarnet.org/software/execline/execline-"
+                          version ".tar.gz"))
+      (patches
+       (list (search-patch "execline-fix-gen-deps.patch")))
+      (sha256
+       (base32
+        "01pckac5zijf6icrhwicbmq92yq68gfkf1yl03rr2v4q3cn8r85f"))))
+    (build-system gnu-build-system)
+    (inputs `(("skalibs" ,skalibs)))
+    (arguments
+     '(#:configure-flags (list
+                          (string-append "--with-sysdeps="
+                                         (assoc-ref %build-inputs "skalibs")
+                                         "/lib/skalibs/sysdeps"))
+       #:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  (ice-9 popen))
+       #:phases (modify-phases %standard-phases
+                  (add-before
+                   'configure 'gen-deps
+                   (lambda _
+                     (let ((in  (open-input-pipe "./tools/gen-deps.sh"))
+                           (out (open-output-file "package/deps.mak")))
+                       (dump-port in out)
+                       (close-pipe in)
+                       (close-port out)))))
+       #:tests? #f)) ; No tests exist.
+    (home-page "http://skarnet.org/software/execline/")
+    (license isc)
+    (synopsis "Non-interactive shell-like language with minimal overhead")
+    (description
+     "Execline is a (non-interactive) scripting language, like sh, but its
+syntax is quite different from a traditional shell syntax.  The execlineb
+program is used strictly as a parser for a text file and generates a single
+command execution with the entire script stored in the argument array.
+The language is a library of binaries useful for the tail call or 
+chain execution style that the parser requires.
+
+It is as powerful as a shell: It features conditional loops,
+getopt-style option handling, filename globbing, and more.  Meanwhile, its
+syntax is unambiguous and simple, allowing a minimal parser, which doesn't
+even stay in memory when parsing is done and execution starts.")))
-- 
2.4.3


[-- Attachment #4: 0003-gnu-make-execline-commands-trivially-available-to-al.patch --]
[-- Type: application/octet-stream, Size: 1429 bytes --]

From e39ab44b8464aa14b25fc8554facd34411b926eb Mon Sep 17 00:00:00 2001
From: Claes Wallin <claes.wallin@greatsinodevelopment.com>
Date: Fri, 26 Jun 2015 00:45:41 +0200
Subject: [PATCH 3/3] gnu: make execline commands trivially available to all
 execline scripts

 * gnu/package/skarnet.scm (execline): wrap execlineb to have its own
                                       .../bin first in PATH
---
 gnu/packages/skarnet.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/skarnet.scm b/gnu/packages/skarnet.scm
index 08ebc7a..a75ca8b 100644
--- a/gnu/packages/skarnet.scm
+++ b/gnu/packages/skarnet.scm
@@ -85,7 +85,14 @@
                            (out (open-output-file "package/deps.mak")))
                        (dump-port in out)
                        (close-pipe in)
-                       (close-port out)))))
+                       (close-port out))))
+                  (add-after
+                   'install 'post-install
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (let* ((out (assoc-ref outputs "out"))
+                           (bin (string-append out "/bin")))
+                      (wrap-program (string-append bin "/execlineb")
+                        `("PATH" ":" prefix (,bin)))))))
        #:tests? #f)) ; No tests exist.
     (home-page "http://skarnet.org/software/execline/")
     (license isc)
-- 
2.4.3


             reply	other threads:[~2015-06-26  0:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  0:28 Claes Wallin (韋嘉誠) [this message]
2015-06-28 20:37 ` [PATCH] Add skalibs, execline Ludovic Courtès
2015-06-29  9:36   ` Claes Wallin (韋嘉誠)
2015-07-01 13:32     ` Ludovic Courtès
2015-07-01 17:03       ` Claes Wallin (韋嘉誠)
2015-07-04 15:14         ` Ludovic Courtès
2015-07-04 15:50           ` Claes Wallin (韋嘉誠)
2015-07-06 20:57     ` Claes Wallin (韋嘉誠)
2015-07-12 20:56       ` Ludovic Courtès
2015-07-13 10:38         ` Claes Wallin (韋嘉誠)

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='CAGv_=BpeYcDfMyjc2pxwEijEJUh3Yxgk7KS-eZKHMv+vrYFo1g@mail.gmail.com' \
    --to=gnu@clacke.user.lysator.liu.se \
    --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.