nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 21.11 61 lines 2.0 kB view raw
1{ lib, stdenv, fetchFromGitHub 2, enableStatic ? stdenv.hostPlatform.isStatic 3, enableShared ? !enableStatic 4}: 5 6stdenv.mkDerivation rec { 7 pname = "crypto++"; 8 version = "8.4.0"; 9 underscoredVersion = lib.strings.replaceStrings ["."] ["_"] version; 10 11 src = fetchFromGitHub { 12 owner = "weidai11"; 13 repo = "cryptopp"; 14 rev = "CRYPTOPP_${underscoredVersion}"; 15 sha256 = "1gwn8yh1mh41hkh6sgnhb9c3ygrdazd7645msl20i0zdvcp7f5w3"; 16 }; 17 18 outputs = [ "out" "dev" ]; 19 20 postPatch = '' 21 substituteInPlace GNUmakefile \ 22 --replace "AR = libtool" "AR = ar" \ 23 --replace "ARFLAGS = -static -o" "ARFLAGS = -cru" 24 25 # See https://github.com/weidai11/cryptopp/issues/1011 26 substituteInPlace GNUmakefile \ 27 --replace "ZOPT = -O0" "ZOPT =" 28 ''; 29 30 preConfigure = '' 31 sh TestScripts/configure.sh 32 ''; 33 34 makeFlags = [ "PREFIX=${placeholder "out"}" ]; 35 buildFlags = 36 lib.optional enableStatic "static" 37 ++ lib.optional enableShared "shared" 38 ++ [ "libcryptopp.pc" ]; 39 enableParallelBuilding = true; 40 41 doCheck = true; 42 43 # built for checks but we don't install static lib into the nix store 44 preInstall = lib.optionalString (!enableStatic) "rm libcryptopp.a"; 45 46 installTargets = [ "install-lib" ]; 47 installFlags = [ "LDCONF=true" ]; 48 postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 49 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.majorMinor version} 50 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.major version} 51 ''; 52 53 meta = { 54 description = "Crypto++, a free C++ class library of cryptographic schemes"; 55 homepage = "https://cryptopp.com/"; 56 changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt"; 57 license = with lib.licenses; [ boost publicDomain ]; 58 platforms = lib.platforms.all; 59 maintainers = with lib.maintainers; [ c0bw3b ]; 60 }; 61}