gnu: Add envstore.
[jackhill/guix/guix.git] / gnu / packages / lsh.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages lsh)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages m4)
26 #:use-module (gnu packages linux)
27 #:use-module (gnu packages nettle)
28 #:use-module ((gnu packages compression) #:prefix guix:)
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages readline)
31 #:use-module (gnu packages gperf)
32 #:use-module (gnu packages guile)
33 #:use-module (gnu packages xorg))
34
35 (define-public liboop
36 (package
37 (name "liboop")
38 (version "1.0")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "http://download.ofb.net/liboop/liboop-"
43 version ".tar.gz"))
44 (sha256
45 (base32
46 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
47 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
48 (build-system gnu-build-system)
49 (home-page "http://www.lysator.liu.se/liboop/")
50 (synopsis "Event loop library")
51 (description "Liboop is a low-level event loop management library for
52 POSIX-based operating systems. It supports the development of modular,
53 multiplexed applications which may respond to events from several sources. It
54 replaces the \"select() loop\" and allows the registration of event handlers
55 for file and network I/O, timers and signals. Since processes use these
56 mechanisms for almost all external communication, liboop can be used as the
57 basis for almost any application.")
58 (license lgpl2.1+)))
59
60 (define-public lsh
61 (package
62 (name "lsh")
63 (version "2.1")
64 (source (origin
65 (method url-fetch)
66 (uri (string-append "mirror://gnu/lsh/lsh-"
67 version ".tar.gz"))
68 (sha256
69 (base32
70 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
71 (modules '((guix build utils)))
72 (snippet
73 '(begin
74 (substitute* "src/testsuite/functions.sh"
75 (("localhost")
76 ;; Avoid host name lookups since they don't work in
77 ;; chroot builds.
78 "127.0.0.1")
79 (("set -e")
80 ;; Make tests more verbose.
81 "set -e\nset -x"))
82
83 (substitute* (find-files "src/testsuite" "-test$")
84 (("localhost") "127.0.0.1"))
85
86 (substitute* "src/testsuite/login-auth-test"
87 (("/bin/cat") "cat"))))))
88 (build-system gnu-build-system)
89 (native-inputs
90 `(("m4" ,m4)
91 ("guile" ,guile-2.0)
92 ("gperf" ,gperf)
93 ("psmisc" ,psmisc))) ; for `killall'
94 (inputs
95 `(("nettle" ,nettle-2)
96 ("linux-pam" ,linux-pam)
97
98 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
99 ;; Readline 6.3.
100 ("readline" ,readline-6.2)
101
102 ("liboop" ,liboop)
103 ("zlib" ,guix:zlib)
104 ("gmp" ,gmp)
105
106 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
107 ;; This adds 24 MiB (or 27%) to the closure of lsh.
108 ("xauth" ,xauth)))
109 (arguments
110 '(;; Skip the `configure' test that checks whether /dev/ptmx &
111 ;; co. work as expected, because it relies on impurities (for
112 ;; instance, /dev/pts may be unavailable in chroots.)
113 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes")
114
115 ;; FIXME: Tests won't run in a chroot, presumably because
116 ;; /etc/profile is missing, and thus clients get an empty $PATH
117 ;; and nothing works.
118 #:tests? #f
119
120 #:phases
121 (modify-phases %standard-phases
122 (add-before 'configure 'pre-configure
123 (lambda* (#:key inputs #:allow-other-keys)
124 (let* ((nettle (assoc-ref inputs "nettle"))
125 (sexp-conv (string-append nettle "/bin/sexp-conv")))
126 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
127 ;; by default.
128 (substitute* "src/environ.h.in"
129 (("^#define PATH_SEXP_CONV.*")
130 (string-append "#define PATH_SEXP_CONV \""
131 sexp-conv "\"\n")))
132
133 ;; Same for the 'lsh-authorize' script.
134 (substitute* "src/lsh-authorize"
135 (("=sexp-conv")
136 (string-append "=" sexp-conv)))
137
138 ;; Tell lshd where 'xauth' lives. Another option would be to
139 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
140 ;; reducing the closure size, but that wouldn't work on foreign
141 ;; distros.
142 (with-fluids ((%default-port-encoding "ISO-8859-1"))
143 (substitute* "src/server_x11.c"
144 (("define XAUTH_PROGRAM.*")
145 (string-append "define XAUTH_PROGRAM \""
146 (assoc-ref inputs "xauth")
147 "/bin/xauth\"\n")))))
148
149 ;; Tests rely on $USER being set.
150 (setenv "USER" "guix"))))))
151 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
152 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
153 (description
154 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
155 used to create a secure line of communication between two computers,
156 providing shell access to the server system from the client. It provides
157 both the server daemon and the client application, as well as tools for
158 manipulating key files.")
159 (license gpl2+)))