diff mbox

[1/2] gnu: Add stfl.

Message ID 20161110082736.5825-2-efraim@flashner.co.il
State New
Headers show

Commit Message

Efraim Flashner Nov. 10, 2016, 8:27 a.m. UTC
* gnu/packages/ncurses.scm (stfl): New variable.
---
 gnu/packages/ncurses.scm | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

Comments

Marius Bakke Nov. 10, 2016, 3:22 p.m. UTC | #1
Efraim Flashner <efraim@flashner.co.il> writes:

> * gnu/packages/ncurses.scm (stfl): New variable.
> ---
>  gnu/packages/ncurses.scm | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
> index 9799167..468cd99 100644
> --- a/gnu/packages/ncurses.scm
> +++ b/gnu/packages/ncurses.scm
> @@ -3,6 +3,7 @@
>  ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
>  ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
>  ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
> +;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -26,7 +27,8 @@
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system perl)
>    #:use-module (gnu packages)
> -  #:use-module (gnu packages perl))
> +  #:use-module (gnu packages perl)
> +  #:use-module (gnu packages swig))
>  
>  (define-public ncurses
>    (let ((patch-makefile-phase
> @@ -207,3 +209,49 @@ curses widgets, such as dialog boxes.")
>       "@code{Curses} is the interface between Perl and the curses library
>  of your system.")
>      (license (package-license perl))))
> +
> +(define-public stfl
> +  (package
> +    (name "stfl")
> +    (version "0.24")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append "http://www.clifford.at/stfl/stfl-"
> +                            version ".tar.gz"))
> +        (sha256
> +         (base32
> +          "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     '(#:tests? #f ; no test target
> +       #:phases
> +       (modify-phases %standard-phases
> +         ;; there is no configure script so we get to do it manually
> +         (replace 'configure
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (substitute* "Makefile"
> +               (("\\$\\(prefix\\)") (assoc-ref outputs "out")))
> +             (setenv "DESTDIR" "")
> +             #t))

Would it work to simply (setenv "prefix" out), instead of substituting?
Not sure which approach I prefer however, so feel free to disregard this.

> +         ;; in our ncurses, the headers are in /include
> +         (add-before 'build 'patch-ncursesw
> +           (lambda _
> +             (substitute* '("stfl_internals.h")
> +               (("ncursesw/") ""))
> +             #t))
> +         (add-after 'install 'install-missing-symlink
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (lib (string-append out "/lib")))
> +               ;; newsbeuter looks for libstfl.so.0

Perhaps just say "some programs" instead of newsbeuter, since they are
mostly unrelated.

> +               (symlink "libstfl.so"
> +                        (string-append lib "/libstfl.so.0"))))))))
> +    (inputs
> +     `(("ncurses" ,ncurses)
> +       ("swig" ,swig)))

Swig should probably be a native-input. Other than that LGTM!

> +    (home-page "http://www.clifford.at/stfl/")
> +    (synopsis "Structured terminal forms library")
> +    (description "Stfl is a library which implements a curses-based widget
> +set for text terminals.")
> +    (license lgpl3+)))
> -- 
> 2.10.2
Efraim Flashner Nov. 10, 2016, 5:22 p.m. UTC | #2
On Thu, Nov 10, 2016 at 03:22:54PM +0000, Marius Bakke wrote:
> Efraim Flashner <efraim@flashner.co.il> writes:
> 
> > * gnu/packages/ncurses.scm (stfl): New variable.
> > ---
> >  gnu/packages/ncurses.scm | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 49 insertions(+), 1 deletion(-)
> >
> > +         ;; there is no configure script so we get to do it manually
> > +         (replace 'configure
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (substitute* "Makefile"
> > +               (("\\$\\(prefix\\)") (assoc-ref outputs "out")))
> > +             (setenv "DESTDIR" "")
> > +             #t))
> 
> Would it work to simply (setenv "prefix" out), instead of substituting?
> Not sure which approach I prefer however, so feel free to disregard this.
> 

It turns out it does work.  Its also much shorter.
Even better, I figured out how to turn them into make-flags

#:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
                   "DESTDIR=\"\"")

> > +         ;; in our ncurses, the headers are in /include
> > +         (add-before 'build 'patch-ncursesw
> > +           (lambda _
> > +             (substitute* '("stfl_internals.h")
> > +               (("ncursesw/") ""))
> > +             #t))
> > +         (add-after 'install 'install-missing-symlink
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let* ((out (assoc-ref outputs "out"))
> > +                    (lib (string-append out "/lib")))
> > +               ;; newsbeuter looks for libstfl.so.0
> 
> Perhaps just say "some programs" instead of newsbeuter, since they are
> mostly unrelated.
> 
> > +               (symlink "libstfl.so"
> > +                        (string-append lib "/libstfl.so.0"))))))))
> > +    (inputs
> > +     `(("ncurses" ,ncurses)
> > +       ("swig" ,swig)))
> 
> Swig should probably be a native-input. Other than that LGTM!
> 

I thought the output referred to swig, but it seems not.

> > +    (home-page "http://www.clifford.at/stfl/")
> > +    (synopsis "Structured terminal forms library")
> > +    (description "Stfl is a library which implements a curses-based widget
> > +set for text terminals.")
> > +    (license lgpl3+)))
> > -- 
> > 2.10.2
Tobias Geerinckx-Rice Nov. 11, 2016, 10:18 a.m. UTC | #3
Efraim,

(A detail:)

Efraim Flashner schreef op 2016-11-10 18:22:
>                    "DESTDIR=\"\"")

