lol

Merge pull request #158367 from c0bw3b/pkg/cryptopp

cryptopp: add an option to build with OpenMP

authored by

Robert Scott and committed by
GitHub
381c2e23 4422196e

+23 -8
+23 -8
pkgs/development/libraries/crypto++/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 2 4 , enableStatic ? stdenv.hostPlatform.isStatic 3 5 , enableShared ? !enableStatic 6 + # Multi-threading with OpenMP is disabled by default 7 + # more info on https://www.cryptopp.com/wiki/OpenMP 8 + , withOpenMP ? false 9 + , llvmPackages 4 10 }: 5 11 6 12 stdenv.mkDerivation rec { ··· 19 25 20 26 postPatch = '' 21 27 substituteInPlace GNUmakefile \ 22 - --replace "AR = libtool" "AR = ar" \ 28 + --replace "AR = /usr/bin/libtool" "AR = ar" \ 23 29 --replace "ARFLAGS = -static -o" "ARFLAGS = -cru" 24 30 ''; 31 + 32 + buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ]; 25 33 26 34 makeFlags = [ "PREFIX=${placeholder "out"}" ]; 35 + 27 36 buildFlags = 28 37 lib.optional enableStatic "static" 29 38 ++ lib.optional enableShared "shared" 30 39 ++ [ "libcryptopp.pc" ]; 40 + 31 41 enableParallelBuilding = true; 32 42 hardeningDisable = [ "fortify" ]; 43 + CXXFLAGS = lib.optionals (withOpenMP) [ "-fopenmp" ]; 33 44 34 45 doCheck = true; 35 46 ··· 38 49 39 50 installTargets = [ "install-lib" ]; 40 51 installFlags = [ "LDCONF=true" ]; 52 + # TODO: remove postInstall hook with v8.7 -> https://github.com/weidai11/cryptopp/commit/230c558a 41 53 postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 42 54 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.majorMinor version} 43 55 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.major version} 44 56 ''; 45 57 46 - meta = { 47 - description = "Crypto++, a free C++ class library of cryptographic schemes"; 58 + meta = with lib; { 59 + description = "A free C++ class library of cryptographic schemes"; 48 60 homepage = "https://cryptopp.com/"; 49 - changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt"; 50 - license = with lib.licenses; [ boost publicDomain ]; 51 - platforms = lib.platforms.all; 52 - maintainers = with lib.maintainers; [ c0bw3b ]; 61 + changelog = [ 62 + "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt" 63 + "https://github.com/weidai11/cryptopp/releases/tag/CRYPTOPP_${underscoredVersion}" 64 + ]; 65 + license = with licenses; [ boost publicDomain ]; 66 + platforms = platforms.all; 67 + maintainers = with maintainers; [ c0bw3b ]; 53 68 }; 54 69 }