nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 19.03 55 lines 1.5 kB view raw
1{ 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 = stdenv.lib.concatLists [ 16 (stdenv.lib.optional (stdenv.hostPlatform.system != "i686-cygwin") ./dll.patch) 17 (stdenv.lib.optional stdenv.hostPlatform.isDarwin ./GNUmakefile-darwin.patch) 18 ]; 19 20 21 configurePhase = let 22 marchflags = 23 if stdenv.isi686 then "-march=i686" else 24 if stdenv.isx86_64 then "-march=nocona -mtune=generic" else 25 ""; 26 in 27 '' 28 sed -i GNUmakefile \ 29 -e 's|-march=native|${marchflags} -fPIC|g' \ 30 -e '/^CXXFLAGS =/s|-g ||' 31 ''; 32 33 enableParallelBuilding = true; 34 35 makeFlags = [ "PREFIX=$(out)" ]; 36 buildFlags = [ "libcryptopp.so" ]; 37 installFlags = [ "LDCONF=true" ]; 38 39 doCheck = true; 40 checkPhase = "LD_LIBRARY_PATH=`pwd` make test"; 41 42 # prefer -fPIC and .so to .a; cryptotest.exe seems superfluous 43 postInstall = '' 44 rm "$out"/lib/*.a -r "$out/bin" 45 ln -sf "$out"/lib/libcryptopp.so.${version} "$out"/lib/libcryptopp.so.${majorVersion} 46 ''; 47 48 meta = with stdenv.lib; { 49 description = "Crypto++, a free C++ class library of cryptographic schemes"; 50 homepage = http://cryptopp.com/; 51 license = licenses.boost; 52 platforms = platforms.all; 53 maintainers = [ ]; 54 }; 55}