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