Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional static libraries for krb5 and openssl #43870

Merged
merged 2 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkgs/development/libraries/kerberos/krb5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Extra Arguments
, type ? ""
# This is called "staticOnly" because krb5 does not support
# builting both static and shared, see below.
, staticOnly ? false
}:

let
Expand All @@ -22,6 +25,9 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];

configureFlags = [ "--with-tcl=no" "--localstatedir=/var/lib"]
# krb5's ./configure does not allow passing --enable-shared and --enable-static at the same time.
# See https://bbs.archlinux.org/viewtopic.php?pid=1576737#p1576737
++ optional staticOnly [ "--enable-static" "--disable-shared" ]
++ optional stdenv.isFreeBSD ''WARN_CFLAGS=""''
++ optionals (stdenv.buildPlatform != stdenv.hostPlatform)
[ "krb5_cv_attr_constructor_destructor=yes,yes"
Expand Down
8 changes: 6 additions & 2 deletions pkgs/development/libraries/openssl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, fetchpatch
, withCryptodev ? false, cryptodevHeaders
, enableSSL2 ? false
, static ? false
}:

with stdenv.lib;
Expand Down Expand Up @@ -62,7 +63,7 @@ let
'';

configureFlags = [
"shared"
"shared" # "shared" builds both shared and static libraries
"--libdir=lib"
"--openssldir=etc/ssl"
] ++ stdenv.lib.optionals withCryptodev [
Expand All @@ -75,13 +76,16 @@ let

enableParallelBuilding = true;

postInstall = ''
postInstall =
stdenv.lib.optionalString (!static) ''
# If we're building dynamic libraries, then don't install static
# libraries.
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
rm "$out/lib/"*.a
fi

'' +
''
mkdir -p $bin
mv $out/bin $bin/

Expand Down