cb30572a14521a745509e6fa71601b35515f7504
[oweals/gnunet.git] / contrib / packages / guix / packages / gnunet / packages / gnunet.scm
1 ;;; This file is part of GNUnet.
2 ;;; Copyright (C) 2016, 2017 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 (define-module (gnunet packages gnunet)
20   #:use-module (guix build-system gnu)
21   #:use-module (guix download)
22   #:use-module (guix git-download)
23   #:use-module ((guix licenses) #:prefix license:)
24   #:use-module (guix packages)
25   #:use-module (gnu packages)
26   #:use-module (gnu packages admin)
27   #:use-module (gnu packages aidc)
28   #:use-module (gnu packages autotools)
29   #:use-module (gnu packages bison)
30   #:use-module (gnu packages compression)
31   #:use-module (gnu packages databases)
32   #:use-module (gnu packages gettext)
33   #:use-module (gnu packages glib)
34   #:use-module (gnu packages gnome)
35   #:use-module (gnu packages gnunet)
36   #:use-module (gnu packages gnupg)
37   #:use-module (gnu packages gnuzilla)
38   #:use-module (gnu packages gstreamer)
39   #:use-module (gnu packages gtk)
40   #:use-module (gnu packages libidn)
41   #:use-module (gnu packages libunistring)
42   #:use-module (gnu packages linux)
43   #:use-module (gnu packages man)
44   #:use-module (gnu packages image-viewers)
45   #:use-module (gnu packages maths)
46   #:use-module (gnu packages multiprecision)
47   #:use-module (gnu packages ncurses)
48   #:use-module (gnu packages pcre)
49   #:use-module (gnu packages perl)
50   #:use-module (gnu packages pkg-config)
51   #:use-module (gnu packages pulseaudio)
52   #:use-module (gnu packages python)
53   #:use-module (gnu packages tls)
54   #:use-module (gnu packages texinfo)
55   #:use-module (gnu packages tex)
56   #:use-module (gnu packages upnp)
57   #:use-module (gnu packages web)
58   #:use-module (gnu packages xiph))
59
60 ;; TODO: Use HEAD without checking sum of it.
61 ;; Explanation for name scheme: UNIXPATH is capped at 108 characters,
62 ;; this causes lots of tests to fail.
63 (define-public gnunetg
64   (let* ((commit "3c3090717610ea787fdd3562901329254a6af0d6")
65          (revision "32"))
66     (package
67       (inherit gnunet)
68       (name "gnunetg")
69       (version (string-append "0.10.1" "-" revision
70                               "." (string-take commit 7)))
71       (source
72        (origin
73          (method git-fetch)
74          (uri (git-reference
75                (url "https://gnunet.org/git/gnunet.git")
76                (commit commit)))
77          (file-name (string-append name "-" version "-checkout"))
78          (sha256
79           (base32
80            "0g0x1r833jkssfd2sndy37509dqf9f8myjvg7mnadwc1irp393bl"))))
81       (build-system gnu-build-system)
82       (inputs
83        `(("glpk" ,glpk)
84          ("gnurl" ,gnurl)
85          ("gstreamer" ,gstreamer)
86          ("gst-plugins-base" ,gst-plugins-base)
87          ("gnutls" ,gnutls)
88          ("libextractor" ,libextractor)
89          ("libgcrypt" ,libgcrypt)
90          ("libidn" ,libidn)
91          ("libmicrohttpd" ,libmicrohttpd)
92          ("libltdl" ,libltdl)
93          ("libunistring" ,libunistring)
94          ("openssl" ,openssl)
95          ("opus" ,opus)
96          ("pulseaudio" ,pulseaudio)
97          ("sqlite" ,sqlite)
98          ("zlib" ,zlib)
99          ("perl" ,perl)
100          ("python" ,python-2) ; tests and gnunet-qr
101          ("jansson" ,jansson)
102          ("ncurses" ,ncurses)
103          ("nss" ,nss)
104          ("gmp" ,gmp)
105          ("miniupnpc" ,miniupnpc)
106          ("bluez" ,bluez) ; for optional bluetooth feature
107          ("glib" ,glib)
108          ;; ("texlive-minimal" ,texlive-minimal) ; optional.
109          ("libogg" ,libogg)))
110       (native-inputs
111        `(("pkg-config" ,pkg-config)
112          ("autoconf" ,autoconf)
113          ("automake" ,automake)
114          ("gnu-gettext" ,gnu-gettext)
115          ("texinfo" ,texinfo)
116          ("libtool" ,libtool)))
117       (outputs '("out" "debug"))
118       (arguments
119        `(#:configure-flags
120          (list (string-append "--with-nssdir=" %output "/lib")
121                "--enable-experimental")
122          #:parallel-tests? #f ; parallel building is not functional
123          #:tests? #f ; FAIL: test_gnunet_statistics.py
124          #:phases
125          ;; swap check and install phases and set paths to installed bin
126          (modify-phases %standard-phases
127            (add-after 'unpack 'patch-bin-sh
128              (lambda _
129                (substitute* "bootstrap"
130                  (("contrib/pogen.sh") "sh contrib/pogen.sh"))
131                (for-each (lambda (f) (chmod f #o755))
132                          (find-files "po" ""))
133              #t))
134            (add-after 'patch-bin-sh 'bootstrap
135              (lambda _
136                (zero? (system* "sh" "bootstrap"))))
137            ;; DISABLED until failing testcases are fixed.
138            ;; this test fails in our environment, disable it:
139            ;; XXX: specify which ones fail.
140            ;; (add-after 'patch-bin-sh 'disable-test_quota_compliance_tcp_asymmetric
141            ;;   (lambda _
142            ;;     (substitute* '("src/transport/Makefile.am")
143            ;;       (("test_quota_compliance_tcp_asymmetric") ""))))
144            ;;       (("test_quota_compliance_http_asymmetric") "")
145            ;;       (("test_quota_compliance_https_asymmetric") "")
146            ;;       (("test_quota_compliance_unix") "")
147            ;;       (("test_quota_compliance_unix_asymmetric") ""))))
148            ;; check is between build and install, fix this to:
149            ;; build - install - check, else the test suite fails.
150            (delete 'check)))))))
151            ;; (add-after 'install 'set-path-for-check
152            ;;   (lambda* (#:key outputs #:allow-other-keys)
153            ;;     (let* ((out (assoc-ref outputs "out"))
154            ;;            (bin (string-append out "/bin"))
155            ;;            (lib (string-append out "/lib")))
156            ;;       (setenv "GNUNET_PREFIX" lib)
157            ;;       (setenv "PATH" (string-append (getenv "PATH") ":" bin))
158            ;;       ;; XXX: https://gnunet.org/bugs/view.php?id=4619#c11061
159            ;;       ;; Enable core dump before the tests.
160            ;;       ;; XXX: HOW??? ulimit -c unlimited
161            ;;       (zero? (system* "make" "check"))))))))
162
163 (define-public gnunet-doc
164   (package
165     (name "gnunet-doc")
166     (version (package-version gnunetg))
167     (source (package-source gnunetg))
168     (build-system gnu-build-system)
169     ;; FIXME: Introduce DOCS_ONLY option for configure script.
170     ;; This should prevent the checks for all required software.
171     (inputs
172      `(("glpk" ,glpk)
173        ("gnurl" ,gnurl)
174        ("gstreamer" ,gstreamer)
175        ("gst-plugins-base" ,gst-plugins-base)
176        ("gnutls" ,gnutls)
177        ("libextractor" ,libextractor)
178        ("libgcrypt" ,libgcrypt)
179        ("libidn" ,libidn)
180        ("libmicrohttpd" ,libmicrohttpd)
181        ("libltdl" ,libltdl)
182        ("libunistring" ,libunistring)
183        ("openssl" ,openssl)
184        ("opus" ,opus)
185        ("pulseaudio" ,pulseaudio)
186        ("sqlite" ,sqlite)
187        ("zlib" ,zlib)
188        ("perl" ,perl)
189        ("python" ,python-2) ; tests and gnunet-qr
190        ("jansson" ,jansson)
191        ("ncurses" ,ncurses)
192        ("nss" ,nss)
193        ("gmp" ,gmp)
194        ("miniupnpc" ,miniupnpc)
195        ("bluez" ,bluez) ; for optional bluetooth feature
196        ("glib" ,glib)
197        ("texlive" ,texlive) ;TODO: Use a minimal subset.
198        ("libogg" ,libogg)))
199     (native-inputs
200      `(("pkg-config" ,pkg-config)
201        ("autoconf" ,autoconf)
202        ("automake" ,automake)
203        ("gnu-gettext" ,gnu-gettext)
204        ("texinfo" ,texinfo)
205        ("libtool" ,libtool)))
206     (arguments
207      `(#:tests? #f ;Don't run tests
208        #:phases
209        (modify-phases %standard-phases
210          (add-after 'unpack 'patch-bin-sh
211            (lambda _
212              (substitute* "bootstrap"
213                (("contrib/pogen.sh") "sh contrib/pogen.sh"))
214              (for-each (lambda (f) (chmod f #o755))
215                        (find-files "po" ""))
216              #t))
217          (add-after 'patch-bin-sh 'bootstrap
218            (lambda _
219              (zero? (system* "sh" "bootstrap"))))
220          (replace 'build
221            (lambda _
222              (chdir "doc")
223              (zero? (system* "make" "doc-all-give-me-the-noise"))))
224          (replace 'install
225            (lambda* (#:key outputs #:allow-other-keys)
226              (let* ((out (assoc-ref outputs "out"))
227                     (doc (string-append out "/share/doc/gnunet")))
228                (mkdir-p doc)
229                (mkdir-p (string-append doc "/gnunet"))
230                (install-file "gnunet.pdf" doc)
231                (install-file "gnunet.info" doc)
232                (copy-recursively "gnunet"
233                                  (string-append doc
234                                                 "/gnunet"))
235                (install-file "gnunet-c-tutorial.pdf" doc)
236                (install-file "gnunet-c-tutorial.info" doc)
237                (copy-recursively "gnunet-c-tutorial"
238                                  (string-append doc
239                                                 "/gnunet-c-tutorial")))
240              #t)))))
241     (synopsis "GNUnet documentation")
242     (description
243      "Gnunet-doc builds the documentation of GNUnet.")
244     (home-page "https://gnunet.org")
245     (license (package-license gnunet))))
246
247 (define-public gnunetgpg
248   (package
249     (inherit gnunetg)
250     (name "gnunetgpg")
251     (inputs
252      `(("postgresql" ,postgresql)
253        ,@(package-inputs gnunetg)))
254     (synopsis "gnunet, variant with postgres")))
255
256 (define-public gnunetgf
257   (package
258     (inherit gnunetg)
259     (name "gnunetgf")
260     (inputs
261      `(("postgresql" ,postgresql)
262        ("mysql" ,mysql)
263        ,@(package-inputs gnunetg)))
264     (arguments
265      `(#:configure-flags
266        (list (string-append "--with-nssdir=" %output "/lib")
267              "--enable-gcc-hardening"
268              "--enable-linker-hardening"
269
270              "--enable-poisoning"
271              "--enable-sanitizer"
272              "--enable-experimental"
273              "--enable-logging=verbose"
274              "CFLAGS=-ggdb -O0")
275        #:parallel-tests? #f ; parallel building is not supported.
276        ;;#:tests? #f ; fail: test_gnunet_statistics.py
277        #:phases
278        ;; swap check and install phases and set paths to installed bin
279        (modify-phases %standard-phases
280          (add-after 'unpack 'patch-bin-sh
281            (lambda _
282              (substitute* "bootstrap"
283                (("contrib/pogen.sh") "sh contrib/pogen.sh"))
284              (for-each (lambda (f) (chmod f #o755))
285                        (find-files "po" ""))
286              #t))
287          (add-after 'patch-bin-sh 'bootstrap
288            (lambda _
289              (zero? (system* "sh" "bootstrap"))))
290          (delete 'check))))
291     (synopsis "gnunet, full git build without tests")))
292
293 ;; A package to run the test suite.
294 (define-public gnunetgft
295   (package
296     (inherit gnunetg)
297     (name "gnunetgft")
298     (arguments
299      `(#:configure-flags
300        (list (string-append "--with-nssdir=" %output "/lib")
301              "--enable-gcc-hardening"
302              "--enable-linker-hardening"
303
304              ;;"--enable-poisoning"
305              ;;"--enable-sanitizer"
306              "--enable-experimental"
307              "--enable-logging=verbose"
308              "CFLAGS=-ggdb -O0")
309        ;; #:parallel-tests? #f ; parallel building seems to fail
310        ;;#:tests? #f ; fail: test_gnunet_statistics.py
311        #:phases
312        ;; swap check and install phases and set paths to installed bin
313        (modify-phases %standard-phases
314          (add-after 'unpack 'patch-bin-sh
315            (lambda _
316              (substitute* "bootstrap"
317                (("contrib/pogen.sh") "sh contrib/pogen.sh"))
318              (for-each (lambda (f) (chmod f #o755))
319                        (find-files "po" ""))
320              #t))
321          (add-after 'patch-bin-sh 'bootstrap
322            (lambda _
323              (zero? (system* "sh" "bootstrap"))))
324          (delete 'check)
325          ;; XXX: https://gnunet.org/bugs/view.php?id=4619
326          (add-after 'install 'set-path-for-check
327            (lambda* (#:key outputs #:allow-other-keys)
328              (let* ((out (assoc-ref outputs "out"))
329                     (bin (string-append out "/bin"))
330                     (lib (string-append out "/lib")))
331                (setenv "GNUNET_PREFIX" lib)
332                (setenv "PATH" (string-append (getenv "PATH") ":" bin))
333                (zero? (system* "make" "check"))))))))
334     (synopsis "gnunet, full git with tests enabled with parallel tests")))
335
336 ;; ... and one package to test the package with "parallel-tests? #f"
337 (define-public gnunetgftn
338   (package
339     (inherit gnunetg)
340     (name "gnunetgftn")
341     (arguments
342      `(#:configure-flags
343        (list (string-append "--with-nssdir=" %output "/lib")
344              "--enable-gcc-hardening"
345              "--enable-linker-hardening"
346
347              "--enable-poisoning"
348              "--enable-sanitizer"
349              "--enable-experimental"
350              "--enable-logging=verbose"
351              "CFLAGS=-ggdb"); -O0")
352        #:parallel-tests? #f ; parallel building seems to fail
353        ;;#:tests? #f ; fail: test_gnunet_statistics.py
354        #:phases
355        ;; swap check and install phases and set paths to installed bin
356        (modify-phases %standard-phases
357          (add-after 'unpack 'patch-bin-sh
358            (lambda _
359              (substitute* "bootstrap"
360                (("contrib/pogen.sh") "sh contrib/pogen.sh"))
361              (for-each (lambda (f) (chmod f #o755))
362                        (find-files "po" ""))
363              #t))
364          (add-after 'patch-bin-sh 'bootstrap
365            (lambda _
366              (zero? (system* "sh" "bootstrap"))))
367          (delete 'check)
368          ;; XXX: https://gnunet.org/bugs/view.php?id=4619
369          (add-after 'install 'set-path-for-check
370            (lambda* (#:key outputs #:allow-other-keys)
371              (let* ((out (assoc-ref outputs "out"))
372                     (bin (string-append out "/bin"))
373                     (lib (string-append out "/lib")))
374                (setenv "GNUNET_PREFIX" lib)
375                (setenv "PATH" (string-append (getenv "PATH") ":" bin))
376                (zero? (system* "make" "check"))))))))))
377
378 (define-public gnunet-gtkg
379   (let* ((commit "087f8e166ee6d1fc59a6bd5d05f656528761ede7")
380          (revision "5"))
381     (package
382       (inherit gnunetgf)
383       (name "gnunet-gtkg")
384       (version (package-version gnunetgf))
385       (source
386        (origin
387          (method git-fetch)
388          (uri (git-reference
389                (url "https://gnunet.org/git/gnunet-gtk.git")
390                (commit commit)))
391          (file-name (string-append name "-" version "-checkout"))
392          (sha256
393           (base32
394             "1k03d8l0yz4fpliy5bg5s7qkpidzd6ryr4cd63wgmd227p32i87q"))))
395       (arguments
396        `(#:configure-flags
397          (list "--with-libunique"
398                "--with-qrencode"
399                (string-append "--with-gnunet="
400                               (assoc-ref %build-inputs "gnunetgf")))
401          #:phases
402          (modify-phases %standard-phases
403            (add-before 'configure 'bootstrap
404              (lambda _
405                (zero? (system* "autoreconf" "-vfi")))))))
406       (inputs
407        `(("gnunetgf" ,gnunetgf)
408          ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
409          ("gnutls" ,gnutls)
410          ("libgcrypt" ,libgcrypt)
411          ("gtk+" ,gtk+)
412          ("libextractor" ,libextractor)
413          ("glade3" ,glade3)
414          ("qrencode" ,qrencode)
415          ("libunique" ,libunique)))
416       (native-inputs
417        `(("pkg-config" ,pkg-config)
418          ("libglade" ,libglade)
419          ("autoconf" ,autoconf)
420          ("gnu-gettext" ,gnu-gettext)
421          ("texinfo" ,texinfo)
422          ("automake" ,automake)
423          ("libtool" ,libtool)))
424       (synopsis "Graphical front-end tools for GNUnet")
425       (home-page "https://gnunet.org"))))
426
427 ;; fuse, pointing to the tests disabled version of gnunet-git
428 (define-public gnunet-fuse-git
429   (let* ((commit "3503aeff6db6b39b85e13f9483d46d49ce9cec55")
430          (revision "3"))
431     (package
432       (inherit gnunetg)
433       ;;(inherit gnunet)
434       (name "gnunet-fuse-git")
435       (version (package-version gnunetgf))
436       ;;(version (package-version gnunet))
437       (source
438        (origin
439          (method git-fetch)
440          (uri (git-reference
441                (url "https://gnunet.org/git/gnunet-fuse.git")
442                (commit commit)))
443          (file-name (string-append name "-" version "-checkout"))
444          (sha256
445           (base32
446            "0sxzppanw2nrjqv1vnyj2jx3ja6gqrg0ibkl5n1fr265cqk5hgc5"))))
447       (arguments
448        `(#:configure-flags
449          (list "--with-qrencode"
450                (string-append "--with-gnunet="
451                               (assoc-ref %build-inputs "gnunetgf"))) ;"gnunet")))
452          #:phases
453          (modify-phases %standard-phases
454            (add-after 'unpack 'fix-gnunet-include-path
455              (lambda _
456                (substitute* "configure.ac"
457                  (("gnunet/gnunet_util_lib.h")
458                   "${lookin}/include/gnunet/gnunet_util_lib.h"))
459                #t))
460            (add-before 'configure 'bootstrap
461              (lambda _
462                (zero? (system* "autoreconf" "-vfi")))))))
463       (inputs
464        `(("gnunetgf" ,gnunetgf)))
465        ;;`(("gnunet" ,gnunet)))
466       (native-inputs
467        `(("pkg-config" ,pkg-config)
468          ("fuse" ,fuse)
469          ("autoconf" ,autoconf)
470          ("gnu-gettext" ,gnu-gettext)
471          ("automake" ,automake)
472          ("libtool" ,libtool)))
473       (synopsis "FUSE for GNUnet")
474       (home-page "https://gnunet.org"))))