nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchFromGitHub, nasm, which }:
2
3with stdenv.lib;
4stdenv.mkDerivation rec {
5 pname = "crypto++";
6 version = "8.2.0";
7 underscoredVersion = strings.replaceStrings ["."] ["_"] version;
8
9 src = fetchFromGitHub {
10 owner = "weidai11";
11 repo = "cryptopp";
12 rev = "CRYPTOPP_${underscoredVersion}";
13 sha256 = "01zrrzjn14yhkb9fzzl57vmh7ig9a6n6fka45f8za0gf7jpcq3mj";
14 };
15
16 postPatch = ''
17 substituteInPlace GNUmakefile \
18 --replace "AR = libtool" "AR = ar" \
19 --replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
20 '';
21
22 nativeBuildInputs = optionals stdenv.hostPlatform.isx86 [ nasm which ];
23
24 preBuild = optionalString stdenv.hostPlatform.isx86 "${stdenv.shell} rdrand-nasm.sh";
25 makeFlags = [ "PREFIX=${placeholder "out"}" ];
26 buildFlags = [ "shared" "libcryptopp.pc" ];
27 enableParallelBuilding = true;
28
29 doCheck = true;
30
31 preInstall = "rm libcryptopp.a"; # built for checks but we don't install static lib into the nix store
32 installTargets = [ "install-lib" ];
33 installFlags = [ "LDCONF=true" ];
34 postInstall = optionalString (!stdenv.hostPlatform.isDarwin) ''
35 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${versions.majorMinor version}
36 ln -sr $out/lib/libcryptopp.so.${version} $out/lib/libcryptopp.so.${versions.major version}
37 '';
38
39 meta = {
40 description = "Crypto++, a free C++ class library of cryptographic schemes";
41 homepage = "https://cryptopp.com/";
42 changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt";
43 license = with licenses; [ boost publicDomain ];
44 platforms = platforms.all;
45 maintainers = with maintainers; [ c0bw3b ];
46 };
47}