openssl: Clean up the cross compile arguments
Also add a check to make sure we don't depend on perl in the output
This commit is contained in:
parent
c49301b2f7
commit
507bb016cc
@ -1,22 +1,14 @@
|
|||||||
{ stdenv, fetchurl, perl
|
{ stdenv, fetchurl, perl
|
||||||
, withCryptodev ? false, cryptodevHeaders }:
|
, withCryptodev ? false, cryptodevHeaders }:
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
let
|
let
|
||||||
name = "openssl-1.0.1o";
|
opensslCrossSystem = attrByPath [ "openssl" "system" ]
|
||||||
|
|
||||||
opensslCrossSystem = stdenv.lib.attrByPath [ "openssl" "system" ]
|
|
||||||
(throw "openssl needs its platform name cross building" null)
|
(throw "openssl needs its platform name cross building" null)
|
||||||
stdenv.cross;
|
stdenv.cross;
|
||||||
|
|
||||||
patchesCross = isCross: let
|
|
||||||
isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
|
|
||||||
in stdenv.lib.optional isDarwin ./darwin-arch.patch;
|
|
||||||
|
|
||||||
extraPatches = stdenv.lib.optional stdenv.isCygwin ./1.0.1-cygwin64.patch;
|
|
||||||
in
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
stdenv.mkDerivation {
|
name = "openssl-1.0.1o";
|
||||||
inherit name;
|
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
urls = [
|
urls = [
|
||||||
@ -26,11 +18,11 @@ stdenv.mkDerivation {
|
|||||||
sha1 = "b003e3382607ef2c6d85b51e4ed7a4c0a76b8d5a";
|
sha1 = "b003e3382607ef2c6d85b51e4ed7a4c0a76b8d5a";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = (patchesCross false) ++ extraPatches;
|
patches = optional stdenv.isCygwin ./1.0.1-cygwin64.patch
|
||||||
|
++ optional (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")) ./darwin-arch.patch;
|
||||||
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ perl ];
|
nativeBuildInputs = [ perl ];
|
||||||
|
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
|
||||||
|
|
||||||
# On x86_64-darwin, "./config" misdetects the system as
|
# On x86_64-darwin, "./config" misdetects the system as
|
||||||
# "darwin-i386-cc". So specify the system type explicitly.
|
# "darwin-i386-cc". So specify the system type explicitly.
|
||||||
@ -39,45 +31,48 @@ stdenv.mkDerivation {
|
|||||||
else if stdenv.system == "x86_64-solaris" then "./Configure solaris64-x86_64-gcc"
|
else if stdenv.system == "x86_64-solaris" then "./Configure solaris64-x86_64-gcc"
|
||||||
else "./config";
|
else "./config";
|
||||||
|
|
||||||
configureFlags = "shared --libdir=lib --openssldir=etc/ssl" +
|
configureFlags = [
|
||||||
stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS";
|
"shared"
|
||||||
|
"--libdir=lib"
|
||||||
|
"--openssldir=etc/ssl"
|
||||||
|
] ++ stdenv.lib.optionals withCryptodev [
|
||||||
|
"-DHAVE_CRYPTODEV"
|
||||||
|
"-DUSE_CRYPTODEV_DIGESTS"
|
||||||
|
];
|
||||||
|
|
||||||
makeFlags = "MANDIR=$(out)/share/man";
|
makeFlags = [
|
||||||
|
"MANDIR=$(out)/share/man"
|
||||||
|
];
|
||||||
|
|
||||||
# Parallel building is broken in OpenSSL.
|
# Parallel building is broken in OpenSSL.
|
||||||
enableParallelBuilding = false;
|
enableParallelBuilding = false;
|
||||||
|
|
||||||
postInstall =
|
postInstall = ''
|
||||||
''
|
|
||||||
# If we're building dynamic libraries, then don't install static
|
# If we're building dynamic libraries, then don't install static
|
||||||
# libraries.
|
# libraries.
|
||||||
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib)" ]; then
|
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
|
||||||
rm "$out/lib/"*.a
|
rm "$out/lib/"*.a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove dependency on Perl at runtime
|
# remove dependency on Perl at runtime
|
||||||
rm -rf $out/etc/ssl/misc
|
rm -r $out/etc/ssl/misc $out/bin/c_rehash
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
# Check to make sure we don't depend on perl
|
||||||
|
if grep -r '${perl}' $out; then
|
||||||
|
echo "Found an erroneous dependency on perl ^^^" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
patches = patchesCross true;
|
|
||||||
|
|
||||||
preConfigure=''
|
preConfigure=''
|
||||||
# It's configure does not like --build or --host
|
# It's configure does not like --build or --host
|
||||||
export configureFlags="--libdir=lib --cross-compile-prefix=${stdenv.cross.config}- shared ${opensslCrossSystem}"
|
export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
# Openssl installs readonly files, which otherwise we can't strip.
|
|
||||||
# This could at some stdenv hash change be put out of crossAttrs, too
|
|
||||||
chmod -R +w $out
|
|
||||||
|
|
||||||
# Remove references to perl, to avoid depending on it at runtime
|
|
||||||
rm $out/bin/c_rehash $out/ssl/misc/CA.pl $out/ssl/misc/tsget
|
|
||||||
'';
|
|
||||||
configureScript = "./Configure";
|
configureScript = "./Configure";
|
||||||
} // stdenv.lib.optionalAttrs (opensslCrossSystem == "darwin64-x86_64-cc") {
|
|
||||||
CC = "gcc";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
Loading…
Reference in New Issue
Block a user