adjust some desc indentation
[mudsync.git] / guix.scm
1 ;;; mudsync --- Live hackable MUDs in Guile
2 ;;; Copyright (C) 2016 Jan Nieuwenhuizen <janneke@gnu.org>
3 ;;; Copyright (C) 2017 Christopher Allan Webber <cwebber@dustycloud.org>
4 ;;;
5 ;;; Also borrowing code from:
6 ;;; guile-sdl2 --- FFI bindings for SDL2
7 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
8 ;;;
9 ;;; This program is free software: you can redistribute it and/or modify
10 ;;; it under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation, either version 3 of the License, or
12 ;;; (at your option) any later version.
13 ;;;
14 ;;; This program is distributed in the hope that it will be useful,
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;;; GNU General Public License for more details.
18 ;;; 
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23 ;;
24 ;; GNU Guix development package.  To build and install, run:
25 ;;
26 ;;   guix package -f guix.scm
27 ;;
28 ;; To build it, but not install it, run:
29 ;;
30 ;;   guix build -f guix.scm
31 ;;
32 ;; To use as the basis for a development environment, run:
33 ;;
34 ;;   guix environment -l guix.scm
35 ;;
36 ;;; Code:
37
38 (use-modules (srfi srfi-1)
39              (srfi srfi-26)
40              (ice-9 popen)
41              (ice-9 match)
42              (ice-9 rdelim)
43              (guix download)
44              (guix packages)
45              (guix licenses)
46              (guix gexp)
47              (guix git-download)
48              (guix build-system gnu)
49              ((guix build utils) #:select (with-directory-excursion))
50              (gnu packages)
51              (gnu packages autotools)
52              (gnu packages guile)
53              (gnu packages pkg-config)
54              (gnu packages texinfo))
55
56 (define %source-dir (dirname (current-filename)))
57
58 (define git-file?
59   (let* ((pipe (with-directory-excursion %source-dir
60                  (open-pipe* OPEN_READ "git" "ls-files")))
61          (files (let loop ((lines '()))
62                   (match (read-line pipe)
63                     ((? eof-object?)
64                      (reverse lines))
65                     (line
66                      (loop (cons line lines))))))
67          (status (close-pipe pipe)))
68     (lambda (file stat)
69       (match (stat:type stat)
70         ('directory #t)
71         ((or 'regular 'symlink)
72          (any (cut string-suffix? <> file) files))
73         (_ #f)))))
74
75 (define guile-without-select-bug
76   (package
77    (inherit guile-next)
78    (version (package-version guile-next))
79    (source (origin
80               (method url-fetch)
81               (uri (string-append "ftp://alpha.gnu.org/gnu/guile/guile-"
82                                   version ".tar.xz"))
83               (sha256
84                (base32
85                 "0r9y4hw17dlxahik4zsccfb2f3p2a07wqndfm251bgmam9hln6gi"))
86               (modules '((guix build utils)))
87
88               ;; Remove the pre-built object files.  Instead, build everything
89               ;; from source, at the expense of significantly longer build
90               ;; times (almost 3 hours on a 4-core Intel i5).
91               (snippet '(for-each delete-file
92                                   (find-files "prebuilt" "\\.go$")))
93
94               ;; Here's what we're adding
95               (patches (list (string-append %source-dir
96                                             "/build-aux/patch-guile-fix-live-repl.patch")))))))
97
98 (package
99   (name "guile-mudsync")
100   (version "git")
101   (source (local-file %source-dir #:recursive? #t #:select? git-file?))
102   (build-system gnu-build-system)
103   (native-inputs `(("autoconf" ,autoconf)
104                    ("automake" ,automake)
105                    ("guile" ,guile-without-select-bug)
106                    ("guile-8sync" ,guile-8sync)
107                    ("guile-irregex" ,guile2.2-irregex)
108                    ("pkg-config" ,pkg-config)
109                    ("texinfo" ,texinfo)))
110   (arguments
111    `(#:phases (modify-phases %standard-phases
112                 (add-before 'configure 'bootstrap
113                             (lambda _
114                               (zero? (system* "./bootstrap.sh"))))
115                 (add-before 'configure 'setenv
116                             (lambda _
117                               (setenv "GUILE_AUTO_COMPILE" "0"))))))
118   (home-page "https://notabug.org/cwebber/mudsync/")
119   (synopsis "Live hackable MUD system")
120   (description
121    "GNU 8sync (pronounced \"eight-sync\") is an asynchronous programming
122 library for GNU Guile based on the actor model.")
123   (license gpl3+))