nss: fix build for FreeBSD (#387520)

authored by

John Ericson and committed by
GitHub
bc8fbef5 3f894873

+31 -12
+31 -12
pkgs/development/libraries/nss/generic.nix
··· 102 platform.parsed.cpu.name; 103 # yes, this is correct. nixpkgs uses "host" for the platform the binary will run on whereas nss uses "host" for the platform that the build is running on 104 target = getArch stdenv.hostPlatform; 105 host = getArch stdenv.buildPlatform; 106 in 107 '' 108 runHook preBuild 109 110 sed -i 's|nss_dist_dir="$dist_dir"|nss_dist_dir="'$out'"|;s|nss_dist_obj_dir="$obj_dir"|nss_dist_obj_dir="'$out'"|' build.sh 111 - ./build.sh -v --opt \ 112 - --with-nspr=${nspr.dev}/include:${nspr.out}/lib \ 113 - --system-sqlite \ 114 - --enable-legacy-db \ 115 - --target ${target} \ 116 - -Dhost_arch=${host} \ 117 - -Duse_system_zlib=1 \ 118 - --enable-libpkix \ 119 - -j $NIX_BUILD_CORES \ 120 - ${lib.optionalString enableFIPS "--enable-fips"} \ 121 - ${lib.optionalString stdenv.hostPlatform.isDarwin "--clang"} \ 122 - ${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"} 123 124 runHook postBuild 125 ''; ··· 134 ] 135 ++ lib.optionals stdenv.hostPlatform.isILP32 [ 136 "-DNS_PTR_LE_32=1" # See RNG_RandomUpdate() in drdbg.c 137 ] 138 ); 139
··· 102 platform.parsed.cpu.name; 103 # yes, this is correct. nixpkgs uses "host" for the platform the binary will run on whereas nss uses "host" for the platform that the build is running on 104 target = getArch stdenv.hostPlatform; 105 + target_system = stdenv.hostPlatform.uname.system; 106 host = getArch stdenv.buildPlatform; 107 + 108 + buildFlags = 109 + [ 110 + "-v" 111 + "--opt" 112 + "--with-nspr=${nspr.dev}/include:${nspr.out}/lib" 113 + "--system-sqlite" 114 + "--enable-legacy-db" 115 + "--target ${target}" 116 + "-Dhost_arch=${host}" 117 + "-Duse_system_zlib=1" 118 + "--enable-libpkix" 119 + "-j" 120 + "$NIX_BUILD_CORES" 121 + ] 122 + ++ lib.optional enableFIPS "--enable-fips" 123 + ++ lib.optional stdenv.hostPlatform.isDarwin "--clang" 124 + ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 125 + "-DOS=${target_system}" 126 + "--disable-tests" 127 + ]; 128 in 129 '' 130 runHook preBuild 131 132 sed -i 's|nss_dist_dir="$dist_dir"|nss_dist_dir="'$out'"|;s|nss_dist_obj_dir="$obj_dir"|nss_dist_obj_dir="'$out'"|' build.sh 133 + ./build.sh ${lib.concatStringsSep " " buildFlags} 134 135 runHook postBuild 136 ''; ··· 145 ] 146 ++ lib.optionals stdenv.hostPlatform.isILP32 [ 147 "-DNS_PTR_LE_32=1" # See RNG_RandomUpdate() in drdbg.c 148 + ] 149 + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ 150 + "-D_XOPEN_SOURCE=700" 151 + "-D__BSD_VISIBLE" 152 + # uses compiler intrinsics gated behind runtime checks for cpu feature flags 153 + "-mavx2" 154 + "-maes" 155 + "-mpclmul" 156 ] 157 ); 158