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