Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 54 lines 1.4 kB view raw
1{ fetchurl, fetchFromGitHub, stdenv }: 2 3stdenv.mkDerivation rec { 4 name = "crypto++-${version}"; 5 majorVersion = "5.6"; 6 version = "${majorVersion}.5"; 7 8 src = fetchFromGitHub { 9 owner = "weidai11"; 10 repo = "cryptopp"; 11 rev = "CRYPTOPP_5_6_5"; 12 sha256 = "1yk7jyf4va9425cg05llskpls2jm7n3jwy2hj5jm74zkr4mwpvl7"; 13 }; 14 15 patches = with stdenv; 16 lib.optional (system != "i686-cygwin") ./dll.patch 17 ++ lib.optional isDarwin ./GNUmakefile-darwin.patch; 18 19 20 configurePhase = let 21 marchflags = 22 if stdenv.isi686 then "-march=i686" else 23 if stdenv.isx86_64 then "-march=nocona -mtune=generic" else 24 ""; 25 in 26 '' 27 sed -i GNUmakefile \ 28 -e 's|-march=native|${marchflags} -fPIC|g' \ 29 -e '/^CXXFLAGS =/s|-g ||' 30 ''; 31 32 enableParallelBuilding = true; 33 34 makeFlags = [ "PREFIX=$(out)" ]; 35 buildFlags = [ "libcryptopp.so" ]; 36 installFlags = [ "LDCONF=true" ]; 37 38 doCheck = true; 39 checkPhase = "LD_LIBRARY_PATH=`pwd` make test"; 40 41 # prefer -fPIC and .so to .a; cryptotest.exe seems superfluous 42 postInstall = '' 43 rm "$out"/lib/*.a -r "$out/bin" 44 ln -sf "$out"/lib/libcryptopp.so.${version} "$out"/lib/libcryptopp.so.${majorVersion} 45 ''; 46 47 meta = with stdenv.lib; { 48 description = "Crypto++, a free C++ class library of cryptographic schemes"; 49 homepage = http://cryptopp.com/; 50 license = licenses.boost; 51 platforms = platforms.all; 52 maintainers = [ ]; 53 }; 54}