2009-09-16 16:35:38 +02:00
|
|
|
{ fetchurl, stdenv, unzip, libtool }:
|
2008-07-29 16:26:03 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2009-08-11 01:50:07 +02:00
|
|
|
name = "crypto++-5.6.0";
|
2008-07-29 16:26:03 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2009-08-11 01:50:07 +02:00
|
|
|
url = "mirror://sourceforge/cryptopp/cryptopp560.zip";
|
|
|
|
sha256 = "1icbk50mr1sqycqbxbqg703m8aamz23ajgl22ychxdahz2sz08mm";
|
2008-07-29 16:26:03 +02:00
|
|
|
};
|
|
|
|
|
2009-08-11 01:50:07 +02:00
|
|
|
patches = [ ./pic.patch ]
|
2010-07-07 13:44:58 +02:00
|
|
|
++ stdenv.lib.optional (stdenv.system != "i686-cygwin") ./dll.patch;
|
2009-08-11 01:50:07 +02:00
|
|
|
|
|
|
|
|
2009-09-16 16:35:38 +02:00
|
|
|
buildInputs = [ unzip ]
|
|
|
|
|
|
|
|
# For some reason the makefile sets "AR = libtool" on Darwin.
|
2010-07-07 13:44:58 +02:00
|
|
|
++ stdenv.lib.optional (stdenv.system == "i686-darwin") libtool;
|
2008-07-29 16:26:03 +02:00
|
|
|
|
|
|
|
# Unpack the thing in a subdirectory.
|
|
|
|
unpackPhase = ''
|
|
|
|
echo "unpacking Crypto++ to \`${name}' from \`$PWD'..."
|
|
|
|
mkdir "${name}" && (cd "${name}" && unzip "$src")
|
|
|
|
sourceRoot="$PWD/${name}"
|
|
|
|
'';
|
|
|
|
|
2010-07-28 15:03:11 +02:00
|
|
|
cxxflags = if stdenv.isi686 then "-march=i686" else
|
|
|
|
if stdenv.isx86_64 then "-march=nocona" else
|
|
|
|
"";
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
sed -i GNUmakefile \
|
|
|
|
-e 's|-march=native|${cxxflags}|g' \
|
|
|
|
-e 's|-mtune=native||g' \
|
|
|
|
-e '/^CXXFLAGS =/s|-g -O2|-O3|'
|
|
|
|
'';
|
|
|
|
|
2009-08-11 01:50:07 +02:00
|
|
|
# Deal with one of the crappiest build system around there.
|
|
|
|
buildPhase = ''
|
|
|
|
# These guys forgot a file or something.
|
|
|
|
: > modexppc.cpp
|
|
|
|
|
|
|
|
make PREFIX="$out" all cryptopp.dll
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir "$out"
|
|
|
|
make install PREFIX="$out"
|
|
|
|
cp -v cryptopp.dll "$out/lib/libcryptopp.so"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = "make test";
|
2008-07-29 16:26:03 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Crypto++, a free C++ class library of cryptographic schemes";
|
|
|
|
homepage = http://cryptopp.com/;
|
|
|
|
license = "Public Domain";
|
2009-08-11 01:50:07 +02:00
|
|
|
maintainers = [ stdenv.lib.maintainers.ludo ];
|
2008-07-29 16:26:03 +02:00
|
|
|
};
|
2009-08-11 01:50:07 +02:00
|
|
|
}
|