openssl: Add static flag.

Its effect on `postInstall` is carefully written to not
cause recompilation in the default case.
This commit is contained in:
Niklas Hambüchen 2018-07-21 04:41:01 +02:00
parent bc6cfb4750
commit 479dcc3b54

@ -3,6 +3,7 @@
, fetchpatch , fetchpatch
, withCryptodev ? false, cryptodevHeaders , withCryptodev ? false, cryptodevHeaders
, enableSSL2 ? false , enableSSL2 ? false
, static ? false
}: }:
with stdenv.lib; with stdenv.lib;
@ -62,7 +63,7 @@ let
''; '';
configureFlags = [ configureFlags = [
"shared" "shared" # "shared" builds both shared and static libraries
"--libdir=lib" "--libdir=lib"
"--openssldir=etc/ssl" "--openssldir=etc/ssl"
] ++ stdenv.lib.optionals withCryptodev [ ] ++ stdenv.lib.optionals withCryptodev [
@ -75,13 +76,16 @@ let
enableParallelBuilding = true; enableParallelBuilding = true;
postInstall = '' postInstall =
stdenv.lib.optionalString (!static) ''
# 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 $out/lib/*.dll)" ]; then if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
rm "$out/lib/"*.a rm "$out/lib/"*.a
fi fi
'' +
''
mkdir -p $bin mkdir -p $bin
mv $out/bin $bin/ mv $out/bin $bin/