2021-03-01 11:27:56 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-26 23:09:35 +00:00
|
|
|
, enableStatic ? stdenv.hostPlatform.isStatic
|
|
|
|
, enableShared ? !enableStatic
|
|
|
|
}:
|
2008-07-29 14:26:03 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "crypto++";
|
2021-01-23 00:07:16 +00:00
|
|
|
version = "8.4.0";
|
|
|
|
underscoredVersion = lib.strings.replaceStrings ["."] ["_"] version;
|
2008-07-29 14:26:03 +00:00
|
|
|
|
2016-12-29 01:56:47 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "weidai11";
|
|
|
|
repo = "cryptopp";
|
2019-10-28 21:10:05 +00:00
|
|
|
rev = "CRYPTOPP_${underscoredVersion}";
|
2021-01-23 00:07:16 +00:00
|
|
|
sha256 = "1gwn8yh1mh41hkh6sgnhb9c3ygrdazd7645msl20i0zdvcp7f5w3";
|
2008-07-29 14:26:03 +00:00
|
|
|
};
|
|
|
|
|
2021-01-26 23:09:35 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace GNUmakefile \
|
|
|
|
--replace "AR = libtool" "AR = ar" \
|
|
|
|
--replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
|
2021-03-01 00:02:03 +00:00
|
|
|
|
|
|
|
# See https://github.com/weidai11/cryptopp/issues/1011
|
|
|
|
substituteInPlace GNUmakefile \
|
|
|
|
--replace "ZOPT = -O0" "ZOPT ="
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sh TestScripts/configure.sh
|
2019-04-21 17:06:50 +00:00
|
|
|
'';
|
2015-06-27 08:28:31 +00:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
makeFlags = [ "PREFIX=${placeholder "out"}" ];
|
2021-01-26 23:09:35 +00:00
|
|
|
buildFlags =
|
|
|
|
lib.optional enableStatic "static"
|
|
|
|
++ lib.optional enableShared "shared"
|
|
|
|
++ [ "libcryptopp.pc" ];
|
2019-10-28 21:10:05 +00:00
|
|
|
enableParallelBuilding = true;
|
2009-08-10 23:50:07 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
2008-07-29 14:26:03 +00:00
|
|
|
|
2021-01-26 23:09:35 +00:00
|
|
|
# built for checks but we don't install static lib into the nix store
|
|
|
|
preInstall = lib.optionalString (!enableStatic) "rm libcryptopp.a";
|
|
|
|
|
2019-11-04 11:23:53 +00:00
|
|
|
installTargets = [ "install-lib" ];
|
2019-10-28 21:10:05 +00:00
|
|
|
installFlags = [ "LDCONF=true" ];
|
2021-01-23 00:07:16 +00:00
|
|
|
postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
|
|
ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.majorMinor version}
|
|
|
|
ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${lib.versions.major version}
|
2016-09-29 21:07:56 +00:00
|
|
|
'';
|
2015-06-27 08:28:31 +00:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
meta = {
|
2008-07-29 14:26:03 +00:00
|
|
|
description = "Crypto++, a free C++ class library of cryptographic schemes";
|
2019-10-28 21:10:05 +00:00
|
|
|
homepage = "https://cryptopp.com/";
|
|
|
|
changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt";
|
2021-01-23 00:07:16 +00:00
|
|
|
license = with lib.licenses; [ boost publicDomain ];
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
maintainers = with lib.maintainers; [ c0bw3b ];
|
2008-07-29 14:26:03 +00:00
|
|
|
};
|
2009-08-10 23:50:07 +00:00
|
|
|
}
|