a first working version of guix.scm
[oweals/gnunet.git] / guix.scm
1 ;;; This file is part of GNUnet.
2 ;;; Copyright (C) 2016 GNUnet e.V.
3 ;;;
4 ;;; GNUnet is free software; you can redistribute it and/or modify
5 ;;; it under the terms of the GNU General Public License as published
6 ;;; by the Free Software Foundation; either version 3, or (at your
7 ;;; option) any later version.
8 ;;;
9 ;;; GNUnet is distributed in the hope that it will be useful, but
10 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 ;;; General Public License for more details.
13 ;;;
14 ;;; You should have received a copy of the GNU General Public License
15 ;;; along with GNUnet; see the file COPYING.  If not, write to the
16 ;;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 ;;; Boston, MA 02110-1301, USA.
18 ;;;
19 ;;;
20 ;;; Author: N. Gillmann <ng0@runbox.com>
21 ;;;
22 ;;; Parts borrowed here from pubstrate
23 ;;;
24 ;;; Pubstrate is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27 ;;; General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with Pubstrate.  If not, see <http://www.gnu.org/licenses/>.
31 ;;;
32 ;;; Parts borrowed here from guile-sdl2
33 ;;;
34 ;;; Guile-sdl2 is distributed in the hope that it will be useful, but
35 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
36 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
37 ;;; General Public License for more details.
38 ;;;
39 ;;; You should have received a copy of the GNU Lesser General Public
40 ;;; License along with guile-sdl2.  If not, see
41 ;;; <http://www.gnu.org/licenses/>.
42
43 ;; Guix package for GNUnet development
44 ;;
45 ;; INSTALL
46 ;;
47 ;; To build and install the package in the user environment, use:
48 ;;
49 ;; .. to be documented
50 ;;
51 ;; BUILD ONLY
52 ;;
53 ;; To build the package and add it to the gnu store, use:
54 ;;
55 ;; $ guix build -f guix.scm
56
57 (use-modules (ice-9 popen)
58              (ice-9 match)
59              (ice-9 rdelim)
60              (guix packages)
61              (guix build-system gnu)
62              (guix gexp)
63              ((guix build utils) #:select (with-directory-excursion))
64              (gnu packages)
65              (gnu packages base)
66              (gnu packages gnunet)
67              (gnu packages file)
68              (gnu packages aidc)
69              (gnu packages autotools)
70              (gnu packages compression)
71              (gnu packages curl)
72              (gnu packages geeqie)
73              (gnu packages gettext)
74              (gnu packages glib)
75              (gnu packages gnome)
76              (gnu packages gnupg)
77              (gnu packages groff)
78              (gnu packages gtk)
79              (gnu packages guile)
80              (gnu packages gstreamer)
81              (gnu packages gnuzilla)
82              (gnu packages libidn)
83              (gnu packages linux)
84              (gnu packages image)
85              (gnu packages libunistring)
86              (gnu packages maths)
87              (gnu packages multiprecision)
88              (gnu packages pkg-config)
89              (gnu packages perl)
90              (gnu packages pulseaudio)
91              (gnu packages python)
92              (gnu packages databases)
93              (gnu packages tls)
94              (gnu packages tex)
95              (gnu packages video)
96              (gnu packages web)
97              (gnu packages xiph)
98              (gnu packages backup)
99              ((guix licenses) #:prefix license:))
100
101
102 (define %source-dir (dirname (current-filename)))
103
104 (define git-file?
105   (let* ((pipe (with-directory-excursion %source-dir
106                  (open-pipe* OPEN_READ "svn" "ls" "-R")))
107          (files (let loop ((lines '()))
108                   (match (read-line pipe)
109                     ((? eof-object?)
110                      (reverse lines))
111                     (line
112                      (loop (cons line lines))))))
113          (status (close-pipe pipe)))
114     (lambda (file stat)
115       (match (stat:type stat)
116         ('directory #t)
117         ((or 'regular 'symlink)
118          (any (cut string-suffix? <> file) files))
119         (_ #f)))))
120
121 (define gnunet-svn
122   (package
123     (name "gnunet")
124     (version "8000")
125     (source
126      (local-file %source-dir
127                  #:recursive? #t))
128                  ;;#:select? git-file?))
129     (build-system gnu-build-system)
130     (inputs
131      `(("glpk" ,glpk)
132        ("gnurl" ,gnurl)
133        ("gstreamer" ,gstreamer)
134        ("gst-plugins-base" ,gst-plugins-base)
135        ("gnutls" ,gnutls)
136        ("libextractor" ,libextractor)
137        ("libgcrypt" ,libgcrypt)
138        ("libidn" ,libidn)
139        ("libmicrohttpd" ,libmicrohttpd)
140        ("libltdl" ,libltdl)
141        ("libunistring" ,libunistring)
142        ("openssl" ,openssl)
143        ("opus" ,opus)
144        ("pulseaudio" ,pulseaudio)
145        ("sqlite" ,sqlite)
146        ("zlib" ,zlib)
147        ("perl" ,perl)
148        ("python" ,python) ; tests and gnunet-qr
149        ("jansson" ,jansson)
150        ("nss" ,nss)
151        ("gmp" ,gmp)
152        ("bluez" ,bluez) ; for optional bluetooth feature
153        ("glib" ,glib)
154        ;;("texlive-minimal" ,texlive-minimal) ; optional.
155        ("libogg" ,libogg)))
156     (native-inputs
157      `(("pkg-config" ,pkg-config)
158        ("autoconf" ,autoconf)
159        ("automake" ,automake)
160        ("gnu-gettext" ,gnu-gettext)
161        ("libtool" ,libtool)))
162     (arguments
163      `(#:configure-flags
164        (list (string-append "--with-nssdir=" %output "/lib")
165              "--enable-experimental")
166              ;;"--enable-gcc-hardening"
167              ;;"--enable-linker-hardening"
168              ;;"--enable-logging=verbose")
169              ;;"--enable-poisoning")
170        ;;#:parallel-tests? #f ; parallel building seems to fail
171        ;;#:tests? #f ; fail: test_gnunet_statistics.py
172        #:phases
173        ;; swap check and install phases and set paths to installed bin
174        (modify-phases %standard-phases
175          (add-after 'unpack 'patch-bin-sh
176            (lambda _
177              (substitute* "bootstrap"
178                (("contrib/pogen.sh") "sh contrib/pogen.sh"))
179              (for-each (lambda (f) (chmod f #o755))
180                        (find-files "po" ""))
181              #t))
182          (add-after 'patch-bin-sh 'bootstrap
183            (lambda _
184              (zero? (system* "sh" "bootstrap"))))
185          (delete 'check)
186     ;; XXX: https://gnunet.org/bugs/view.php?id=4619
187     (add-after 'install 'set-path-for-check
188       (lambda* (#:key outputs #:allow-other-keys)
189         (let* ((out (assoc-ref outputs "out"))
190                (bin (string-append out "/bin"))
191                (lib (string-append out "/lib")))
192           (setenv "GNUNET_PREFIX" lib)
193           (setenv "PATH" (string-append (getenv "PATH") ":" bin))
194           (zero? (system* "make" "check"))))))))
195     (synopsis "Secure, decentralized, peer-to-peer networking framework")
196     (description
197      "GNUnet is a framework for secure peer-to-peer networking.  The
198 high-level goal is to provide a strong foundation of free software for a
199 global, distributed network that provides security and privacy.  GNUnet in
200 that sense aims to replace the current internet protocol stack.  Along with
201 an application for secure publication of files, it has grown to include all
202 kinds of basic applications for the foundation of a GNU internet.")
203     (license license:gpl3+)
204     (home-page "https://gnunet.org/")))
205
206 gnunet-svn