Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 lzo, 6 gtk-doc, 7 meson, 8 ninja, 9 pkg-config, 10 python3, 11 docbook_xsl, 12 fontconfig, 13 freetype, 14 libpng, 15 pixman, 16 zlib, 17 x11Support ? !stdenv.hostPlatform.isDarwin || true, 18 libXext, 19 libXrender, 20 gobjectSupport ? true, 21 glib, 22 xcbSupport ? x11Support, 23 libxcb, 24 testers, 25}: 26 27let 28 inherit (lib) optional optionals; 29in 30stdenv.mkDerivation ( 31 finalAttrs: 32 let 33 inherit (finalAttrs) pname version; 34 in 35 { 36 pname = "cairo"; 37 version = "1.18.4"; 38 39 src = fetchurl { 40 url = "https://cairographics.org/${ 41 if lib.mod (builtins.fromJSON (lib.versions.minor version)) 2 == 0 then "releases" else "snapshots" 42 }/${pname}-${version}.tar.xz"; 43 hash = "sha256-RF7YIIpuSCPeEianTKMZ02AOg/Y2n5mxQmUAZZnDLMs="; 44 }; 45 46 outputs = [ 47 "out" 48 "dev" 49 "devdoc" 50 ]; 51 outputBin = "dev"; # very small 52 separateDebugInfo = true; 53 54 nativeBuildInputs = [ 55 gtk-doc 56 meson 57 ninja 58 pkg-config 59 python3 60 ]; 61 62 buildInputs = [ 63 docbook_xsl 64 lzo 65 ]; 66 67 propagatedBuildInputs = [ 68 fontconfig 69 freetype 70 pixman 71 libpng 72 zlib 73 ] 74 ++ optionals x11Support [ 75 libXext 76 libXrender 77 ] 78 ++ optionals xcbSupport [ libxcb ] 79 ++ optional gobjectSupport glib; # TODO: maybe liblzo but what would it be for here? 80 81 mesonFlags = [ 82 "-Dgtk_doc=true" 83 84 # error: #error config.h must be included before this header 85 "-Dsymbol-lookup=disabled" 86 87 # Only used in tests, causes a dependency cycle 88 "-Dspectre=disabled" 89 90 (lib.mesonEnable "glib" gobjectSupport) 91 (lib.mesonEnable "tests" finalAttrs.finalPackage.doCheck) 92 (lib.mesonEnable "xlib" x11Support) 93 (lib.mesonEnable "xcb" xcbSupport) 94 ] 95 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 96 "--cross-file=${builtins.toFile "cross-file.conf" '' 97 [properties] 98 ipc_rmid_deferred_release = ${ 99 { 100 linux = "true"; 101 freebsd = "true"; 102 netbsd = "false"; 103 } 104 .${stdenv.hostPlatform.parsed.kernel.name} or (throw "Unknown value for ipc_rmid_deferred_release") 105 } 106 ''}" 107 ]; 108 109 preConfigure = '' 110 patchShebangs version.py 111 ''; 112 113 enableParallelBuilding = true; 114 115 doCheck = false; # fails 116 117 postInstall = '' 118 # Work around broken `Requires.private' that prevents Freetype 119 # `-I' flags to be propagated. 120 sed -i "$out/lib/pkgconfig/cairo.pc" \ 121 -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype.dev}/include/freetype2 -I${freetype.dev}/include|g' 122 ''; 123 124 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 125 126 meta = with lib; { 127 description = "2D graphics library with support for multiple output devices"; 128 mainProgram = "cairo-trace"; 129 longDescription = '' 130 Cairo is a 2D graphics library with support for multiple output 131 devices. Currently supported output targets include the X 132 Window System, XCB, Quartz, Win32, image buffers, PostScript, 133 PDF, and SVG file output. 134 135 Cairo is designed to produce consistent output on all output 136 media while taking advantage of display hardware acceleration 137 when available (e.g., through the X Render Extension). 138 ''; 139 homepage = "http://cairographics.org/"; 140 license = with licenses; [ 141 lgpl2Plus 142 mpl10 143 ]; 144 pkgConfigModules = [ 145 "cairo-pdf" 146 "cairo-ps" 147 "cairo-svg" 148 ] 149 ++ lib.optional gobjectSupport "cairo-gobject"; 150 platforms = platforms.all; 151 }; 152 } 153)