From 8eee989a14deb3efaf9a32dc1d0240077669d6e5 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 19 Nov 2024 11:41:31 -0600 Subject: [PATCH 1/2] poppler: format --- .../development/libraries/poppler/default.nix | 179 ++++++++++-------- 1 file changed, 99 insertions(+), 80 deletions(-) diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix index 6ef6aca4b1471..1f47d37241178 100644 --- a/pkgs/development/libraries/poppler/default.nix +++ b/pkgs/development/libraries/poppler/default.nix @@ -1,39 +1,46 @@ -{ lib -, stdenv -, fetchurl -, fetchFromGitLab -, fetchpatch -, cairo -, cmake -, boost -, curl -, fontconfig -, freetype -, lcms -, libiconv -, libintl -, libjpeg -, ninja -, openjpeg -, pkg-config -, python3 -, zlib -, withData ? true, poppler_data -, qt5Support ? false, qt6Support ? false, qtbase ? null -, introspectionSupport ? false, gobject-introspection ? null -, gpgmeSupport ? false, gpgme ? null -, utils ? false, nss ? null -, minimal ? false -, suffix ? "glib" - -# for passthru.tests -, cups-filters -, gdal -, gegl -, inkscape -, pdfslicer -, scribus -, vips +{ + lib, + stdenv, + fetchurl, + fetchFromGitLab, + fetchpatch, + cairo, + cmake, + boost, + curl, + fontconfig, + freetype, + lcms, + libiconv, + libintl, + libjpeg, + ninja, + openjpeg, + pkg-config, + python3, + zlib, + withData ? true, + poppler_data, + qt5Support ? false, + qt6Support ? false, + qtbase ? null, + introspectionSupport ? false, + gobject-introspection ? null, + gpgmeSupport ? false, + gpgme ? null, + utils ? false, + nss ? null, + minimal ? false, + suffix ? "glib", + + # for passthru.tests + cups-filters, + gdal, + gegl, + inkscape, + pdfslicer, + scribus, + vips, }: let @@ -55,7 +62,10 @@ stdenv.mkDerivation (finalAttrs: rec { pname = "poppler-${suffix}"; version = "24.02.0"; # beware: updates often break cups-filters build, check scribus too! - outputs = [ "out" "dev" ]; + outputs = [ + "out" + "dev" + ]; src = fetchurl { url = "https://poppler.freedesktop.org/poppler-${version}.tar.xz"; @@ -86,49 +96,58 @@ stdenv.mkDerivation (finalAttrs: rec { python3 ]; - buildInputs = [ - boost - libiconv - libintl - ] ++ lib.optionals withData [ - poppler_data - ]; + buildInputs = + [ + boost + libiconv + libintl + ] + ++ lib.optionals withData [ + poppler_data + ]; # TODO: reduce propagation to necessary libs - propagatedBuildInputs = [ - zlib - freetype - fontconfig - libjpeg - openjpeg - ] ++ lib.optionals (!minimal) [ - cairo - lcms - curl - nss - ] ++ lib.optionals (qt5Support || qt6Support) [ - qtbase - ] ++ lib.optionals introspectionSupport [ - gobject-introspection - ] ++ lib.optionals gpgmeSupport [ - gpgme - ]; - - cmakeFlags = [ - (mkFlag true "UNSTABLE_API_ABI_HEADERS") # previously "XPDF_HEADERS" - (mkFlag (!minimal) "GLIB") - (mkFlag (!minimal) "CPP") - (mkFlag (!minimal) "LIBCURL") - (mkFlag (!minimal) "LCMS") - (mkFlag (!minimal) "LIBTIFF") - (mkFlag (!minimal) "NSS3") - (mkFlag utils "UTILS") - (mkFlag qt5Support "QT5") - (mkFlag qt6Support "QT6") - (mkFlag gpgmeSupport "GPGME") - ] ++ lib.optionals finalAttrs.finalPackage.doCheck [ - "-DTESTDATADIR=${testData}" - ]; + propagatedBuildInputs = + [ + zlib + freetype + fontconfig + libjpeg + openjpeg + ] + ++ lib.optionals (!minimal) [ + cairo + lcms + curl + nss + ] + ++ lib.optionals (qt5Support || qt6Support) [ + qtbase + ] + ++ lib.optionals introspectionSupport [ + gobject-introspection + ] + ++ lib.optionals gpgmeSupport [ + gpgme + ]; + + cmakeFlags = + [ + (mkFlag true "UNSTABLE_API_ABI_HEADERS") # previously "XPDF_HEADERS" + (mkFlag (!minimal) "GLIB") + (mkFlag (!minimal) "CPP") + (mkFlag (!minimal) "LIBCURL") + (mkFlag (!minimal) "LCMS") + (mkFlag (!minimal) "LIBTIFF") + (mkFlag (!minimal) "NSS3") + (mkFlag utils "UTILS") + (mkFlag qt5Support "QT5") + (mkFlag qt6Support "QT6") + (mkFlag gpgmeSupport "GPGME") + ] + ++ lib.optionals finalAttrs.finalPackage.doCheck [ + "-DTESTDATADIR=${testData}" + ]; disallowedReferences = lib.optional finalAttrs.finalPackage.doCheck testData; dontWrapQtApps = true; @@ -159,13 +178,13 @@ stdenv.mkDerivation (finalAttrs: rec { cups-filters inkscape scribus - ; + ; inherit gegl pdfslicer vips - ; + ; gdal = gdal.override { usePoppler = true; }; python-poppler-qt5 = python3.pkgs.poppler-qt5; }; From c972c7432f8d18c9f1e5f6b52d2724c99e6d05a9 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 19 Nov 2024 11:44:40 -0600 Subject: [PATCH 2/2] poppler: add dependency for glib-mkenums to fix cross building --- pkgs/development/libraries/poppler/default.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix index 1f47d37241178..160206196d645 100644 --- a/pkgs/development/libraries/poppler/default.nix +++ b/pkgs/development/libraries/poppler/default.nix @@ -10,6 +10,7 @@ curl, fontconfig, freetype, + glib, lcms, libiconv, libintl, @@ -94,6 +95,8 @@ stdenv.mkDerivation (finalAttrs: rec { ninja pkg-config python3 + ] ++ lib.optionals (!minimal) [ + glib # for glib-mkenums ]; buildInputs = @@ -190,7 +193,7 @@ stdenv.mkDerivation (finalAttrs: rec { }; }; - meta = with lib; { + meta = { homepage = "https://poppler.freedesktop.org/"; changelog = "https://gitlab.freedesktop.org/poppler/poppler/-/blob/poppler-${version}/NEWS"; description = "PDF rendering library"; @@ -198,8 +201,8 @@ stdenv.mkDerivation (finalAttrs: rec { Poppler is a PDF rendering library based on the xpdf-3.0 code base. In addition it provides a number of tools that can be installed separately. ''; - license = licenses.gpl2Plus; - platforms = platforms.all; - maintainers = with maintainers; [ ttuegel ] ++ teams.freedesktop.members; + license = with lib.licenses; [ gpl2Plus ]; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ ttuegel ] ++ lib.teams.freedesktop.members; }; })