Skip to content
Closed
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
21 changes: 21 additions & 0 deletions pkgs/build-support/setup-hooks/meson-shlibs-to-static.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
preConfigurePhases+=" mesonShlibsToStaticPhase"

mesonShlibsToStaticPhase() {
runHook preMesonShlibsToStatic
replaceMesonFunction() {
foundFiles=$(find . -name "meson.build" -exec grep -El " * *$1 *\(" {} \;)
for mesonFile in $foundFiles
do
echo "$mesonFile";
cp "$mesonFile" "$mesonFile.tmp_file_mesonShlibsToStaticPhase"
sed -i -E "s=( * *)$1( *)\(=\1$2(\2=g" "$mesonFile";
echo -n "[meson-shlibs-to-static] applied patch : "
diff -u "$mesonFile.tmp_file_mesonShlibsToStaticPhase" "$mesonFile" || echo ""
rm -f "$mesonFile.tmp_file_mesonShlibsToStaticPhase"
done
}
replaceMesonFunction "shared_library" "static_library"
replaceMesonFunction "shared_module" "static_library"

runHook postMesonShlibsToStatic
}
29 changes: 16 additions & 13 deletions pkgs/development/libraries/p11-kit/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, which
, gettext, libffi, libiconv, libtasn1
{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, which
, gettext, libffi, libiconv, libtasn1, bash-completion, mesonShlibsToStaticHook
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (rec {
pname = "p11-kit";
version = "0.24.0";

Expand All @@ -21,17 +21,16 @@ stdenv.mkDerivation rec {
# at the same time, libtasn1 in buildInputs provides the libasn1 library
# to link against for the target platform.
# hence, libtasn1 is required in both native and build inputs.
nativeBuildInputs = [ autoreconfHook pkg-config which libtasn1 ];
nativeBuildInputs = [ meson ninja pkg-config which libtasn1 gettext ] ++
lib.optional (stdenv.hostPlatform.isStatic) [ mesonShlibsToStaticHook ];
buildInputs = [ gettext libffi libiconv libtasn1 ];
propagatedBuildInputs = [ bash-completion ];

autoreconfPhase = ''
NOCONFIGURE=1 ./autogen.sh
'';

configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-trust-paths=/etc/ssl/trust-source:/etc/ssl/certs/ca-certificates.crt"
mesonFlags = [
"-Dsystem_config=/etc"
"-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt"
"-Dsystemd=disabled"
"-Dbashcompdir=${placeholder "out"}/share/bash-completion/completions"
];

enableParallelBuilding = true;
Expand Down Expand Up @@ -60,4 +59,8 @@ stdenv.mkDerivation rec {
platforms = platforms.all;
license = licenses.bsd3;
};
}
} // lib.optionalAttrs stdenv.hostPlatform.isStatic {
postPatch = ''
sed -i '/install_data(pkcs11_conf_example/,+1d' p11-kit/meson.build
'';
})
7 changes: 7 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ with pkgs;
../build-support/setup-hooks/autoreconf.sh
) { };

mesonShlibsToStaticHook = callPackage (
{ makeSetupHook }:
makeSetupHook
{ deps = []; }
../build-support/setup-hooks/meson-shlibs-to-static.sh
) { };

autoreconfHook264 = autoreconfHook.override {
autoconf = autoconf264;
automake = automake111x;
Expand Down