2021-03-01 12:27:56 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-27 00:09:35 +01:00
|
|
|
, enableStatic ? stdenv.hostPlatform.isStatic
|
|
|
|
, enableShared ? !enableStatic
|
|
|
|
}:
|
2008-07-29 16:26:03 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "crypto++";
|
2021-12-20 00:04:57 +01:00
|
|
|
version = "8.6.0";
|
2021-01-23 01:07:16 +01:00
|
|
|
underscoredVersion = lib.strings.replaceStrings ["."] ["_"] version;
|
2008-07-29 16:26:03 +02:00
|
|
|
|
2016-12-29 02:56:47 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "weidai11";
|
|
|
|
repo = "cryptopp";
|
2019-10-28 22:10:05 +01:00
|
|
|
rev = "CRYPTOPP_${underscoredVersion}";
|
2021-12-20 00:04:57 +01:00
|
|
|
hash = "sha256-a3TYaK34WvKEXN7LKAfGwQ3ZL6a3k/zMZyyVfnkQqO4=";
|
2008-07-29 16:26:03 +02:00
|
|
|
};
|
|
|
|
|
2021-01-27 00:09:35 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2019-10-28 22:10:05 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace GNUmakefile \
|
2021-12-20 00:04:57 +01:00
|
|
|
--replace "AR = libtool" "AR = ar" \
|
|
|
|
--replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
|
2019-04-21 19:06:50 +02:00
|
|
|
'';
|
2015-06-27 10:28:31 +02:00
|
|
|
|
2019-10-28 22:10:05 +01:00
|
|
|
makeFlags = [ "PREFIX=${placeholder "out"}" ];
|
2021-01-27 00:09:35 +01:00
|
|
|
buildFlags =
|
|
|
|
lib.optional enableStatic "static"
|
|
|
|
++ lib.optional enableShared "shared"
|
|
|
|
++ [ "libcryptopp.pc" ];
|
2019-10-28 22:10:05 +01:00
|
|
|
enableParallelBuilding = true;
|
2021-12-20 00:04:57 +01:00
|
|
|
hardeningDisable = [ "fortify" ];
|
2009-08-11 01:50:07 +02:00
|
|
|
|
|
|
|
doCheck = true;
|
2008-07-29 16:26:03 +02:00
|
|
|
|
2021-12-20 00:04:57 +01:00
|
|
|
# always built for checks but install static lib only when necessary
|
2022-01-07 11:36:33 +01:00
|
|
|
preInstall = lib.optionalString (!enableStatic) "rm -f libcryptopp.a";
|
2021-01-27 00:09:35 +01:00
|
|
|
|
2019-11-04 12:23:53 +01:00
|
|
|
installTargets = [ "install-lib" ];
|
2019-10-28 22:10:05 +01:00
|
|
|
installFlags = [ "LDCONF=true" ];
|
2021-01-23 01:07:16 +01: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 23:07:56 +02:00
|
|
|
'';
|
2015-06-27 10:28:31 +02:00
|
|
|
|
2019-10-28 22:10:05 +01:00
|
|
|
meta = {
|
2008-07-29 16:26:03 +02:00
|
|
|
description = "Crypto++, a free C++ class library of cryptographic schemes";
|
2019-10-28 22:10:05 +01:00
|
|
|
homepage = "https://cryptopp.com/";
|
|
|
|
changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt";
|
2021-01-23 01:07:16 +01:00
|
|
|
license = with lib.licenses; [ boost publicDomain ];
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
maintainers = with lib.maintainers; [ c0bw3b ];
|
2008-07-29 16:26:03 +02:00
|
|
|
};
|
2009-08-11 01:50:07 +02:00
|
|
|
}
|