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>
4 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; 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.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages nss)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages check)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages sqlite)
32 #:use-module (ice-9 match))
41 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
42 version "/src/nspr-" version ".tar.gz"))
45 "0c6ljv3bdqhc169srbpjy0cs52xk715p04zy08rcjvl54k6bdr69"))))
46 (build-system gnu-build-system)
50 `(#:tests? #f ; no check target
51 #:configure-flags (list "--enable-64bit"
52 (string-append "LDFLAGS=-Wl,-rpath="
53 (assoc-ref %outputs "out")
55 ;; Use fixed timestamps for reproducibility.
56 #:make-flags '("SH_DATE='1970-01-01 00:00:01'"
57 ;; This is epoch 1 in microseconds.
59 #:phases (modify-phases %standard-phases
60 (add-before 'configure 'chdir
61 (lambda _ (chdir "nspr") #t)))))
63 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
64 (synopsis "Netscape API for system level and libc-like functions")
65 (description "Netscape Portable Runtime (@dfn{NSPR}) provides a
66 platform-neutral API for system level and libc-like functions. It is used
67 in the Mozilla clients.")
68 (license license:mpl2.0)))
74 (replacement nss/fixed)
77 (uri (let ((version-with-underscores
78 (string-join (string-split version #\.) "_")))
80 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
81 "releases/NSS_" version-with-underscores "_RTM/src/"
82 "nss-" version ".tar.gz")))
85 "0l9ns44rlkp1bpblplspfbqmyhb8rhvc89y56kqh725rgpny1xrv"))
86 ;; Create nss.pc and nss-config.
87 (patches (search-patches "nss-pkgconfig.patch"
88 "nss-freebl-stubs.patch"
89 "nss-increase-test-timeout.patch"))))
90 (build-system gnu-build-system)
91 (outputs '("out" "bin"))
93 `(#:parallel-build? #f ; not supported
95 (let* ((out (assoc-ref %outputs "out"))
96 (nspr (string-append (assoc-ref %build-inputs "nspr")))
97 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
98 (list "-C" "nss" (string-append "PREFIX=" out)
100 "NSS_USE_SYSTEM_SQLITE=1"
101 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
102 ;; Add $out/lib/nss to RPATH.
103 (string-append "RPATH=" rpath)
104 (string-append "LDFLAGS=" rpath)))
105 #:modules ((guix build gnu-build-system)
111 (modify-phases %standard-phases
115 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
116 ,@(match (%current-system)
117 ((or "x86_64-linux" "aarch64-linux")
118 `((setenv "USE_64" "1")))
124 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
125 ;; The later requires a working DNS or /etc/hosts.
126 (setenv "DOMSUF" "localdomain")
127 (setenv "USE_IP" "TRUE")
128 (setenv "IP_ADDRESS" "127.0.0.1")
130 ;; The "PayPalEE.cert" certificate expires every six months,
131 ;; leading to test failures:
132 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To
133 ;; work around that, set the time to roughly the release date.
134 (invoke "faketime" "2019-10-01" "./nss/tests/all.sh")))
136 (lambda* (#:key outputs #:allow-other-keys)
137 (let* ((out (assoc-ref outputs "out"))
138 (bin (string-append (assoc-ref outputs "bin") "/bin"))
139 (inc (string-append out "/include/nss"))
140 (lib (string-append out "/lib/nss"))
141 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
142 ((obj) (string-append "dist/" obj)))))
143 ;; Install nss-config to $out/bin.
144 (install-file (string-append obj "/bin/nss-config")
145 (string-append out "/bin"))
146 (delete-file (string-append obj "/bin/nss-config"))
147 ;; Install nss.pc to $out/lib/pkgconfig.
148 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
149 (string-append out "/lib/pkgconfig"))
150 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
151 (rmdir (string-append obj "/lib/pkgconfig"))
152 ;; Install other files.
153 (copy-recursively "dist/public/nss" inc)
154 (copy-recursively (string-append obj "/bin") bin)
155 (copy-recursively (string-append obj "/lib") lib)
157 ;; FIXME: libgtest1.so is installed in the above step, and it's
158 ;; (unnecessarily) linked with several NSS libraries, but
159 ;; without the needed rpaths, causing the 'validate-runpath'
160 ;; phase to fail. Here we simply delete libgtest1.so, since it
161 ;; seems to be used only during the tests.
162 (delete-file (string-append lib "/libgtest1.so"))
163 (delete-file (string-append lib "/libgtestutil.so"))
169 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
170 (native-inputs `(("perl" ,perl)
171 ("libfaketime" ,libfaketime))) ;for tests
173 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
174 ;; another build is happening concurrently on the same machine.
175 (properties '((timeout . 216000))) ; 60 hours
178 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
179 (synopsis "Network Security Services")
181 "Network Security Services (@dfn{NSS}) is a set of libraries designed to
182 support cross-platform development of security-enabled client and server
183 applications. Applications built with NSS can support SSL v2 and v3, TLS,
184 PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
185 security standards.")
186 (license license:mpl2.0)))
192 (inherit (package-source nss))
193 (patches (append (search-patches "nss-CVE-2019-11745.patch")
194 (origin-patches (package-source nss))))))))