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

