gnu: nss: Use G-expressions.

* gnu/packages/nss.scm (nss)[arguments]: Use gexp and remove labels.
This commit is contained in:
Marius Bakke 2022-06-29 21:13:53 +02:00
parent b316d8b751
commit 01d1b285b8
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -137,82 +137,84 @@ (define-public nss
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs '("out" "bin")) (outputs '("out" "bin"))
(arguments (arguments
`(#:make-flags (list
(let* ((out (assoc-ref %outputs "out")) #:make-flags
(nspr (string-append (assoc-ref %build-inputs "nspr"))) #~(let ((rpath (string-append "-Wl,-rpath=" #$output "/lib/nss")))
(rpath (string-append "-Wl,-rpath=" out "/lib/nss"))) (list "-C" "nss"
(list "-C" "nss" (string-append "PREFIX=" out) (string-append "PREFIX=" #$output)
"NSDISTMODE=copy" "NSDISTMODE=copy"
"NSS_USE_SYSTEM_SQLITE=1" "NSS_USE_SYSTEM_SQLITE=1"
;; The gtests fail to compile on riscv64. ;; The gtests fail to compile on riscv64.
;; Skipping them doesn't affect the test suite. ;; Skipping them doesn't affect the test suite.
,@(if (target-riscv64?) #$@(if (target-riscv64?)
`("NSS_DISABLE_GTESTS=1") #~("NSS_DISABLE_GTESTS=1")
'()) #~())
(string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr") (string-append "NSPR_INCLUDE_DIR="
;; Add $out/lib/nss to RPATH. (search-input-directory %build-inputs
(string-append "RPATH=" rpath) "include/nspr"))
(string-append "LDFLAGS=" rpath))) ;; Add $out/lib/nss to RPATH.
#:modules ((guix build gnu-build-system) (string-append "RPATH=" rpath)
(string-append "LDFLAGS=" rpath)))
#:modules '((guix build gnu-build-system)
(guix build utils) (guix build utils)
(ice-9 ftw) (ice-9 ftw)
(ice-9 match) (ice-9 match)
(srfi srfi-26)) (srfi srfi-26))
#:tests? ,(not (or (%current-target-system) #:tests? (not (or (%current-target-system)
;; Tests take more than 30 hours on riscv64-linux. ;; Tests take more than 30 hours on riscv64-linux.
(target-riscv64?))) (target-riscv64?)))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(replace 'configure (replace 'configure
(lambda _ (lambda _
(setenv "CC" ,(cc-for-target)) (setenv "CC" #$(cc-for-target))
;; Tells NSS to build for the 64-bit ABI if we are 64-bit system. ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
,@(if (target-64bit?) #$@(if (target-64bit?)
`((setenv "USE_64" "1")) #~((setenv "USE_64" "1"))
'()))) #~())))
(replace 'check (replace 'check
(lambda* (#:key tests? #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(if tests? (if tests?
(begin (begin
;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for
;; testing. The latter requires a working DNS or /etc/hosts. ;; testing. The latter requires a working DNS or /etc/hosts.
(setenv "DOMSUF" "localdomain") (setenv "DOMSUF" "localdomain")
(setenv "USE_IP" "TRUE") (setenv "USE_IP" "TRUE")
(setenv "IP_ADDRESS" "127.0.0.1") (setenv "IP_ADDRESS" "127.0.0.1")
;; The "PayPalEE.cert" certificate expires every six months, ;; The "PayPalEE.cert" certificate expires every six months,
;; leading to test failures: ;; leading to test failures:
;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To
;; work around that, set the time to roughly the release date. ;; work around that, set the time to roughly the release date.
(invoke "faketime" "2022-06-01" "./nss/tests/all.sh")) (invoke "faketime" "2022-06-01" "./nss/tests/all.sh"))
(format #t "test suite not run~%")))) (format #t "test suite not run~%"))))
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(bin (string-append (assoc-ref outputs "bin") "/bin")) (bin (string-append (assoc-ref outputs "bin") "/bin"))
(inc (string-append out "/include/nss")) (inc (string-append out "/include/nss"))
(lib (string-append out "/lib/nss")) (lib (string-append out "/lib/nss"))
(obj (match (scandir "dist" (cut string-suffix? "OBJ" <>)) (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
((obj) (string-append "dist/" obj))))) ((obj) (string-append "dist/" obj)))))
;; Install nss-config to $out/bin. ;; Install nss-config to $out/bin.
(install-file (string-append obj "/bin/nss-config") (install-file (string-append obj "/bin/nss-config")
(string-append out "/bin")) (string-append out "/bin"))
(delete-file (string-append obj "/bin/nss-config")) (delete-file (string-append obj "/bin/nss-config"))
;; Install nss.pc to $out/lib/pkgconfig. ;; Install nss.pc to $out/lib/pkgconfig.
(install-file (string-append obj "/lib/pkgconfig/nss.pc") (install-file (string-append obj "/lib/pkgconfig/nss.pc")
(string-append out "/lib/pkgconfig")) (string-append out "/lib/pkgconfig"))
(delete-file (string-append obj "/lib/pkgconfig/nss.pc")) (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
(rmdir (string-append obj "/lib/pkgconfig")) (rmdir (string-append obj "/lib/pkgconfig"))
;; Install other files. ;; Install other files.
(copy-recursively "dist/public/nss" inc) (copy-recursively "dist/public/nss" inc)
(copy-recursively (string-append obj "/bin") bin) (copy-recursively (string-append obj "/bin") bin)
(copy-recursively (string-append obj "/lib") lib))))))) (copy-recursively (string-append obj "/lib") lib)))))))
(inputs (inputs
(list sqlite zlib)) (list sqlite zlib))
(propagated-inputs (propagated-inputs
(list nspr)) ;required by nss.pc. (list nspr)) ;required by nss.pc.
(native-inputs (native-inputs
(list perl libfaketime)) ;for tests (list perl libfaketime)) ;for tests
;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
;; another build is happening concurrently on the same machine. ;; another build is happening concurrently on the same machine.