Are those quotes needed to work around some silliness in the Makefile?

Otherwise,

   "DESTDIR="

should work just as well and is easier on the eyes.

Kind regards,

T G-R
Efraim Flashner Nov. 11, 2016, 12:15 p.m. UTC | #4
On Fri, Nov 11, 2016 at 11:18:51AM +0100, Tobias Geerinckx-Rice wrote:
> Efraim,
> 
> (A detail:)
> 
> Efraim Flashner schreef op 2016-11-10 18:22:
> >                    "DESTDIR=\"\"")
> 
> Are those quotes needed to work around some silliness in the Makefile?
> 
> Otherwise,
> 
>   "DESTDIR="
> 
> should work just as well and is easier on the eyes.
> 
> Kind regards,
> 
> T G-R

it tries to install to $DESTDIR${prefix} (or something strange like
that), but it turns out that if DESTDIR is left alone it's already
empty, so I just took that part out.
diff mbox

Patch

diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 9799167..468cd99 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,8 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system perl)
   #:use-module (gnu packages)
-  #:use-module (gnu packages perl))
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages swig))
 
 (define-public ncurses
   (let ((patch-makefile-phase
@@ -207,3 +209,49 @@  curses widgets, such as dialog boxes.")
      "@code{Curses} is the interface between Perl and the curses library
 of your system.")
     (license (package-license perl))))
+
+(define-public stfl
+  (package
+    (name "stfl")
+    (version "0.24")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "http://www.clifford.at/stfl/stfl-"
+                            version ".tar.gz"))
+        (sha256
+         (base32
+          "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f ; no test target
+       #:phases
+       (modify-phases %standard-phases
+         ;; there is no configure script so we get to do it manually
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "Makefile"
+               (("\\$\\(prefix\\)") (assoc-ref outputs "out")))
+             (setenv "DESTDIR" "")
+             #t))
+         ;; in our ncurses, the headers are in /include
+         (add-before 'build 'patch-ncursesw
+           (lambda _
+             (substitute* '("stfl_internals.h")
+               (("ncursesw/") ""))
+             #t))
+         (add-after 'install 'install-missing-symlink
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib")))
+               ;; newsbeuter looks for libstfl.so.0
+               (symlink "libstfl.so"
+                        (string-append lib "/libstfl.so.0"))))))))
+    (inputs
+     `(("ncurses" ,ncurses)
+       ("swig" ,swig)))
+    (home-page "http://www.clifford.at/stfl/")
+    (synopsis "Structured terminal forms library")
+    (description "Stfl is a library which implements a curses-based widget
+set for text terminals.")
+    (license lgpl3+)))