From bfb36913f1527dae20d8270209ceecea01486eba Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 11 Jul 2024 17:37:22 -0400 Subject: [PATCH 1/4] qpdf: add meta.mainProgram --- pkgs/development/libraries/qpdf/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix index b2858944ef7c6..d2d739cb7a7ca 100644 --- a/pkgs/development/libraries/qpdf/default.nix +++ b/pkgs/development/libraries/qpdf/default.nix @@ -51,6 +51,7 @@ stdenv.mkDerivation rec { description = "C++ library and set of programs that inspect and manipulate the structure of PDF files"; license = licenses.asl20; # as of 7.0.0, people may stay at artistic2 maintainers = with maintainers; [ abbradar ]; + mainProgram = "qpdf"; platforms = platforms.all; changelog = "https://github.com/qpdf/qpdf/blob/v${version}/ChangeLog"; }; From 186e0e75ed098f94ac03661ea0c6456d0cf88c8e Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 11 Jul 2024 17:50:17 -0400 Subject: [PATCH 2/4] qpdf: split outputs --- pkgs/development/libraries/qpdf/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix index d2d739cb7a7ca..942285148ea61 100644 --- a/pkgs/development/libraries/qpdf/default.nix +++ b/pkgs/development/libraries/qpdf/default.nix @@ -24,6 +24,14 @@ stdenv.mkDerivation rec { hash = "sha256-DhrOKjUPgNo61db8av0OTfM8mCNebQocQWtTWdt002s="; }; + outputs = [ + "bin" + "doc" + "lib" + "man" + "out" + ]; + nativeBuildInputs = [ cmake perl ]; buildInputs = [ zlib libjpeg ]; From a2fc17f77befefc545386e2a44d5434956e5705a Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 11 Jul 2024 17:52:39 -0400 Subject: [PATCH 3/4] qpdf: add pkg-config & version tests --- pkgs/development/libraries/qpdf/default.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix index 942285148ea61..d5a5ed0ccd231 100644 --- a/pkgs/development/libraries/qpdf/default.nix +++ b/pkgs/development/libraries/qpdf/default.nix @@ -11,16 +11,18 @@ , pdfmixtool , pdfslicer , python3 +, testers +, versionCheckHook }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "qpdf"; version = "11.9.1"; src = fetchFromGitHub { owner = "qpdf"; repo = "qpdf"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-DhrOKjUPgNo61db8av0OTfM8mCNebQocQWtTWdt002s="; }; @@ -36,6 +38,9 @@ stdenv.mkDerivation rec { buildInputs = [ zlib libjpeg ]; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + preConfigure = '' patchShebangs qtest/bin/qtest-driver patchShebangs run-qtest @@ -46,6 +51,7 @@ stdenv.mkDerivation rec { doCheck = true; passthru.tests = { + pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; inherit (python3.pkgs) pikepdf; inherit cups-filters @@ -61,6 +67,7 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ abbradar ]; mainProgram = "qpdf"; platforms = platforms.all; - changelog = "https://github.com/qpdf/qpdf/blob/v${version}/ChangeLog"; + changelog = "https://github.com/qpdf/qpdf/blob/v${finalAttrs.version}/ChangeLog"; + pkgConfigModules = [ "libqpdf" ]; }; -} +}) From f9330b606583879b5b4cda6b3f79d734718f7a57 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 11 Jul 2024 17:53:13 -0400 Subject: [PATCH 4/4] qpdf: don't overuse `with lib;` https://github.com/NixOS/nixpkgs/issues/208242 --- pkgs/development/libraries/qpdf/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix index d5a5ed0ccd231..4a9e520f2a979 100644 --- a/pkgs/development/libraries/qpdf/default.nix +++ b/pkgs/development/libraries/qpdf/default.nix @@ -60,13 +60,13 @@ stdenv.mkDerivation (finalAttrs: { ; }; - meta = with lib; { + meta = { homepage = "https://qpdf.sourceforge.io/"; description = "C++ library and set of programs that inspect and manipulate the structure of PDF files"; - license = licenses.asl20; # as of 7.0.0, people may stay at artistic2 - maintainers = with maintainers; [ abbradar ]; + license = lib.licenses.asl20; # as of 7.0.0, people may stay at artistic2 + maintainers = with lib.maintainers; [ abbradar ]; mainProgram = "qpdf"; - platforms = platforms.all; + platforms = lib.platforms.all; changelog = "https://github.com/qpdf/qpdf/blob/v${finalAttrs.version}/ChangeLog"; pkgConfigModules = [ "libqpdf" ]; };