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

poppler: format, add dependency for glib-mkenums to fix cross building #357344

Merged
merged 2 commits into from
Nov 28, 2024
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
190 changes: 106 additions & 84 deletions pkgs/development/libraries/poppler/default.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
{ 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,
glib,
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
Expand All @@ -55,7 +63,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";
Expand Down Expand Up @@ -84,51 +95,62 @@ stdenv.mkDerivation (finalAttrs: rec {
ninja
pkg-config
python3
] ++ lib.optionals (!minimal) [
glib # for glib-mkenums
];

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;
Expand Down Expand Up @@ -159,28 +181,28 @@ stdenv.mkDerivation (finalAttrs: rec {
cups-filters
inkscape
scribus
;
;

inherit
gegl
pdfslicer
vips
;
;
gdal = gdal.override { usePoppler = true; };
python-poppler-qt5 = python3.pkgs.poppler-qt5;
};
};

meta = with lib; {
meta = {
homepage = "https://poppler.freedesktop.org/";
changelog = "https://gitlab.freedesktop.org/poppler/poppler/-/blob/poppler-${version}/NEWS";
description = "PDF rendering library";
longDescription = ''
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;
};
})