gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / nss.scm
CommitLineData
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>
4;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6;;;
7;;; This file is part of GNU Guix.
8;;;
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.
13;;;
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.
18;;;
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/>.
21
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))
33
34(define-public nspr
35 (package
36 (name "nspr")
c29bdd54 37 (version "4.22")
aff0cce9
LC
38 (source (origin
39 (method url-fetch)
40 (uri (string-append
41 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
42 version "/src/nspr-" version ".tar.gz"))
43 (sha256
44 (base32
c29bdd54 45 "0c6ljv3bdqhc169srbpjy0cs52xk715p04zy08rcjvl54k6bdr69"))))
aff0cce9
LC
46 (build-system gnu-build-system)
47 (native-inputs
48 `(("perl" ,perl)))
49 (arguments
50 `(#:tests? #f ; no check target
51 #:configure-flags (list "--enable-64bit"
52 (string-append "LDFLAGS=-Wl,-rpath="
53 (assoc-ref %outputs "out")
54 "/lib"))
55 ;; Use fixed timestamps for reproducibility.
56 #:make-flags '("SH_DATE='1970-01-01 00:00:01'"
57 ;; This is epoch 1 in microseconds.
58 "SH_NOW=100000")
59 #:phases (modify-phases %standard-phases
60 (add-before 'configure 'chdir
61 (lambda _ (chdir "nspr") #t)))))
62 (home-page
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
66platform-neutral API for system level and libc-like functions. It is used
67in the Mozilla clients.")
68 (license license:mpl2.0)))
69
70(define-public nss
71 (package
72 (name "nss")
d45c75fc 73 (version "3.46.1")
04b33ce2 74 (replacement nss/fixed)
aff0cce9
LC
75 (source (origin
76 (method url-fetch)
77 (uri (let ((version-with-underscores
78 (string-join (string-split version #\.) "_")))
79 (string-append
80 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
81 "releases/NSS_" version-with-underscores "_RTM/src/"
82 "nss-" version ".tar.gz")))
83 (sha256
84 (base32
d45c75fc 85 "0l9ns44rlkp1bpblplspfbqmyhb8rhvc89y56kqh725rgpny1xrv"))
aff0cce9
LC
86 ;; Create nss.pc and nss-config.
87 (patches (search-patches "nss-pkgconfig.patch"
58e37b54 88 "nss-freebl-stubs.patch"
aff0cce9
LC
89 "nss-increase-test-timeout.patch"))))
90 (build-system gnu-build-system)
91 (outputs '("out" "bin"))
92 (arguments
93 `(#:parallel-build? #f ; not supported
94 #:make-flags
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)
99 "NSDISTMODE=copy"
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)
106 (guix build utils)
107 (ice-9 ftw)
108 (ice-9 match)
109 (srfi srfi-26))
110 #:phases
111 (modify-phases %standard-phases
112 (replace 'configure
113 (lambda _
114 (setenv "CC" "gcc")
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")))
119 (_
120 '()))
121 #t))
122 (replace 'check
123 (lambda _
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")
129
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.
d45c75fc 134 (invoke "faketime" "2019-10-01" "./nss/tests/all.sh")))
aff0cce9
LC
135 (replace 'install
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)
156
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"))
164
165 #t))))))
166 (inputs
167 `(("sqlite" ,sqlite)
168 ("zlib" ,zlib)))
169 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
170 (native-inputs `(("perl" ,perl)
171 ("libfaketime" ,libfaketime))) ;for tests
172
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
176
177 (home-page
178 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
179 (synopsis "Network Security Services")
180 (description
181 "Network Security Services (@dfn{NSS}) is a set of libraries designed to
182support cross-platform development of security-enabled client and server
183applications. Applications built with NSS can support SSL v2 and v3, TLS,
184PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
185security standards.")
186 (license license:mpl2.0)))
04b33ce2
MW
187
188(define nss/fixed
189 (package
190 (inherit nss)
191 (source (origin
192 (inherit (package-source nss))
193 (patches (append (search-patches "nss-CVE-2019-11745.patch")
194 (origin-patches (package-source nss))))))))