Commit | Line | Data |
---|---|---|
aff0cce9 LC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> | |
3 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org> | |
2c267e63 | 4 | ;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il> |
aff0cce9 | 5 | ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
71949dac | 6 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
1896c0c6 | 7 | ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de> |
aff0cce9 LC |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | (define-module (gnu packages nss) | |
25 | #:use-module (guix packages) | |
26 | #:use-module (guix download) | |
27 | #:use-module (guix build-system gnu) | |
28 | #:use-module ((guix licenses) #:prefix license:) | |
29 | #:use-module (gnu packages) | |
30 | #:use-module (gnu packages check) | |
31 | #:use-module (gnu packages compression) | |
32 | #:use-module (gnu packages perl) | |
33 | #:use-module (gnu packages sqlite) | |
34 | #:use-module (ice-9 match)) | |
35 | ||
36 | (define-public nspr | |
37 | (package | |
38 | (name "nspr") | |
1a74a8c6 | 39 | (version "4.29") |
aff0cce9 LC |
40 | (source (origin |
41 | (method url-fetch) | |
42 | (uri (string-append | |
43 | "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v" | |
44 | version "/src/nspr-" version ".tar.gz")) | |
45 | (sha256 | |
46 | (base32 | |
1a74a8c6 | 47 | "10i5x637x0jqmdi47grkzgn56fg6770naa3wrhr4dmsrh3dnna12")))) |
aff0cce9 LC |
48 | (build-system gnu-build-system) |
49 | (native-inputs | |
50 | `(("perl" ,perl))) | |
51 | (arguments | |
52 | `(#:tests? #f ; no check target | |
ceb4b1d7 MB |
53 | #:configure-flags (list "--disable-static" |
54 | "--enable-64bit" | |
aff0cce9 LC |
55 | (string-append "LDFLAGS=-Wl,-rpath=" |
56 | (assoc-ref %outputs "out") | |
57 | "/lib")) | |
58 | ;; Use fixed timestamps for reproducibility. | |
59 | #:make-flags '("SH_DATE='1970-01-01 00:00:01'" | |
60 | ;; This is epoch 1 in microseconds. | |
61 | "SH_NOW=100000") | |
62 | #:phases (modify-phases %standard-phases | |
63 | (add-before 'configure 'chdir | |
64 | (lambda _ (chdir "nspr") #t))))) | |
65 | (home-page | |
66 | "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR") | |
67 | (synopsis "Netscape API for system level and libc-like functions") | |
68 | (description "Netscape Portable Runtime (@dfn{NSPR}) provides a | |
69 | platform-neutral API for system level and libc-like functions. It is used | |
70 | in the Mozilla clients.") | |
71 | (license license:mpl2.0))) | |
72 | ||
73 | (define-public nss | |
74 | (package | |
75 | (name "nss") | |
62235669 | 76 | (version "3.59") |
1896c0c6 JB |
77 | (source (origin |
78 | (method url-fetch) | |
79 | (uri (let ((version-with-underscores | |
80 | (string-join (string-split version #\.) "_"))) | |
81 | (string-append | |
82 | "https://ftp.mozilla.org/pub/mozilla.org/security/nss/" | |
83 | "releases/NSS_" version-with-underscores "_RTM/src/" | |
84 | "nss-" version ".tar.gz"))) | |
85 | (sha256 | |
86 | (base32 | |
62235669 | 87 | "096fs3z21r171q24ca3rq53p1389xmvqz1f2rpm7nlm8r9s82ag6")) |
1896c0c6 JB |
88 | ;; Create nss.pc and nss-config. |
89 | (patches (search-patches "nss-3.56-pkgconfig.patch" | |
90 | "nss-increase-test-timeout.patch")) | |
91 | (modules '((guix build utils))) | |
92 | (snippet | |
93 | '(begin | |
94 | ;; Delete the bundled copy of these libraries. | |
95 | (delete-file-recursively "nss/lib/zlib") | |
96 | (delete-file-recursively "nss/lib/sqlite") | |
97 | #t)))) | |
b6fc2054 MB |
98 | (build-system gnu-build-system) |
99 | (outputs '("out" "bin")) | |
1896c0c6 JB |
100 | (arguments |
101 | `(#:parallel-build? #f ; not supported | |
102 | #:make-flags | |
103 | (let* ((out (assoc-ref %outputs "out")) | |
104 | (nspr (string-append (assoc-ref %build-inputs "nspr"))) | |
105 | (rpath (string-append "-Wl,-rpath=" out "/lib/nss"))) | |
106 | (list "-C" "nss" (string-append "PREFIX=" out) | |
107 | "NSDISTMODE=copy" | |
108 | "NSS_USE_SYSTEM_SQLITE=1" | |
109 | (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr") | |
110 | ;; Add $out/lib/nss to RPATH. | |
111 | (string-append "RPATH=" rpath) | |
112 | (string-append "LDFLAGS=" rpath))) | |
113 | #:modules ((guix build gnu-build-system) | |
114 | (guix build utils) | |
115 | (ice-9 ftw) | |
116 | (ice-9 match) | |
117 | (srfi srfi-26)) | |
118 | #:phases | |
119 | (modify-phases %standard-phases | |
120 | (replace 'configure | |
121 | (lambda _ | |
122 | (setenv "CC" "gcc") | |
123 | ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system. | |
124 | ,@(match (%current-system) | |
125 | ((or "x86_64-linux" "aarch64-linux") | |
126 | `((setenv "USE_64" "1"))) | |
127 | (_ | |
128 | '())) | |
129 | #t)) | |
130 | (replace 'check | |
131 | (lambda _ | |
132 | ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing. | |
133 | ;; The later requires a working DNS or /etc/hosts. | |
134 | (setenv "DOMSUF" "localdomain") | |
135 | (setenv "USE_IP" "TRUE") | |
136 | (setenv "IP_ADDRESS" "127.0.0.1") | |
137 | ||
138 | ;; The "PayPalEE.cert" certificate expires every six months, | |
139 | ;; leading to test failures: | |
140 | ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To | |
141 | ;; work around that, set the time to roughly the release date. | |
62235669 | 142 | (invoke "faketime" "2020-11-01" "./nss/tests/all.sh"))) |
1896c0c6 JB |
143 | (replace 'install |
144 | (lambda* (#:key outputs #:allow-other-keys) | |
145 | (let* ((out (assoc-ref outputs "out")) | |
146 | (bin (string-append (assoc-ref outputs "bin") "/bin")) | |
147 | (inc (string-append out "/include/nss")) | |
148 | (lib (string-append out "/lib/nss")) | |
149 | (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>)) | |
150 | ((obj) (string-append "dist/" obj))))) | |
151 | ;; Install nss-config to $out/bin. | |
152 | (install-file (string-append obj "/bin/nss-config") | |
153 | (string-append out "/bin")) | |
154 | (delete-file (string-append obj "/bin/nss-config")) | |
155 | ;; Install nss.pc to $out/lib/pkgconfig. | |
156 | (install-file (string-append obj "/lib/pkgconfig/nss.pc") | |
157 | (string-append out "/lib/pkgconfig")) | |
158 | (delete-file (string-append obj "/lib/pkgconfig/nss.pc")) | |
159 | (rmdir (string-append obj "/lib/pkgconfig")) | |
160 | ;; Install other files. | |
161 | (copy-recursively "dist/public/nss" inc) | |
162 | (copy-recursively (string-append obj "/bin") bin) | |
163 | (copy-recursively (string-append obj "/lib") lib) | |
b6fc2054 MB |
164 | #t)))))) |
165 | (inputs | |
166 | `(("sqlite" ,sqlite) | |
167 | ("zlib" ,zlib))) | |
168 | (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc. | |
169 | (native-inputs `(("perl" ,perl) | |
170 | ("libfaketime" ,libfaketime))) ;for tests | |
171 | ||
172 | ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when | |
173 | ;; another build is happening concurrently on the same machine. | |
174 | (properties '((timeout . 216000))) ; 60 hours | |
175 | ||
176 | (home-page | |
177 | "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS") | |
178 | (synopsis "Network Security Services") | |
179 | (description | |
180 | "Network Security Services (@dfn{NSS}) is a set of libraries designed to | |
181 | support cross-platform development of security-enabled client and server | |
182 | applications. Applications built with NSS can support SSL v2 and v3, TLS, | |
183 | PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other | |
184 | security standards.") | |
185 | (license license:mpl2.0))) |