;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2020, 2021 Ludovic Courtès ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015, 2016 Federico Beffa ;;; Copyright © 2016 Ricardo Wurmus ;;; Copyright © 2016, 2017, 2020 Efraim Flashner ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016, 2017 Nikita ;;; Copyright © 2017 John Darrington ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2018 Adam Massmann ;;; Copyright © 2018 Gabriel Hondet ;;; Copyright © 2020 Pierre Neidhardt ;;; Copyright © 2020 Brett Gilio ;;; Copyright © 2020 Edouard Klein ;;; Copyright © 2021 Philip
aboutsummaryrefslogtreecommitdiff
blob: 7853acdd4948a517515f5a86f4be453b53cbc6cd (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#include "config.h"

#include <iostream>
#include <cstring>

#include "hash.hh"
#include "archive.hh"
#include "util.hh"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


namespace nix {


Hash::Hash()
{
    type = htUnknown;
    hashSize = 0;
    memset(hash, 0, maxHashSize);
}


Hash::Hash(HashType type)
{
    this->type = type;
    hashSize = gcry_md_get_algo_dlen(type);

    if (hashSize == 0) throw Error("unknown hash type");
    assert(hashSize <= maxHashSize);
    memset(hash, 0, maxHashSize);
}


bool Hash::operator == (const Hash & h2) const
{
    if (hashSize != h2.hashSize) return false;
    for (unsigned int i = 0; i < hashSize; i++)
        if (hash[i] != h2.hash[i]) return false;
    return true;
}


bool Hash::operator != (const Hash & h2) const
{
    return !(*this == h2);
}


bool Hash::operator < (const Hash & h) const
{
    for (unsigned int i = 0; i < hashSize; i++) {
        if (hash[i] < h.hash[i]) return true;
        if (hash[i] > h.hash[i]) return false;
    }
    return false;
}


const string base16Chars = "0123456789abcdef";


string printHash(const Hash & hash)
{
    char buf[hash.hashSize * 2];
    for (unsigned int i = 0; i < hash.hashSize; i++) {
        buf[i * 2] = base16Chars[hash.hash[i] >> 4];
        buf[i * 2 + 1] = base16Chars[hash.hash[i] & 0x0f];
    }
    return string(buf, hash.hashSize * 2);
}


Hash parseHash(HashType ht, const string & s)
{
    Hash hash(ht);
    if (s.length() != hash.hashSize * 2)
        throw Error(format("invalid hash `%1%'") % s);
    for (unsigned int i = 0; i < hash.hashSize; i++) {
        string s2(s, i * 2, 2);
        if (!isxdigit(s2[0]) || !isxdigit(s2[1]))
            throw Error(format("invalid hash `%1%'") % s);
        std::istringstream str(s2);
        int n;
        str >> std::hex >> n;
        hash.hash[i] = n;
    }
    return hash;
}


unsigned int hashLength32(const Hash & hash)
{
    return (hash.hashSize * 8 - 1) / 5 + 1;
}


// omitted: E O U T
const string base32Chars = "0123456789abcdfghijklmnpqrsvwxyz";


string printHash32(const Hash & hash)
{
    Hash hash2(hash);
    unsigned int len = hashLength32(hash);

    string s;
    s.reserve(len);

    for (int n = len - 1; n >= 0; n--) {
        unsigned int b = n * 5;
        unsigned int i = b / 8;
        unsigned int j = b % 8;
        unsigned char c =
            (hash.hash[i] >> j)
            | (i >= hash.hashSize - 1 ? 0 : hash.hash[i + 1] << (8 - j));
        s.push_back(base32Chars[c & 0x1f]);
    }

    return s;
}


string printHash16or32(const Hash & hash)
{
    return hash.type == htMD5 ? printHash(hash) : printHash32(hash);
}


Hash parseHash32(HashType ht, const string & s)
{
    Hash hash(ht);
    unsigned int len = hashLength32(ht);
    assert(s.size() == len);

    for (unsigned int n = 0; n < len; ++n) {
        char c = s[len - n - 1];
        unsigned char digit;
        for (digit = 0; digit < base32Chars.size(); ++digit) /* !!! slow */
            if (base32Chars[digit] == c) break;
        if (digit >= 32)
            throw Error(format("invalid base-32 hash '%1%'") % s);
        unsigned int b = n * 5;
        unsigned int i = b / 8;
        unsigned int j = b % 8;
        hash.hash[i] |= digit << j;
        if (i < hash.hashSize - 1) hash.hash[i + 1] |= digit >> (8 - j);
    }

    return hash;
}


Hash parseHash16or32(HashType ht, const string & s)
{
    Hash hash(ht);
    if (s.size() == hash.hashSize * 2)
        /* hexadecimal representation */
        hash = parseHash(ht, s);
    else if (s.size() == hashLength32(hash))
        /* base-32 representation */
        hash = parseHash32(ht, s);
    else
        throw Error(format("hash `%1%' has wrong length for hash type `%2%'")
            % s % printHashType(ht));
    return hash;
}


bool isHash(const string & s)
{
    if (s.length() != 32) return false;
    for (int i = 0; i < 32; i++) {
        char c = s[i];
        if (!((c >= '0' && c <= '9') ||
              (c >= 'a' && c <= 'f')))
            return false;
    }
    return true;
}

/* The "hash context".  */
struct Ctx
{
  /* This copy constructor is needed in 'HashSink::currentHash()' where we
     expect the copy of a 'Ctx' object to yield a truly different context.  */
  Ctx(Ctx &ref)
  {
    if (ref.md_handle == NULL)
      md_handle = NULL;
    else
      gcry_md_copy (&md_handle, ref.md_handle);
  }

  /* Make sure 'md_handle' is always initialized.  */
  Ctx(): md_handle (NULL) { };

  gcry_md_hd_t md_handle;
};


static void start(HashType ht, Ctx & ctx)
{
    gcry_error_t err;

    err = gcry_md_open (&ctx.md_handle, ht, 0);
    assert (err == GPG_ERR_NO_ERROR);
}


static void update(HashType ht, Ctx & ctx,
    const unsigned char * bytes, unsigned int len)
{
    gcry_md_write (ctx.md_handle, bytes, len);
}


static void finish(HashType ht, Ctx & ctx, unsigned char * hash)
{
    memcpy (hash, gcry_md_read (ctx.md_handle, ht),
	    gcry_md_get_algo_dlen (ht));
    gcry_md_close (ctx.md_handle);
    ctx.md_handle = NULL;
}


Hash hashString(HashType ht, const string & s)
{
    Ctx ctx;
    Hash hash(ht);
    start(ht, ctx);
    update(ht, ctx, (const unsigned char *) s.data(), s.length());
    finish(ht, ctx, hash.hash);
    return hash;
}


Hash hashFile(HashType ht, const Path & path)
{
    Ctx ctx;
    Hash hash(ht);
    start(ht, ctx);

    AutoCloseFD fd = open(path.c_str(), O_RDONLY);
    if (fd == -1) throw SysError(format("opening file `%1%'") % path);

    unsigned char buf[8192];
    ssize_t n;
    while ((n = read(fd, buf, sizeof(buf)))) {
        checkInterrupt();
        if (n == -1) throw SysError(format("reading file `%1%'") % path);
        update(ht, ctx, buf, n);
    }

    finish(ht, ctx, hash.hash);
    return hash;
}


HashSink::HashSink(HashType ht) : ht(ht)
{
    ctx = new Ctx;
    bytes = 0;
    start(ht, *ctx);
}

HashSink::~HashSink()
{
    bufPos = 0;
    delete ctx;
}

void HashSink::write(const unsigned char * data, size_t len)
{
    bytes += len;
    update(ht, *ctx, data, len);
}

HashResult HashSink::finish()
{
    flush();
    Hash hash(ht);
    nix::finish(ht, *ctx, hash.hash);
    return HashResult(hash, bytes);
}

HashResult HashSink::currentHash()
{
    flush();
    Ctx ctx2 = *ctx;
    Hash hash(ht);
    nix::finish(ht, ctx2, hash.hash);
    return HashResult(hash, bytes);
}


HashResult hashPath(
    HashType ht, const Path & path, PathFilter & filter)
{
    HashSink sink(ht);
    dumpPath(path, sink, filter);
    return sink.finish();
}


Hash compressHash(const Hash & hash, unsigned int newSize)
{
    Hash h;
    h.hashSize = newSize;
    for (unsigned int i = 0; i < hash.hashSize; ++i)
        h.hash[i % newSize] ^= hash.hash[i];
    return h;
}


HashType parseHashType(const string & s)
{
    if (s == "md5") return htMD5;
    else if (s == "sha1") return htSHA1;
    else if (s == "sha256") return htSHA256;
    else if (s == "sha512") return htSHA512;
    else if (s == "sha3-256") return htSHA3_256;
    else if (s == "sha3-512") return htSHA3_512;
    else if (s == "blake2s-256") return htBLAKE2s_256;
    else return htUnknown;
}


string printHashType(HashType ht)
{
    if (ht == htMD5) return "md5";
    else if (ht == htSHA1) return "sha1";
    else if (ht == htSHA256) return "sha256";
    else if (ht == htSHA512) return "sha512";
    else if (ht == htSHA3_256) return "sha3-256";
    else if (ht == htSHA3_512) return "sha3-512";
    else if (ht == htBLAKE2s_256) return "blake2s-256";
    else throw Error("cannot print unknown hash type");
}


}
g Scheme, a dialect of the Lisp programming language, the book explains core computer science concepts such as abstraction in programming, metalinguistic abstraction, recursion, interpreters, and modular programming.") (license cc-by-sa4.0)))) (define-public scheme48-rx (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d") (revision "2")) (package (name "scheme48-rx") (version (string-append "0.0.0-" revision "." (string-take commit 7))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/scheme/rx") (commit commit))) (sha256 (base32 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci")) (file-name (string-append name "-" version "-checkout")))) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) (let ((share (string-append %output "/share/scheme48-" ,(package-version scheme48) "/rx"))) (chdir (assoc-ref %build-inputs "source")) (mkdir-p share) (copy-recursively "." share) #t)))) (native-inputs `(("source" ,source) ("scheme48" ,scheme48))) (home-page "https://github.com/scheme/rx/") (synopsis "SRE String pattern-matching library for scheme48") (description "String pattern-matching library for scheme48 based on the SRE regular-expression notation.") (license bsd-3)))) (define-public slib (package (name "slib") (version "3b6") (source (origin (method url-fetch) (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-" version ".zip")) (sha256 (base32 "137dn2wwwwg0qbifgxfckjhzj4m4820crpg9kziv402l7f2b931f")))) (build-system gnu-build-system) (arguments `(#:tests? #f ; There is no check target. #:phases (modify-phases %standard-phases (add-after 'install 'remove-bin-share (lambda* (#:key inputs outputs #:allow-other-keys) (delete-file-recursively (string-append (assoc-ref outputs "out") "/bin")) #t)) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (invoke "./configure" (string-append "--prefix=" (assoc-ref outputs "out")))))))) (native-inputs (list unzip texinfo)) (home-page "https://people.csail.mit.edu/jaffer/SLIB.html") (synopsis "Compatibility and utility library for Scheme") (description "SLIB is a portable Scheme library providing compatibility and utility functions for all standard Scheme implementations.") (license (non-copyleft "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt" "Or see COPYING in the distribution.")))) (define-public scm (package (name "scm") (version "5f3") (source (origin (method url-fetch) (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-" version ".zip")) (sha256 (base32 "1jxxlhmgal26mpcl97kz37djkn97rfy9h5pvw0hah6f3f6w49j97")))) (build-system gnu-build-system) (arguments `(#:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (invoke "./configure" (string-append "--prefix=" (assoc-ref outputs "out"))))) (add-before 'build 'pre-build (lambda* (#:key inputs #:allow-other-keys) (substitute* "Makefile" (("ginstall-info") "install-info")) #t)) (replace 'build (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "SCHEME_LIBRARY_PATH" (search-input-directory inputs "lib/slib/")) (invoke "make" "scmlit" "CC=gcc") (invoke "make" "all"))) (add-after 'install 'post-install (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (req (string-append out "/lib/scm/require.scm"))) (delete-file req) (format (open req (logior O_WRONLY O_CREAT)) "(define (library-vicinity) ~s)\n" (search-input-directory inputs "lib/slib/")) ;; We must generate the slibcat file. (invoke (string-append out "/bin/scm") "-br" "new-catalog"))))))) (inputs (list slib)) (native-inputs (list unzip texinfo)) (home-page "https://people.csail.mit.edu/jaffer/SCM") (synopsis "Scheme implementation conforming to R5RS and IEEE P1178") (description "GNU SCM is an implementation of Scheme. This implementation includes Hobbit, a Scheme-to-C compiler, which can generate C files whose binaries can be dynamically or statically linked with a SCM executable.") (license lgpl3+))) (define-public tinyscheme (package (name "tinyscheme") (version "1.42") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/" name "/" name "/" name "-" version "/" name "-" version ".zip")) (sha256 (base32 "0rik3qnxqd8wjlazx8rw996pfzkjjg60v6hcbpcqzi7rgml8q4n8")))) (build-system gnu-build-system) (native-inputs (list unzip)) (arguments `(#:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source #:allow-other-keys) (invoke "unzip" source) (chdir (string-append ,name "-" ,version)) #t)) (add-after 'unpack 'set-scm-directory ;; Hard-code ‘our’ init.scm instead of looking in the current ;; working directory, so invoking ‘scheme’ just works. (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (scm (string-append out "/share/" ,name))) (substitute* "scheme.c" (("init.scm" all) (string-append scm "/" all))) #t))) (delete 'configure) ; no configure script (replace 'install ;; There's no ‘install’ target. Install files manually. (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (doc (string-append out "/share/doc/" ,name "-" ,version)) (include (string-append out "/include")) (lib (string-append out "/lib")) (scm (string-append out "/share/" ,name))) (install-file "scheme" bin) (install-file "Manual.txt" doc) (install-file "scheme.h" include) (install-file "libtinyscheme.so" lib) (install-file "init.scm" scm) #t)))) #:tests? #f)) ; no tests (home-page "http://tinyscheme.sourceforge.net/") (synopsis "Light-weight interpreter for the Scheme programming language") (description "TinyScheme is a light-weight Scheme interpreter that implements as large a subset of R5RS as was possible without getting very large and complicated. It's meant to be used as an embedded scripting interpreter for other programs. As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or extensive toolkits, although it does sport a small (and optional) top-level loop. As an embedded interpreter, it allows multiple interpreter states to coexist in the same program, without any interference between them. Foreign functions in C can be added and values can be defined in the Scheme environment. Being quite a small program, it is easy to comprehend, get to grips with, and use.") (license bsd-3))) ; there are no licence headers (define-public stalin (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be")) ;; FIXME: The Stalin "source" contains C code generated by itself: ;; 'stalin-AMD64.c', etc. (package (name "stalin") (version "0.11") (source (origin ;; Use Pearlmutter's upstream branch with AMD64 patches ;; applied. Saves us from including those 20M! patches ;; in Guix. For more info, see: ;; (method git-fetch) (uri (git-reference (url "https://github.com/barak/stalin") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn")) (modules '((guix build utils))) (snippet ;; remove gc libs from build, we have them as input '(begin (delete-file "gc6.8.tar.gz") (delete-file-recursively "benchmarks") (substitute* "build" ((".*gc6.8.*") "") ((" cd \\.\\.") "") ((".*B include/libgc.a") "") ((".*make.*") "")) #t)))) (build-system gnu-build-system) (arguments `(#:make-flags (list "ARCH_OPTS=-freg-struct-return") #:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (include-out (string-append out "/include"))) (invoke "./build") (for-each (lambda (fname) (install-file fname include-out)) (find-files "include")) (substitute* "makefile" (("\\./include") include-out)) (substitute* "post-make" (("`pwd`") out)) #t))) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (install-file "stalin.1" (string-append out "/share/man/man1")) (install-file "stalin" (string-append out "/bin")) #t)))))) (inputs (list libx11)) (propagated-inputs (list libgc)) (supported-systems '("x86_64-linux")) (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf") (synopsis "Brutally efficient Scheme compiler") (description "Stalin is an aggressively optimizing whole-program compiler for Scheme that does polyvariant interprocedural flow analysis, flow-directed interprocedural escape analysis, flow-directed lightweight CPS conversion, flow-directed lightweight closure conversion, flow-directed interprocedural lifetime analysis, automatic in-lining, unboxing, and flow-directed program-specific and program-point-specific low-level representation selection and code generation.") (license gpl2+)))) (define-public s9fes (package (name "s9fes") (version "20181205") (source (origin (method url-fetch) (uri (string-append "https://www.t3x.org/s9fes/s9fes-" version ".tgz")) (sha256 (base32 "0ynpl707bc9drwkdpdgvw14bz9zmwd3wffl1k02sxppjl28xm7rf")))) (build-system gnu-build-system) (arguments `(#:make-flags (list (string-append "CC=" ,(cc-for-target)) (string-append "PREFIX=" %output)) #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "install-all" make-flags)))) #:tests? #f)) ; No check target. (inputs (list ncurses)) (home-page "https://www.t3x.org/s9fes/") (synopsis "Interpreter for R4RS Scheme") (description "Scheme 9 from Empty Space (S9fES) is a mature, portable, and comprehensible public-domain interpreter for R4RS Scheme offering: @itemize @item bignum arithmetics @item decimal-based real number arithmetics @item support for low-level Unix programming @item cursor addressing with Curses @item basic networking procedures @item an integrated online help system @item loads of useful library functions @end itemize") (license public-domain))) (define-public femtolisp (let ((commit "ec7601076a976f845bc05ad6bd3ed5b8cde58a97") (revision "2")) (package (name "femtolisp") (version (string-append "0.0.0-" revision "." (string-take commit 7))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/JeffBezanson/femtolisp") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1fcyiqlqn27nd4wxi27km8mhmlzpzzsxzpwsl1bxbmhraq468njw")))) ;; See "utils.h" for supported systems. Upstream bug: ;; https://github.com/JeffBezanson/femtolisp/issues/25 (supported-systems (fold delete %supported-systems '("armhf-linux" "mips64el-linux" "aarch64-linux"))) (build-system gnu-build-system) (arguments `(#:make-flags '("CC=gcc" "release") #:test-target "test" #:phases (modify-phases %standard-phases (delete 'bootstrap) (delete 'configure) ; No configure script (replace 'install ; Makefile has no 'install phase (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) (install-file "flisp" bin) #t))) ;; The flisp binary is now available, run bootstrap to ;; generate flisp.boot and afterwards runs make test. (add-after 'install 'bootstrap-gen-and-test (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) (invoke "./bootstrap.sh") (install-file "flisp.boot" bin) #t)))))) (synopsis "Scheme-like lisp implementation") (description "@code{femtolisp} is a scheme-like lisp implementation with a simple, elegant Scheme dialect. It is a lisp-1 with lexical scope. The core is 12 builtin special forms and 33 builtin functions.") (home-page "https://github.com/JeffBezanson/femtolisp") (license bsd-3)))) (define-public gauche (package (name "gauche") (version "0.9.10") (home-page "https://practical-scheme.net/gauche/index.html") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/gauche/Gauche/Gauche-" version ".tgz")) (sha256 (base32 "0ci57ak5cp3lkmfy3nh50hifh8nbg58hh6r18asq0rn5mqfxyf8g")) (modules '((guix build utils))) (snippet '(begin ;; Remove libatomic-ops. (delete-file-recursively "gc/libatomic_ops") #t)))) (build-system gnu-build-system) (inputs (list libatomic-ops slib zlib)) (native-inputs (list texinfo openssl ; needed for tests pkg-config)) ; needed to find external libatomic-ops (arguments `(#:configure-flags (list (string-append "--with-slib=" (assoc-ref %build-inputs "slib") "/lib/slib")) #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-/bin/sh ;; Needed only for tests. (lambda _ (substitute* '("test/www.scm" "ext/tls/test.scm" "lib/gauche/package/util.scm" "libsrc/gauche/process.scm") (("/bin/sh") (which "sh"))) #t)) (add-after 'build 'build-doc (lambda _ (with-directory-excursion "doc" (invoke "make" "info")) #t)) (add-before 'check 'patch-network-tests ;; Remove net checks. (lambda _ (delete-file "ext/net/test.scm") (invoke "touch" "ext/net/test.scm") #t)) (add-after 'install 'install-docs (lambda _ (with-directory-excursion "doc" (invoke "make" "install")) #t))))) (synopsis "Scheme scripting engine") (description "Gauche is a R7RS Scheme scripting engine aiming at being a handy tool that helps programmers and system administrators to write small to large scripts quickly. Quick startup, built-in system interface, native multilingual support are some of the goals. Gauche comes with a package manager/installer @code{gauche-package} which can download, compile, install and list gauche extension packages.") (license bsd-3))) (define-public gerbil (package (name "gerbil") (version "0.16") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/vyzo/gerbil") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0vng0kxpnwsg8jbjdpyn4sdww36jz7zfpfbzayg9sdpz6bjxjy0f")))) (arguments `(#:phases (modify-phases %standard-phases (delete 'bootstrap) (add-before 'configure 'chdir (lambda _ (chdir "src") #t)) (replace 'configure (lambda* (#:key outputs inputs #:allow-other-keys) (invoke "chmod" "755" "-R" ".") ;; Otherwise fails when editing an r--r--r-- file. (invoke "gsi-script" "configure" "--prefix" (assoc-ref outputs "out") "--with-gambit" (assoc-ref inputs "gambit-c")))) (add-before 'patch-generated-file-shebangs 'fix-gxi-shebangs (lambda _ ;; Some .ss files refer to gxi using /usr/bin/env gxi ;; and 'patch-generated-file-shebangs can't fix that ;; because gxi has not been compiled yet. ;; We know where gxi is going to end up so we ;; Doctor Who our fix here before the problem ;; happens towards the end of the build.sh script. (let ((abs-srcdir (getcwd))) (for-each (lambda (f) (substitute* f (("#!/usr/bin/env gxi") (string-append "#!" abs-srcdir "/../bin/gxi")))) '("./gerbil/gxc" "./lang/build.ss" "./misc/http-perf/build.ss" "./misc/rpc-perf/build.ss" "./misc/scripts/docsnarf.ss" "./misc/scripts/docstub.ss" "./misc/scripts/docsyms.ss" "./r7rs-large/build.ss" "./release.ss" "./std/build.ss" "./std/run-tests.ss" "./std/web/fastcgi-test.ss" "./std/web/rack-test.ss" "./tools/build.ss" "./tutorial/httpd/build.ss" "./tutorial/kvstore/build.ss" "./tutorial/lang/build.ss" "./tutorial/proxy/build-static.ss" "./tutorial/proxy/build.ss"))) #t)) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (setenv "HOME" (getcwd)) (invoke ;; The build script needs a tty or it'll crash on an ioctl ;; trying to find the width of the terminal it's running on. ;; Calling in script prevents that. "script" "-qefc" "./build.sh"))) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (lib (string-append out "/lib"))) (mkdir-p bin) (mkdir-p lib) (copy-recursively "../bin" bin) (copy-recursively "../lib" lib))))))) (native-inputs (list coreutils util-linux)) (propagated-inputs (list gambit-c zlib openssl sqlite)) (build-system gnu-build-system) (synopsis "Meta-dialect of Scheme with post-modern features") (description "Gerbil is an opinionated dialect of Scheme designed for Systems Programming, with a state of the art macro and module system on top of the Gambit runtime. The macro system is based on quote-syntax, and provides the full meta-syntactic tower with a native implementation of syntax-case. It also provides a full-blown module system, similar to PLT Scheme's (sorry, Racket) modules. The main difference from Racket is that Gerbil modules are single instantiation, supporting high performance ahead of time compilation and compiled macros.") (home-page "https://cons.io") (license `(,lgpl2.1 ,asl2.0))))