2019-10-28 21:10:05 +00:00
|
|
|
{ stdenv, fetchFromGitHub, nasm, which }:
|
2008-07-29 15:26:03 +01:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
with stdenv.lib;
|
2008-07-29 15:26:03 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "crypto++";
|
2019-10-28 21:10:05 +00:00
|
|
|
version = "8.2.0";
|
|
|
|
underscoredVersion = strings.replaceStrings ["."] ["_"] version;
|
2008-07-29 15:26:03 +01: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}";
|
|
|
|
sha256 = "01zrrzjn14yhkb9fzzl57vmh7ig9a6n6fka45f8za0gf7jpcq3mj";
|
2008-07-29 15:26:03 +01:00
|
|
|
};
|
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace GNUmakefile \
|
|
|
|
--replace "AR = libtool" "AR = ar" \
|
|
|
|
--replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
|
2019-04-21 18:06:50 +01:00
|
|
|
'';
|
2015-06-27 09:28:31 +01:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
nativeBuildInputs = optionals stdenv.hostPlatform.isx86 [ nasm which ];
|
2015-06-27 09:28:31 +01:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
preBuild = optionalString stdenv.hostPlatform.isx86 "${stdenv.shell} rdrand-nasm.sh";
|
|
|
|
makeFlags = [ "PREFIX=${placeholder "out"}" ];
|
|
|
|
buildFlags = [ "shared" "libcryptopp.pc" ];
|
|
|
|
enableParallelBuilding = true;
|
2009-08-11 00:50:07 +01:00
|
|
|
|
|
|
|
doCheck = true;
|
2008-07-29 15:26:03 +01:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
preInstall = "rm libcryptopp.a"; # built for checks but we don't install static lib into the nix store
|
|
|
|
installTargets = "install-lib";
|
|
|
|
installFlags = [ "LDCONF=true" ];
|
|
|
|
postInstall = optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
|
|
ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${versions.majorMinor version}
|
|
|
|
ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${versions.major version}
|
2016-09-29 22:07:56 +01:00
|
|
|
'';
|
2015-06-27 09:28:31 +01:00
|
|
|
|
2019-10-28 21:10:05 +00:00
|
|
|
meta = {
|
2008-07-29 15:26:03 +01: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";
|
|
|
|
license = with licenses; [ boost publicDomain ];
|
2015-04-20 22:44:53 +01:00
|
|
|
platforms = platforms.all;
|
2019-10-28 21:10:05 +00:00
|
|
|
maintainers = with maintainers; [ c0bw3b ];
|
2008-07-29 15:26:03 +01:00
|
|
|
};
|
2009-08-11 00:50:07 +01:00
|
|
|
}
|