about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/crypto++
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/crypto++
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
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.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/dll.patch28
3 files changed, 98 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch b/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
new file mode 100644
index 000000000000..5a6cb3bcafb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
@@ -0,0 +1,15 @@
+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
new file mode 100644
index 000000000000..cbd3e4054159
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/default.nix
@@ -0,0 +1,55 @@
+{ fetchFromGitHub, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "crypto++-${version}";
+  majorVersion = "5.6";
+  version = "${majorVersion}.5";
+
+  src = fetchFromGitHub {
+    owner = "weidai11";
+    repo = "cryptopp";
+    rev = "CRYPTOPP_5_6_5";
+    sha256 = "1yk7jyf4va9425cg05llskpls2jm7n3jwy2hj5jm74zkr4mwpvl7";
+  };
+
+  patches = stdenv.lib.concatLists [
+    (stdenv.lib.optional (stdenv.hostPlatform.system != "i686-cygwin") ./dll.patch)
+    (stdenv.lib.optional stdenv.hostPlatform.isDarwin ./GNUmakefile-darwin.patch)
+  ];
+
+
+  configurePhase = let
+    marchflags =
+      if stdenv.isi686 then "-march=i686" else
+      if stdenv.isx86_64 then "-march=nocona -mtune=generic" else
+      "";
+    in
+    ''
+      sed -i GNUmakefile \
+        -e 's|-march=native|${marchflags} -fPIC|g' \
+        -e '/^CXXFLAGS =/s|-g ||'
+    '';
+
+  enableParallelBuilding = true;
+
+  makeFlags = [ "PREFIX=$(out)" ];
+  buildFlags = [ "libcryptopp.so" ];
+  installFlags = [ "LDCONF=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}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Crypto++, a free C++ class library of cryptographic schemes";
+    homepage = http://cryptopp.com/;
+    license = licenses.boost;
+    platforms = platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/dll.patch b/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
new file mode 100644
index 000000000000..12df1fb9e9e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
@@ -0,0 +1,28 @@
+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)

+