about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/crypto++
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-11 23:37:02 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-11 23:41:30 +0000
commit6c557e3f1c28cf87e9fba232811d6875dd1399c1 (patch)
tree035a071d5d8980df6de0fa42e2ef8fc0cce7055e /nixpkgs/pkgs/development/libraries/crypto++
parentda7500bc026e937ac7fce7b50f67a0e1765737a7 (diff)
parente4134747f5666bcab8680aff67fa3b63384f9a0f (diff)
downloadnixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.gz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.bz2
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.lz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.xz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.zst
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.zip
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/crypto++')
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/dll.patch28
3 files changed, 26 insertions, 71 deletions
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch b/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
deleted file mode 100644
index 5a6cb3bcafb4..000000000000
--- a/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/GNUmakefile b/GNUmakefile
-index 4de9d10..ff4789a 100755
---- a/GNUmakefile
-+++ b/GNUmakefile
-@@ -271,8 +271,8 @@ endif # OpenMP
- endif # IS_LINUX
- 
- ifneq ($(IS_DARWIN),0)
--AR = libtool
--ARFLAGS = -static -o
-+AR = ar
-+ARFLAGS = cru
- CXX ?= c++
- ifeq ($(IS_GCC_29),1)
- CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/default.nix b/nixpkgs/pkgs/development/libraries/crypto++/default.nix
index cb481fc7084e..3fe277481553 100644
--- a/nixpkgs/pkgs/development/libraries/crypto++/default.nix
+++ b/nixpkgs/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 ];
   };
 }
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/dll.patch b/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
deleted file mode 100644
index 12df1fb9e9e9..000000000000
--- a/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Get rid of Windows-specific stuff.
-
-diff --git a/GNUmakefile b/GNUmakefile
-index 4de9d10..ff4789a 100755
---- a/GNUmakefile
-+++ b/GNUmakefile
-@@ -656,7 +656,7 @@ nolib: $(OBJS)
- dll: cryptest.import.exe dlltest.exe
- 
- cryptopp.dll: $(DLLOBJS)
--	$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
-+	$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS)
- 
- libcryptopp.import.a: $(LIBIMPORTOBJS)
- 	$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
-diff --git a/dll.cpp b/dll.cpp
-index 72dade9..b5097ab 100644
---- a/dll.cpp
-+++ b/dll.cpp
-@@ -48,7 +48,7 @@ NAMESPACE_END
- 

- #endif

- 

--#ifdef CRYPTOPP_EXPORTS

-+#if defined CRYPTOPP_EXPORTS && defined _MSC_VER

- 

- USING_NAMESPACE(CryptoPP)

-