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

p11-kit: build with meson #244633

Merged
merged 1 commit into from
Jul 23, 2023
Merged
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
85 changes: 33 additions & 52 deletions pkgs/development/libraries/p11-kit/default.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p11_system_config_modules in pkg-config file changed $out/share/p11-kit/modules /etc/pkcs11/modules, not sure if it is an issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$out/share/p11-kit/modules seems empty, I assume /etc/pkcs11/modules might be the intended path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable is reference in meson.build of gcr, but still not used else where https://github.com/GNOME/gcr/blob/c8d2e0f44bdb91b63ed04dedf7b272211dc46c6e/meson.build#L56

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, docbook-xsl-nons
, gtk-doc
, installShellFiles
, libxslt # for xsltproc
, meson
, ninja
, pkg-config
, which
, libtasn1
, libxslt
, docbook-xsl-nons
, docbook_xml_dtd_43
, gettext
, libffi
, libiconv
, libintl
, libtasn1
}:

stdenv.mkDerivation rec {
Expand All @@ -25,65 +24,47 @@ stdenv.mkDerivation rec {
hash = "sha256-paLiRYgYshuedgDgW2nEsv4/Loq6qFyQMjfBJwqtHzw=";
};

outputs = [ "out" "bin" "dev"];
outputs = [ "out" "bin" "dev" ];

strictDeps = true;

# For cross platform builds of p11-kit, libtasn1 in nativeBuildInputs
# provides the asn1Parser binary on the hostPlatform needed for building.
# 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
docbook-xsl-nons
gtk-doc
installShellFiles
libtasn1
libxslt.bin
meson
ninja
pkg-config
which
libtasn1 # asn1Parser
libxslt # xsltproc
docbook-xsl-nons
docbook_xml_dtd_43
gettext
];

buildInputs = [
libffi
libiconv
libintl
libtasn1
libintl
];

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

configureFlags = [
"--enable-doc"
mesonFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be passed the same way to mesonFlags but it does not look like it is used. The only reference I found with git log -G is hardcoded in https://github.com/p11-glue/p11-kit/blob/d98392beb309570c228090866d77e500bc9e30db/common/runtime.c#L51

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The p11_get_runtime_directory function and in turn the whole codebase contains no reference to localstatedir, I'm pretty sure it's unused.

"--with-trust-paths=${lib.concatStringsSep ":" [
"/etc/ssl/trust-source" # p11-kit trust source
"/etc/ssl/certs/ca-certificates.crt" # NixOS + Debian/Ubuntu/Arch/Gentoo...
"/etc/pki/tls/certs/ca-bundle.crt" # Fedora/CentOS
(lib.mesonBool "man" true)
(lib.mesonEnable "systemd" false)
(lib.mesonOption "bashcompdir" "${placeholder "bin"}/share/bash-completion/completions")
(lib.mesonOption "trust_paths" (lib.concatStringsSep ":" [
"/etc/ssl/trust-source" # p11-kit trust source
"/etc/ssl/certs/ca-certificates.crt" # NixOS + Debian/Ubuntu/Arch/Gentoo...
"/etc/pki/tls/certs/ca-bundle.crt" # Fedora/CentOS
"/var/lib/ca-certificates/ca-bundle.pem" # openSUSE
"/etc/ssl/cert.pem" # Darwin/macOS
]}"
"/etc/ssl/cert.pem" # Darwin/macOS
]))
];

enableParallelBuilding = true;

# Tests run in fakeroot for non-root users
preCheck = ''
if [ "$(id -u)" != "0" ]; then
export FAKED_MODE=1
fi
'';

doCheck = !stdenv.isDarwin;

installFlags = [
"exampledir=${placeholder "out"}/etc/pkcs11"
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

postInstall = ''
installShellCompletion --bash bash-completion/{p11-kit,trust}
postPatch = ''
# Install sample config files to $out/etc even though they will be loaded from /etc.
substituteInPlace p11-kit/meson.build \
--replace 'install_dir: prefix / p11_system_config' "install_dir: '$out/etc/pkcs11'"
'';

meta = with lib; {
Expand Down