summary refs log tree commit diff
path: root/pkgs/development/libraries/crypto++/default.nix
diff options
context:
space:
mode:
authorc0bw3b <c0bw3b@users.noreply.github.com>2019-10-28 22:10:05 +0100
committerJon <jonringer@users.noreply.github.com>2019-10-30 08:11:16 -0700
commitc36d92f1652fa0b9f367669fdcef08a4a55c8c2e (patch)
treecbf4ff4c481d62882be14748ea6b4ca5d72ce42f /pkgs/development/libraries/crypto++/default.nix
parent57c922972a413d257a82d7e88399927b0e5dfcf4 (diff)
cryptopp: 5.6.5 -> 8.2.0
+ add c0bw3b as maintainer
Diffstat (limited to 'pkgs/development/libraries/crypto++/default.nix')
-rw-r--r--pkgs/development/libraries/crypto++/default.nix54
1 files changed, 26 insertions, 28 deletions
diff --git a/pkgs/development/libraries/crypto++/default.nix b/pkgs/development/libraries/crypto++/default.nix
index cb481fc7084e6..b472733f8ee6c 100644
--- a/pkgs/development/libraries/crypto++/default.nix
+++ b/pkgs/development/libraries/crypto++/default.nix
@@ -1,49 +1,47 @@
-{ fetchFromGitHub, stdenv }:
+{ stdenv, fetchFromGitHub, nasm, which }:
 
+with stdenv.lib;
 stdenv.mkDerivation rec {
   pname = "crypto++";
-  majorVersion = "5.6";
-  version = "${majorVersion}.5";
+  version = "8.2.0";
+  underscoredVersion = strings.replaceStrings ["."] ["_"] version;
 
   src = fetchFromGitHub {
     owner = "weidai11";
     repo = "cryptopp";
-    rev = "CRYPTOPP_5_6_5";
-    sha256 = "1yk7jyf4va9425cg05llskpls2jm7n3jwy2hj5jm74zkr4mwpvl7";
+    rev = "CRYPTOPP_${underscoredVersion}";
+    sha256 = "01zrrzjn14yhkb9fzzl57vmh7ig9a6n6fka45f8za0gf7jpcq3mj";
   };
 
-  patches = stdenv.lib.concatLists [
-    (stdenv.lib.optional (stdenv.hostPlatform.system != "i686-cygwin") ./dll.patch)
-    (stdenv.lib.optional stdenv.hostPlatform.isDarwin ./GNUmakefile-darwin.patch)
-  ];
-
-
-  configurePhase = ''
-      sed -i GNUmakefile \
-        -e 's|-march=native|-fPIC|g' \
-        -e '/^CXXFLAGS =/s|-g ||'
+  postPatch = ''
+    substituteInPlace GNUmakefile \
+        --replace "AR = libtool" "AR = ar" \
+        --replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
   '';
 
-  enableParallelBuilding = true;
+  nativeBuildInputs = optionals stdenv.hostPlatform.isx86 [ nasm which ];
 
-  makeFlags = [ "PREFIX=$(out)" ];
-  buildFlags = [ "libcryptopp.so" ];
-  installFlags = [ "LDCONF=true" ];
+  preBuild = optionalString stdenv.hostPlatform.isx86 "${stdenv.shell} rdrand-nasm.sh";
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
+  buildFlags = [ "shared" "libcryptopp.pc" ];
+  enableParallelBuilding = true;
 
   doCheck = true;
-  checkPhase = "LD_LIBRARY_PATH=`pwd` make test";
 
-  # prefer -fPIC and .so to .a; cryptotest.exe seems superfluous
-  postInstall = ''
-    rm "$out"/lib/*.a -r "$out/bin"
-    ln -sf "$out"/lib/libcryptopp.so.${version} "$out"/lib/libcryptopp.so.${majorVersion}
+  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}
   '';
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "Crypto++, a free C++ class library of cryptographic schemes";
-    homepage = http://cryptopp.com/;
-    license = licenses.boost;
+    homepage = "https://cryptopp.com/";
+    changelog = "https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt";
+    license = with licenses; [ boost publicDomain ];
     platforms = platforms.all;
-    maintainers = [ ];
+    maintainers = with maintainers; [ c0bw3b ];
   };
 }