2009-09-16 15:35:38 +01:00
|
|
|
{ fetchurl, stdenv, unzip, libtool }:
|
2008-07-29 15:26:03 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2009-08-11 00:50:07 +01:00
|
|
|
name = "crypto++-5.6.0";
|
2008-07-29 15:26:03 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2009-08-11 00:50:07 +01:00
|
|
|
url = "mirror://sourceforge/cryptopp/cryptopp560.zip";
|
|
|
|
sha256 = "1icbk50mr1sqycqbxbqg703m8aamz23ajgl22ychxdahz2sz08mm";
|
2008-07-29 15:26:03 +01:00
|
|
|
};
|
|
|
|
|
2009-08-11 00:50:07 +01:00
|
|
|
patches = [ ./pic.patch ]
|
2010-07-07 12:44:58 +01:00
|
|
|
++ stdenv.lib.optional (stdenv.system != "i686-cygwin") ./dll.patch;
|
2009-08-11 00:50:07 +01:00
|
|
|
|
|
|
|
|
2009-09-16 15:35:38 +01:00
|
|
|
buildInputs = [ unzip ]
|
|
|
|
|
|
|
|
# For some reason the makefile sets "AR = libtool" on Darwin.
|
2010-07-07 12:44:58 +01:00
|
|
|
++ stdenv.lib.optional (stdenv.system == "i686-darwin") libtool;
|
2008-07-29 15:26:03 +01: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 14:03:11 +01: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 00:50:07 +01: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
|
|
|
|
'';
|
|
|
|
|
2010-07-28 14:08:49 +01:00
|
|
|
# TODO: Installing cryptotest.exe doesn't seem to be necessary. We run
|
|
|
|
# that binary during this build anyway to verify everything works.
|
2009-08-11 00:50:07 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir "$out"
|
|
|
|
make install PREFIX="$out"
|
|
|
|
cp -v cryptopp.dll "$out/lib/libcryptopp.so"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = "make test";
|
2008-07-29 15:26:03 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Crypto++, a free C++ class library of cryptographic schemes";
|
|
|
|
homepage = http://cryptopp.com/;
|
|
|
|
license = "Public Domain";
|
2009-08-11 00:50:07 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.ludo ];
|
2008-07-29 15:26:03 +01:00
|
|
|
};
|
2009-08-11 00:50:07 +01:00
|
|
|
}
|