1{ lib
2, stdenv
3, fetchurl
4, pkg-config
5, libpng
6, glib /*just passthru*/
7
8# for passthru.tests
9, cairo
10, qemu
11, scribus
12, tigervnc
13, wlroots
14, xwayland
15}:
16
17stdenv.mkDerivation rec {
18 pname = "pixman";
19 version = "0.42.2";
20
21 src = fetchurl {
22 urls = [
23 "mirror://xorg/individual/lib/${pname}-${version}.tar.gz"
24 "https://cairographics.org/releases/${pname}-${version}.tar.gz"
25 ];
26 hash = "sha256-6hSA762i/ZSLx1Nm98NJ4cltMpfQmj/mJibjjiNKYl4=";
27 };
28
29 separateDebugInfo = !stdenv.hostPlatform.isStatic;
30
31 nativeBuildInputs = [ pkg-config ];
32
33 buildInputs = [ libpng ];
34
35 configureFlags = lib.optional stdenv.isAarch32 "--disable-arm-iwmmxt"
36 # Disable until https://gitlab.freedesktop.org/pixman/pixman/-/issues/46 is resolved
37 ++ lib.optional (stdenv.isAarch64 && !stdenv.cc.isGNU) "--disable-arm-a64-neon";
38
39 preConfigure = ''
40 # https://gitlab.freedesktop.org/pixman/pixman/-/issues/62
41 export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 184 ? 184 : NIX_BUILD_CORES))
42 '';
43
44 doCheck = true;
45
46 postInstall = glib.flattenInclude;
47
48 passthru.tests = {
49 inherit cairo qemu scribus tigervnc wlroots xwayland;
50 };
51
52 meta = with lib; {
53 homepage = "http://pixman.org";
54 description = "A low-level library for pixel manipulation";
55 license = licenses.mit;
56 platforms = platforms.all;
57 };
58}