1{ lib
2, stdenv
3, fetchurl
4, CoreServices
5, buildPackages
6, nixosTests
7}:
8
9stdenv.mkDerivation rec {
10 pname = "nspr";
11 version = "4.35";
12
13 src = fetchurl {
14 url = "mirror://mozilla/nspr/releases/v${version}/src/nspr-${version}.tar.gz";
15 hash = "sha256-fqMpfqWWm10lpd2NR/JEPNqI6e50YwH24eFCb4pqvI8=";
16 };
17
18 patches = [
19 ./0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch
20 ];
21
22 outputs = [ "out" "dev" ];
23 outputBin = "dev";
24
25 preConfigure = ''
26 cd nspr
27 '' + lib.optionalString stdenv.isDarwin ''
28 substituteInPlace configure --replace '@executable_path/' "$out/lib/"
29 substituteInPlace configure.in --replace '@executable_path/' "$out/lib/"
30 '';
31
32 HOST_CC = "cc";
33 depsBuildBuild = [ buildPackages.stdenv.cc ];
34 configureFlags = [
35 "--enable-optimize"
36 "--disable-debug"
37 ] ++ lib.optional stdenv.is64bit "--enable-64bit";
38
39 postInstall = ''
40 find $out -name "*.a" -delete
41 moveToOutput share "$dev" # just aclocal
42 '';
43
44 buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
45
46 enableParallelBuilding = true;
47
48 passthru.tests = {
49 inherit (nixosTests) firefox firefox-esr-91 firefox-esr-102;
50 };
51
52 meta = with lib; {
53 homepage = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Reference/NSPR_functions";
54 description = "Netscape Portable Runtime, a platform-neutral API for system-level and libc-like functions";
55 maintainers = with maintainers; [ ajs124 hexa ];
56 platforms = platforms.all;
57 license = licenses.mpl20;
58 };
59}