about summary refs log tree commit diff
path: root/pkgs/development/libraries/p11-kit
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2023-07-21 16:39:01 +0800
committerNick Cao <nickcao@nichi.co>2023-07-22 20:25:34 +0800
commit3ca33e5ef4f8c3e24013905cf741330c9ace3a6c (patch)
tree3b44b1716426e635baa0a3ef421ac2d84a45cf6a /pkgs/development/libraries/p11-kit
parent6689e744eac8ce5126b5f5fbdbac511ceaf23f09 (diff)
p11-kit: build with meson
Diffstat (limited to 'pkgs/development/libraries/p11-kit')
-rw-r--r--pkgs/development/libraries/p11-kit/default.nix85
1 files changed, 33 insertions, 52 deletions
diff --git a/pkgs/development/libraries/p11-kit/default.nix b/pkgs/development/libraries/p11-kit/default.nix
index 7f545958e71bb..11499231007f2 100644
--- a/pkgs/development/libraries/p11-kit/default.nix
+++ b/pkgs/development/libraries/p11-kit/default.nix
@@ -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 {
@@ -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"
-    "--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; {