Otok public index

apotocki/pixman

Pixman, the pixel-manipulation library of Cairo and X.

Library
pixman
Newest
0.44.2 (r1, linux)
Targets
linux, windows
License
MIT
Homepage
https://pixman.org
Keywords
graphics, pixels, compositing

Use it

In otok.toml:

[deps.pixman]
recipe = "apotocki/pixman"
version = "~> 0.44.2"

Versions

VersionTargetChannelPublishedStatus
0.44.2 (r1, linux) linux stable 2026-11-07
0.44.2 (r1, windows) windows stable 2026-11-07

0.44.2 (r1, linux)

Platforms

linux

Toolchains

Recipe files

build.lua 529 bytes · raw
-- Pixman's meson build, the library only. What it installs: libpixman-1.a, or libpixman-1.so with its
-- links; the header in include/pixman-1/.
function build(slice, options, deps)
    otok.meson{ options = { tests = "disabled", demos = "disabled", gtk = "disabled", libpng = "disabled", openmp = "disabled" } }
    local p = slice.prefix
    local lib = otok.glob(slice.linkage == "static" and "lib/libpixman-1.a" or "lib/libpixman-1.so", p)[1]
    return { libraries = { ["pixman-1"] = lib }, headers = p .. "/include" }
end
patches/0001-reset-static-data.patch 1599 bytes · raw
pixman_reset_static_data(): frees the implementations pixman chose for the CPU, which toolchains without
__attribute__((destructor)) (MSVC) never free: for a leak checker at the end of a process, after
cairo_debug_reset_static_data(), which calls it in the cairo recipe of this repository with the option d2d.

diff --git a/pixman/pixman.c b/pixman/pixman.c
index 26e5008..17b26e4 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -1013,6 +1013,27 @@ pixman_version_string (void)
     return PIXMAN_VERSION_STRING;
 }
 
+/**
+ * pixman_reset_static_data:
+ *
+ * Frees the implementations pixman chose for this CPU, for a leak checker at the end of a process: toolchains without
+ * __attribute__((destructor)), such as MSVC, never free them otherwise. Where pixman creates them on first use (no
+ * __attribute__((constructor))), a later use creates them again; elsewhere pixman must not be used after it.
+ **/
+PIXMAN_EXPORT void
+pixman_reset_static_data (void)
+{
+    pixman_implementation_t *imp = global_implementation;
+
+    global_implementation = NULL;
+    while (imp)
+    {
+	pixman_implementation_t *cur = imp;
+	imp = imp->fallback;
+	free (cur);
+    }
+}
+
 /**
  * pixman_format_supported_source:
  * @format: A pixman_format_code_t format
diff --git a/pixman/pixman.h b/pixman/pixman.h
index d697b53..0b12bd7 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -788,6 +788,9 @@ int           pixman_version            (void);
 PIXMAN_API
 const char*   pixman_version_string     (void);
 
+PIXMAN_API
+void          pixman_reset_static_data  (void);
+
 /*
  * Images
  */
recipe.toml 910 bytes · raw
# The otok recipe of Pixman (https://github.com/apotocki/otok): libpixman-1 for Linux, from the release tag; static or
# dynamic.
[recipe]
api = 1
library = "pixman"
name = "pixman"
version = "0.44.2"
revision = 1
license = "MIT"
license-files = ["COPYING"]
homepage = "https://pixman.org"
description = "Pixman, the pixel-manipulation library of Cairo and X."
keywords = ["graphics", "pixels", "compositing"]
linkage = ["static", "dynamic"]

[source]
git = "https://gitlab.freedesktop.org/pixman/pixman.git"
commit = "46655e15671e1ca62d699821d75a85d341d7229c"
tag = "pixman-0.44.2"
patches = ["patches/0001-reset-static-data.patch"]

[platforms]
supported = ["linux"]
build-on = ["linux/gcc", "linux/clang"]

[toolchains]
meson = { version = ">= 1.3", default-recipe = "apotocki/meson" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }

[[product]]
name = "Pixman"
libraries = ["pixman-1"]