2024-05-23 11:43:35 +00:00
|
|
|
{ lib, stdenv, fetchurl, gtk-doc, meson, ninja, pkg-config, python3
|
2023-09-25 18:06:09 +00:00
|
|
|
, docbook_xsl, fontconfig, freetype, libpng, pixman, zlib
|
|
|
|
, x11Support? !stdenv.hostPlatform.isDarwin || true, libXext, libXrender
|
2011-09-20 06:22:14 +00:00
|
|
|
, gobjectSupport ? true, glib
|
2023-09-25 18:06:09 +00:00
|
|
|
, xcbSupport ? x11Support, libxcb
|
2016-03-29 16:04:46 +00:00
|
|
|
, darwin
|
2023-02-07 14:25:27 +00:00
|
|
|
, testers
|
2005-10-12 14:00:20 +00:00
|
|
|
}:
|
|
|
|
|
2018-04-06 16:59:30 +00:00
|
|
|
let
|
2021-01-21 17:00:13 +00:00
|
|
|
inherit (lib) optional optionals;
|
2023-02-07 14:25:27 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: let
|
|
|
|
inherit (finalAttrs) pname version;
|
|
|
|
in {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "cairo";
|
2024-09-03 20:39:42 +00:00
|
|
|
version = "1.18.2";
|
2012-08-27 02:53:19 +00:00
|
|
|
|
2005-10-12 14:00:20 +00:00
|
|
|
src = fetchurl {
|
2021-01-23 17:15:07 +00:00
|
|
|
url = "https://cairographics.org/${if lib.mod (builtins.fromJSON (lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${pname}-${version}.tar.xz";
|
2024-09-03 20:39:42 +00:00
|
|
|
hash = "sha256-piubtCQl6ETMPW3d4EP/Odur7dFULrpXout5+FiJ1Fo=";
|
2005-10-12 14:00:20 +00:00
|
|
|
};
|
2008-03-07 15:43:43 +00:00
|
|
|
|
2016-09-01 09:07:23 +00:00
|
|
|
outputs = [ "out" "dev" "devdoc" ];
|
2015-10-28 18:38:17 +00:00
|
|
|
outputBin = "dev"; # very small
|
2021-09-09 18:14:31 +00:00
|
|
|
separateDebugInfo = true;
|
2012-08-27 02:53:19 +00:00
|
|
|
|
2016-03-29 16:04:46 +00:00
|
|
|
nativeBuildInputs = [
|
2023-09-25 18:06:09 +00:00
|
|
|
gtk-doc
|
|
|
|
meson
|
|
|
|
ninja
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2023-09-25 18:06:09 +00:00
|
|
|
python3
|
2019-03-02 07:17:21 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-09-25 18:06:09 +00:00
|
|
|
docbook_xsl
|
2018-03-14 19:15:06 +00:00
|
|
|
] ++ optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
2016-03-29 16:04:46 +00:00
|
|
|
CoreGraphics
|
2016-12-23 21:10:06 +00:00
|
|
|
CoreText
|
2017-01-09 19:58:16 +00:00
|
|
|
ApplicationServices
|
2016-03-29 16:04:46 +00:00
|
|
|
Carbon
|
|
|
|
]);
|
2008-10-14 12:08:07 +00:00
|
|
|
|
2023-09-25 18:06:09 +00:00
|
|
|
propagatedBuildInputs = [ fontconfig freetype pixman libpng zlib ]
|
2019-04-16 20:56:48 +00:00
|
|
|
++ optionals x11Support [ libXext libXrender ]
|
2023-09-25 18:06:09 +00:00
|
|
|
++ optionals xcbSupport [ libxcb ]
|
2013-05-30 12:43:26 +00:00
|
|
|
++ optional gobjectSupport glib
|
2015-10-06 17:57:45 +00:00
|
|
|
; # TODO: maybe liblzo but what would it be for here?
|
2013-05-30 12:43:26 +00:00
|
|
|
|
2023-09-25 18:06:09 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dgtk_doc=true"
|
|
|
|
|
|
|
|
# error: #error config.h must be included before this header
|
|
|
|
"-Dsymbol-lookup=disabled"
|
|
|
|
|
|
|
|
# Only used in tests, causes a dependency cycle
|
|
|
|
"-Dspectre=disabled"
|
|
|
|
|
|
|
|
(lib.mesonEnable "glib" gobjectSupport)
|
2023-11-30 17:50:59 +00:00
|
|
|
(lib.mesonEnable "tests" finalAttrs.finalPackage.doCheck)
|
2023-09-25 18:06:09 +00:00
|
|
|
(lib.mesonEnable "xlib" x11Support)
|
|
|
|
(lib.mesonEnable "xcb" xcbSupport)
|
2023-10-25 19:50:44 +00:00
|
|
|
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
|
|
|
"--cross-file=${builtins.toFile "cross-file.conf" ''
|
|
|
|
[properties]
|
|
|
|
ipc_rmid_deferred_release = ${
|
|
|
|
{
|
|
|
|
linux = "true";
|
|
|
|
freebsd = "true";
|
|
|
|
netbsd = "false";
|
|
|
|
}.${stdenv.hostPlatform.parsed.kernel.name} or
|
|
|
|
(throw "Unknown value for ipc_rmid_deferred_release")
|
|
|
|
}
|
|
|
|
''}"
|
2023-09-25 18:06:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs version.py
|
|
|
|
'';
|
2009-01-25 11:50:29 +00:00
|
|
|
|
2012-05-16 20:49:31 +00:00
|
|
|
enableParallelBuilding = true;
|
2009-01-25 11:50:29 +00:00
|
|
|
|
2018-04-25 03:20:18 +00:00
|
|
|
doCheck = false; # fails
|
|
|
|
|
2023-09-25 18:06:09 +00:00
|
|
|
postInstall = ''
|
|
|
|
# Work around broken `Requires.private' that prevents Freetype
|
|
|
|
# `-I' flags to be propagated.
|
|
|
|
sed -i "$out/lib/pkgconfig/cairo.pc" \
|
|
|
|
-es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype.dev}/include/freetype2 -I${freetype.dev}/include|g'
|
2024-10-14 08:37:52 +00:00
|
|
|
'';
|
2011-02-08 17:57:00 +00:00
|
|
|
|
2023-02-07 14:25:27 +00:00
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2008-03-07 15:43:43 +00:00
|
|
|
description = "2D graphics library with support for multiple output devices";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "cairo-trace";
|
2009-01-24 21:32:25 +00:00
|
|
|
longDescription = ''
|
|
|
|
Cairo is a 2D graphics library with support for multiple output
|
|
|
|
devices. Currently supported output targets include the X
|
2023-09-25 18:06:09 +00:00
|
|
|
Window System, XCB, Quartz, Win32, image buffers, PostScript,
|
|
|
|
PDF, and SVG file output.
|
2009-01-24 21:32:25 +00:00
|
|
|
|
|
|
|
Cairo is designed to produce consistent output on all output
|
|
|
|
media while taking advantage of display hardware acceleration
|
|
|
|
when available (e.g., through the X Render Extension).
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://cairographics.org/";
|
2015-05-27 19:56:04 +00:00
|
|
|
license = with licenses; [ lgpl2Plus mpl10 ];
|
2023-02-07 14:25:27 +00:00
|
|
|
pkgConfigModules = [
|
2023-09-25 18:06:09 +00:00
|
|
|
"cairo-pdf"
|
2023-02-07 14:25:27 +00:00
|
|
|
"cairo-ps"
|
|
|
|
"cairo-svg"
|
2023-09-25 18:06:09 +00:00
|
|
|
] ++ lib.optional gobjectSupport "cairo-gobject";
|
2015-05-27 19:56:04 +00:00
|
|
|
platforms = platforms.all;
|
2008-03-07 15:43:43 +00:00
|
|
|
};
|
2023-02-07 14:25:27 +00:00
|
|
|
})
|