diff options
author | N. 'ng0' Gillmann <ngillmann@runbox.com> | 2016-10-05 21:56:30 +0000 |
---|---|---|
committer | N. 'ng0' Gillmann <ngillmann@runbox.com> | 2016-10-05 21:56:30 +0000 |
commit | 7acf42ac142f54ed74e2da0a0aed7b1b7e5e7f64 (patch) | |
tree | c594c3a21d2d7289fdb1c6c95ebec3f2de333767 /guix-env.scm | |
parent | c406330a6fb8a11e37ceb9d7bbe45dc2e0e9aa13 (diff) | |
download | gnunet-7acf42ac142f54ed74e2da0a0aed7b1b7e5e7f64.tar.gz gnunet-7acf42ac142f54ed74e2da0a0aed7b1b7e5e7f64.zip |
Moved guix.scm to guix-env.scm into a proper module and added a
small documentation how it can be used.
Diffstat (limited to 'guix-env.scm')
-rw-r--r-- | guix-env.scm | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/guix-env.scm b/guix-env.scm new file mode 100644 index 000000000..6b49916a2 --- /dev/null +++ b/guix-env.scm | |||
@@ -0,0 +1,231 @@ | |||
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 <ngillmann@runbox.com> | ||
21 | ;;; | ||
22 | ;;; Parts borrowed here from pubstrate: | ||
23 | ;;; Pubstrate is distributed in the hope that it will be useful, but | ||
24 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
25 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
26 | ;;; General Public License for more details. | ||
27 | ;;; | ||
28 | ;;; You should have received a copy of the GNU General Public License | ||
29 | ;;; along with Pubstrate. If not, see <http://www.gnu.org/licenses/>. | ||
30 | ;;; | ||
31 | ;;; Parts borrowed here from guile-sdl2: | ||
32 | ;;; Guile-sdl2 is distributed in the hope that it will be useful, but | ||
33 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
34 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
35 | ;;; General Public License for more details. | ||
36 | ;;; | ||
37 | ;;; You should have received a copy of the GNU Lesser General Public | ||
38 | ;;; License along with guile-sdl2. If not, see | ||
39 | ;;; <http://www.gnu.org/licenses/>. | ||
40 | |||
41 | ;; Guix package for GNUnet development | ||
42 | ;; | ||
43 | ;; INSTALL | ||
44 | ;; | ||
45 | ;; To build and install the package in the user environment, use: | ||
46 | ;; | ||
47 | ;; .. to be documented | ||
48 | ;; | ||
49 | ;; BUILD ONLY | ||
50 | ;; | ||
51 | ;; Precondition for using this file is that you run Guix and have a | ||
52 | ;; development setup for this setup, which involves a version of Guile in | ||
53 | ;; your PATH. | ||
54 | ;; Let us assume you checked out https://gnunet.org/svn/, and you exported | ||
55 | ;; a variable named GNUNET_SVN_PATH="/home/alice/src/gnunet/svn/". | ||
56 | ;; | ||
57 | ;; export GNUNET_SVN_PATH="/home/alice/src/gnunet/svn/" | ||
58 | ;; | ||
59 | ;; A directory in GUILE_LOAD_PATH is a root, this means that the value of | ||
60 | ;; GNUNET_SVN_PATH dictates how we call this Guix module. | ||
61 | ;; We now have to append $GNUNET_SVN_PATH to GUILE_LOAD_PATH and are almost | ||
62 | ;; ready to go. | ||
63 | ;; | ||
64 | ;; export GUILE_LOAD_PATH="/home/alice/.guix-profile/share/guile/site/2.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH:$GNUNET_SVN_PATH | ||
65 | ;; | ||
66 | ;; Now we make use of the function of Guix to build from expressions: | ||
67 | ;; | ||
68 | ;; guix build --expression="(@ (gnunet guix-env) gnunet-svn)" | ||
69 | ;; | ||
70 | ;; This will build the public exported value gnunet-svn from this file. | ||
71 | ;; See `info guix-build' for more about this magic. | ||
72 | ;; | ||
73 | ;; While this might look complicated, it adds options which will | ||
74 | ;; be added later to this file, for example invoking a development | ||
75 | ;; environment (guix env) etc... | ||
76 | |||
77 | (define-module (gnunet guix-env) | ||
78 | #:use-modules (ice-9 popen) | ||
79 | #:use-modules (ice-9 match) | ||
80 | #:use-modules (ice-9 rdelim) | ||
81 | #:use-modules (guix packages) | ||
82 | #:use-modules (guix build-system gnu) | ||
83 | #:use-modules (guix gexp) | ||
84 | #:use-modules ((guix build utils) #:select (with-directory-excursion)) | ||
85 | #:use-modules (gnu packages) | ||
86 | #:use-modules (gnu packages base) | ||
87 | #:use-modules (gnu packages gnunet) | ||
88 | #:use-modules (gnu packages file) | ||
89 | #:use-modules (gnu packages aidc) | ||
90 | #:use-modules (gnu packages autotools) | ||
91 | #:use-modules (gnu packages compression) | ||
92 | #:use-modules (gnu packages curl) | ||
93 | #:use-modules (gnu packages geeqie) | ||
94 | #:use-modules (gnu packages gettext) | ||
95 | #:use-modules (gnu packages glib) | ||
96 | #:use-modules (gnu packages gnome) | ||
97 | #:use-modules (gnu packages gnupg) | ||
98 | #:use-modules (gnu packages groff) | ||
99 | #:use-modules (gnu packages gtk) | ||
100 | #:use-modules (gnu packages guile) | ||
101 | #:use-modules (gnu packages gstreamer) | ||
102 | #:use-modules (gnu packages gnuzilla) | ||
103 | #:use-modules (gnu packages libidn) | ||
104 | #:use-modules (gnu packages linux) | ||
105 | #:use-modules (gnu packages image) | ||
106 | #:use-modules (gnu packages libunistring) | ||
107 | #:use-modules (gnu packages maths) | ||
108 | #:use-modules (gnu packages multiprecision) | ||
109 | #:use-modules (gnu packages pkg-config) | ||
110 | #:use-modules (gnu packages perl) | ||
111 | #:use-modules (gnu packages pulseaudio) | ||
112 | #:use-modules (gnu packages python) | ||
113 | #:use-modules (gnu packages databases) | ||
114 | #:use-modules (gnu packages tls) | ||
115 | #:use-modules (gnu packages tex) | ||
116 | #:use-modules (gnu packages video) | ||
117 | #:use-modules (gnu packages web) | ||
118 | #:use-modules (gnu packages xiph) | ||
119 | #:use-modules (gnu packages backup) | ||
120 | #:use-modules ((guix licenses) #:prefix license:)) | ||
121 | |||
122 | (define %source-dir (dirname (current-filename))) | ||
123 | |||
124 | ;; This will be needed when gnunet source moves to git. | ||
125 | ;; Taken from https://gitlab.com/dustyweb/pubstrate/blob/master/guix.scm | ||
126 | (define git-file? | ||
127 | (let* ((pipe (with-directory-excursion %source-dir | ||
128 | (open-pipe* OPEN_READ "git" "ls-files"))) | ||
129 | (files (let loop ((lines '())) | ||
130 | (match (read-line pipe) | ||
131 | ((? eof-object?) | ||
132 | (reverse lines)) | ||
133 | (line | ||
134 | (loop (cons line lines)))))) | ||
135 | (status (close-pipe pipe))) | ||
136 | (lambda (file stat) | ||
137 | (match (stat:type stat) | ||
138 | ('directory #t) | ||
139 | ((or 'regular 'symlink) | ||
140 | (any (cut string-suffix? <> file) files)) | ||
141 | (_ #f))))) | ||
142 | |||
143 | (define-public gnunet-svn | ||
144 | (package | ||
145 | (name "gnunet-svn") | ||
146 | (version (string-append "0.10.1-" "dev")) | ||
147 | (source | ||
148 | (local-file %source-dir | ||
149 | #:recursive? #t)) | ||
150 | ;;#:select? git-file?)) | ||
151 | (build-system gnu-build-system) | ||
152 | (inputs | ||
153 | `(("glpk" ,glpk) | ||
154 | ("gnurl" ,gnurl) | ||
155 | ("gstreamer" ,gstreamer) | ||
156 | ("gst-plugins-base" ,gst-plugins-base) | ||
157 | ("gnutls" ,gnutls) | ||
158 | ("libextractor" ,libextractor) | ||
159 | ("libgcrypt" ,libgcrypt) | ||
160 | ("libidn" ,libidn) | ||
161 | ("libmicrohttpd" ,libmicrohttpd) | ||
162 | ("libltdl" ,libltdl) | ||
163 | ("libunistring" ,libunistring) | ||
164 | ("openssl" ,openssl) | ||
165 | ("opus" ,opus) | ||
166 | ("pulseaudio" ,pulseaudio) | ||
167 | ("sqlite" ,sqlite) | ||
168 | ("postgresql" ,postgresql) | ||
169 | ("mysql" ,mysql) | ||
170 | ("zlib" ,zlib) | ||
171 | ("perl" ,perl) | ||
172 | ("python" ,python) ; tests and gnunet-qr | ||
173 | ("jansson" ,jansson) | ||
174 | ("nss" ,nss) | ||
175 | ("gmp" ,gmp) | ||
176 | ("bluez" ,bluez) ; for optional bluetooth feature | ||
177 | ("glib" ,glib) | ||
178 | ;; There are currently no binary substitutes for texlive on | ||
179 | ;; hydra.gnu.org or its mirrors due to its size. Uncomment if you need it. | ||
180 | ;;("texlive-minimal" ,texlive-minimal) ; optional. | ||
181 | ("libogg" ,libogg))) | ||
182 | (native-inputs | ||
183 | `(("pkg-config" ,pkg-config) | ||
184 | ("autoconf" ,autoconf) | ||
185 | ("automake" ,automake) | ||
186 | ("gnu-gettext" ,gnu-gettext) | ||
187 | ("libtool" ,libtool))) | ||
188 | (arguments | ||
189 | `(#:configure-flags | ||
190 | (list (string-append "--with-nssdir=" %output "/lib") | ||
191 | "--enable-experimental" | ||
192 | ;; These appear to be "broken" on Guix, needs debugging. | ||
193 | ;;"--enable-gcc-hardening" | ||
194 | "--enable-linker-hardening" | ||
195 | "--enable-logging=verbose" | ||
196 | "--enable-poisoning") | ||
197 | ;;#:parallel-tests? #f ; parallel building seems to fail | ||
198 | ;;#:tests? #f ; fail: test_gnunet_statistics.py | ||
199 | #:phases | ||
200 | ;; swap check and install phases and set paths to installed bin | ||
201 | (modify-phases %standard-phases | ||
202 | (add-after 'unpack 'patch-bin-sh | ||
203 | (lambda _ | ||
204 | (substitute* "bootstrap" | ||
205 | (("contrib/pogen.sh") "sh contrib/pogen.sh")) | ||
206 | (for-each (lambda (f) (chmod f #o755)) | ||
207 | (find-files "po" "")) | ||
208 | #t)) | ||
209 | (add-after 'patch-bin-sh 'bootstrap | ||
210 | (lambda _ | ||
211 | (zero? (system* "sh" "bootstrap")))) | ||
212 | (delete 'check) | ||
213 | ;; XXX: https://gnunet.org/bugs/view.php?id=4619 | ||
214 | (add-after 'install 'set-path-for-check | ||
215 | (lambda* (#:key outputs #:allow-other-keys) | ||
216 | (let* ((out (assoc-ref outputs "out")) | ||
217 | (bin (string-append out "/bin")) | ||
218 | (lib (string-append out "/lib"))) | ||
219 | (setenv "GNUNET_PREFIX" lib) | ||
220 | (setenv "PATH" (string-append (getenv "PATH") ":" bin)) | ||
221 | (zero? (system* "make" "check")))))))) | ||
222 | (synopsis "Secure, decentralized, peer-to-peer networking framework") | ||
223 | (description | ||
224 | "GNUnet is a framework for secure peer-to-peer networking. The | ||
225 | high-level goal is to provide a strong foundation of free software for a | ||
226 | global, distributed network that provides security and privacy. GNUnet in | ||
227 | that sense aims to replace the current internet protocol stack. Along with | ||
228 | an application for secure publication of files, it has grown to include all | ||
229 | kinds of basic applications for the foundation of a GNU internet.") | ||
230 | (license license:gpl3+) | ||
231 | (home-page "https://gnunet.org/"))) | ||