Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 enableStatic ? stdenv.hostPlatform.isStatic, 6 enableShared ? !enableStatic, 7 # Multi-threading with OpenMP is disabled by default 8 # more info on https://www.cryptopp.com/wiki/OpenMP 9 withOpenMP ? false, 10 llvmPackages, 11}: 12 13stdenv.mkDerivation rec { 14 pname = "crypto++"; 15 version = "8.9.0"; 16 underscoredVersion = lib.strings.replaceStrings [ "." ] [ "_" ] version; 17 18 src = fetchFromGitHub { 19 owner = "weidai11"; 20 repo = "cryptopp"; 21 rev = "CRYPTOPP_${underscoredVersion}"; 22 hash = "sha256-HV+afSFkiXdy840JbHBTR8lLL0GMwsN3QdwaoQmicpQ="; 23 }; 24 25 outputs = [ 26 "out" 27 "dev" 28 ]; 29 30 postPatch = '' 31 substituteInPlace GNUmakefile \ 32 --replace "AR = /usr/bin/libtool" "AR = ar" \ 33 --replace "ARFLAGS = -static -o" "ARFLAGS = -cru" 34 ''; 35 36 buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ]; 37 38 makeFlags = [ "PREFIX=${placeholder "out"}" ]; 39 40 buildFlags = 41 lib.optional enableStatic "static" ++ lib.optional enableShared "shared" ++ [ "libcryptopp.pc" ]; 42 43 enableParallelBuilding = true; 44 hardeningDisable = [ "fortify" ]; 45 CXXFLAGS = lib.optionals (withOpenMP) [ "-fopenmp" ]; 46 47 doCheck = true; 48 49 # always built for checks but install static lib only when necessary 50 preInstall = lib.optionalString (!enableStatic) "rm -f libcryptopp.a"; 51 52 installTargets = [ "install-lib" ]; 53 installFlags = [ "LDCONF=true" ]; 54 55 meta = with lib; { 56 description = "Free C++ class library of cryptographic schemes"; 57 homepage = "https://cryptopp.com/"; 58 changelog = [ 59 "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt" 60 "https://github.com/weidai11/cryptopp/releases/tag/CRYPTOPP_${underscoredVersion}" 61 ]; 62 license = with licenses; [ 63 boost 64 publicDomain 65 ]; 66 platforms = platforms.all; 67 maintainers = with maintainers; [ c0bw3b ]; 68 }; 69}