diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/crypto++')
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) + |