at v192 87 lines 2.5 kB view raw
1{ stdenv, fetchurl, perl 2, withCryptodev ? false, cryptodevHeaders }: 3 4with stdenv.lib; 5let 6 opensslCrossSystem = attrByPath [ "openssl" "system" ] 7 (throw "openssl needs its platform name cross building" null) 8 stdenv.cross; 9in 10stdenv.mkDerivation rec { 11 name = "openssl-1.0.1p"; 12 13 src = fetchurl { 14 urls = [ 15 "http://www.openssl.org/source/${name}.tar.gz" 16 "http://openssl.linux-mirror.org/source/${name}.tar.gz" 17 ]; 18 sha1 = "9d1977cc89242cd11471269ece2ed4650947c046"; 19 }; 20 21 outputs = [ "out" "man" ]; 22 23 patches = optional stdenv.isCygwin ./1.0.1-cygwin64.patch 24 ++ optional (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")) ./darwin-arch.patch; 25 26 nativeBuildInputs = [ perl ]; 27 buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders; 28 29 # On x86_64-darwin, "./config" misdetects the system as 30 # "darwin-i386-cc". So specify the system type explicitly. 31 configureScript = 32 if stdenv.system == "x86_64-darwin" then "./Configure darwin64-x86_64-cc" 33 else if stdenv.system == "x86_64-solaris" then "./Configure solaris64-x86_64-gcc" 34 else "./config"; 35 36 configureFlags = [ 37 "shared" 38 "--libdir=lib" 39 "--openssldir=etc/ssl" 40 ] ++ stdenv.lib.optionals withCryptodev [ 41 "-DHAVE_CRYPTODEV" 42 "-DUSE_CRYPTODEV_DIGESTS" 43 ]; 44 45 makeFlags = [ 46 "MANDIR=$(out)/share/man" 47 ]; 48 49 # Parallel building is broken in OpenSSL. 50 enableParallelBuilding = false; 51 52 postInstall = '' 53 # If we're building dynamic libraries, then don't install static 54 # libraries. 55 if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then 56 rm "$out/lib/"*.a 57 fi 58 59 # remove dependency on Perl at runtime 60 rm -r $out/etc/ssl/misc $out/bin/c_rehash 61 ''; 62 63 postFixup = '' 64 # Check to make sure we don't depend on perl 65 if grep -r '${perl}' $out; then 66 echo "Found an erroneous dependency on perl ^^^" >&2 67 exit 1 68 fi 69 ''; 70 71 crossAttrs = { 72 preConfigure='' 73 # It's configure does not like --build or --host 74 export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}" 75 ''; 76 77 configureScript = "./Configure"; 78 }; 79 80 meta = { 81 homepage = http://www.openssl.org/; 82 description = "A cryptographic library that implements the SSL and TLS protocols"; 83 platforms = stdenv.lib.platforms.all; 84 maintainers = [ stdenv.lib.maintainers.simons ]; 85 priority = 10; # resolves collision with ‘man-pages’ 86 }; 87}