|
| 1 | +-- compat.pixman — pixman 0.46.4, the pixel-manipulation library. |
| 2 | +-- |
| 3 | +-- The software compositing path. A Wayland compositor uses it for the surfaces |
| 4 | +-- it cannot hand to the GPU — damage regions, cursor blending, the fallback |
| 5 | +-- when there is no EGL — and cairo, X and Mesa all sit on it too. |
| 6 | +-- |
| 7 | +-- ───────────────────────────────────────────────────────────────────────── |
| 8 | +-- SHAPE: an inline descriptor, and the SIMD is why that is worth saying |
| 9 | +-- |
| 10 | +-- pixman is a separable project with its own releases, so by the criterion it |
| 11 | +-- is a source build. What made it look like it needed a fork is the SIMD: |
| 12 | +-- upstream builds ONE STATIC LIBRARY PER INSTRUCTION SET, each from a single |
| 13 | +-- `.c` compiled with that set's flags: |
| 14 | +-- |
| 15 | +-- foreach simd : simds # meson.build:63 |
| 16 | +-- pixman_simd_libs += static_library( |
| 17 | +-- 'pixman-' + simd[0], [name + '.c', ...], c_args : simd[2]) |
| 18 | +-- |
| 19 | +-- Package-wide `cflags` cannot express that. `-mssse3` applied to every file |
| 20 | +-- would let the compiler emit SSSE3 in code that runs before the CPUID check |
| 21 | +-- in `pixman-x86.c` — an illegal-instruction crash on an older CPU, from a |
| 22 | +-- library whose whole design is to dispatch at runtime. |
| 23 | +-- |
| 24 | +-- `[build] flags` with a `glob` is what expresses it, and this is not a new |
| 25 | +-- mechanism: `compat.sdl2` already scopes `-msse3` to one file the same way. |
| 26 | +-- So no fork, no `build.mcpp`. Contrast `freedesktop.gldispatch`, where the |
| 27 | +-- per-architecture choice is WHICH FILES to compile rather than which flags to |
| 28 | +-- give them — that one does need `build.mcpp`. |
| 29 | +-- |
| 30 | +-- ───────────────────────────────────────────────────────────────────────── |
| 31 | +-- WHAT IS COMPILED AND WHAT IS NOT |
| 32 | +-- |
| 33 | +-- The x86 SIMD (`pixman-sse2.c`, `pixman-ssse3.c`) is in; MMX is not. MMX is |
| 34 | +-- 32-bit-x86 era and upstream itself gates it behind `have_mmx`, which is |
| 35 | +-- false on x86_64 toolchains. The ARM/MIPS/PPC/RISC-V variants come with |
| 36 | +-- assembly files and their own probes; they are absent here for the same |
| 37 | +-- reason `freedesktop.egl` leaves X11 out — nothing in this index builds for |
| 38 | +-- those targets yet, and the runtime dispatch degrades to the generic path |
| 39 | +-- rather than failing. |
| 40 | +-- |
| 41 | +-- `pixman-config.h` and `pixman-version.h` are meson's `configure_file` |
| 42 | +-- outputs. They are generated here rather than probed: every value in them is |
| 43 | +-- a property of the target, and the target is Linux with a GCC-compatible |
| 44 | +-- toolchain. |
| 45 | +package = { |
| 46 | + spec = "1", |
| 47 | + namespace = "compat", |
| 48 | + name = "pixman", |
| 49 | + description = "pixman 0.46.4 — low-level pixel manipulation, with runtime-dispatched x86 SIMD", |
| 50 | + licenses = {"MIT"}, |
| 51 | + repo = "https://gitlab.freedesktop.org/pixman/pixman", |
| 52 | + type = "package", |
| 53 | + |
| 54 | + xpm = { |
| 55 | + linux = { |
| 56 | + ["0.46.4"] = { |
| 57 | + url = { |
| 58 | + GLOBAL = "https://gitlab.freedesktop.org/pixman/pixman/-/archive/pixman-0.46.4/pixman-pixman-0.46.4.tar.gz", |
| 59 | + CN = "https://gitcode.com/mcpp-res/pixman/releases/download/0.46.4/pixman-0.46.4.tar.gz", |
| 60 | + }, |
| 61 | + sha256 = "1b8288086e5da0ec5cb95cf174a919cc6fe4548f10dc3cd873b3bb1d9e8fdeab", |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + |
| 66 | + mcpp = { |
| 67 | + language = "c++23", |
| 68 | + import_std = false, |
| 69 | + c_standard = "c11", |
| 70 | + |
| 71 | + include_dirs = { "*/pixman", "mcpp_generated" }, |
| 72 | + |
| 73 | + generated_files = { |
| 74 | + ["mcpp_generated/pixman-config.h"] = [[ |
| 75 | +#ifndef PIXMAN_CONFIG_H |
| 76 | +#define PIXMAN_CONFIG_H |
| 77 | +/* meson's configure_file output, written out for the one target this |
| 78 | + package builds: Linux, x86_64, a GCC-compatible toolchain. */ |
| 79 | +#define USE_SSE2 1 |
| 80 | +#define USE_SSSE3 1 |
| 81 | +#define USE_GCC_INLINE_ASM 1 |
| 82 | +#define HAVE_PTHREADS 1 |
| 83 | +#define HAVE_POSIX_MEMALIGN 1 |
| 84 | +#define HAVE_MMAP 1 |
| 85 | +#define HAVE_MPROTECT 1 |
| 86 | +#define HAVE_GETPAGESIZE 1 |
| 87 | +#define HAVE_SYS_MMAN_H 1 |
| 88 | +#define HAVE_UNISTD_H 1 |
| 89 | +#define HAVE_FENV_H 1 |
| 90 | +#define HAVE_FEDIVBYZERO 1 |
| 91 | +#define HAVE_FEENABLEEXCEPT 1 |
| 92 | +#define HAVE_BUILTIN_CLZ 1 |
| 93 | +#define HAVE_FLOAT128 1 |
| 94 | +#define TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR 1 |
| 95 | +#define TLS __thread |
| 96 | +#define PACKAGE "pixman" |
| 97 | +#endif |
| 98 | +]], |
| 99 | + ["mcpp_generated/pixman-version.h"] = [[ |
| 100 | +#ifndef PIXMAN_VERSION_H__ |
| 101 | +#define PIXMAN_VERSION_H__ |
| 102 | +#ifndef PIXMAN_H__ |
| 103 | +# error pixman-version.h should only be included by pixman.h |
| 104 | +#endif |
| 105 | +#define PIXMAN_VERSION_MAJOR 0 |
| 106 | +#define PIXMAN_VERSION_MINOR 46 |
| 107 | +#define PIXMAN_VERSION_MICRO 4 |
| 108 | +#define PIXMAN_VERSION_STRING "0.46.4" |
| 109 | +#define PIXMAN_VERSION_ENCODE(major, minor, micro) ( \ |
| 110 | + ((major) * 10000) \ |
| 111 | + + ((minor) * 100) \ |
| 112 | + + ((micro) * 1)) |
| 113 | +#define PIXMAN_VERSION PIXMAN_VERSION_ENCODE( \ |
| 114 | + PIXMAN_VERSION_MAJOR, \ |
| 115 | + PIXMAN_VERSION_MINOR, \ |
| 116 | + PIXMAN_VERSION_MICRO) |
| 117 | +
|
| 118 | +/* PIXMAN_API lives HERE upstream, not in a compiler header, and leaving it |
| 119 | + out is silent: every `PIXMAN_API void pixman_fill(...)` in pixman.h then |
| 120 | + parses as an unknown identifier and the declaration is lost. What surfaces |
| 121 | + is `implicit declaration of function 'pixman_fill'` from a SIMD file that |
| 122 | + has nothing to do with it. */ |
| 123 | +#ifndef PIXMAN_API |
| 124 | +# define PIXMAN_API |
| 125 | +#endif |
| 126 | +#endif |
| 127 | +]], |
| 128 | + }, |
| 129 | + |
| 130 | + sources = { |
| 131 | + "*/pixman/pixman.c", |
| 132 | + "*/pixman/pixman-access.c", |
| 133 | + "*/pixman/pixman-access-accessors.c", |
| 134 | + "*/pixman/pixman-arm.c", |
| 135 | + "*/pixman/pixman-bits-image.c", |
| 136 | + "*/pixman/pixman-combine32.c", |
| 137 | + "*/pixman/pixman-combine-float.c", |
| 138 | + "*/pixman/pixman-conical-gradient.c", |
| 139 | + "*/pixman/pixman-edge.c", |
| 140 | + "*/pixman/pixman-edge-accessors.c", |
| 141 | + "*/pixman/pixman-fast-path.c", |
| 142 | + "*/pixman/pixman-filter.c", |
| 143 | + "*/pixman/pixman-glyph.c", |
| 144 | + "*/pixman/pixman-general.c", |
| 145 | + "*/pixman/pixman-gradient-walker.c", |
| 146 | + "*/pixman/pixman-image.c", |
| 147 | + "*/pixman/pixman-implementation.c", |
| 148 | + "*/pixman/pixman-linear-gradient.c", |
| 149 | + "*/pixman/pixman-matrix.c", |
| 150 | + "*/pixman/pixman-mips.c", |
| 151 | + "*/pixman/pixman-noop.c", |
| 152 | + "*/pixman/pixman-ppc.c", |
| 153 | + "*/pixman/pixman-radial-gradient.c", |
| 154 | + "*/pixman/pixman-region16.c", |
| 155 | + "*/pixman/pixman-region32.c", |
| 156 | + "*/pixman/pixman-region64f.c", |
| 157 | + "*/pixman/pixman-riscv.c", |
| 158 | + "*/pixman/pixman-solid-fill.c", |
| 159 | + "*/pixman/pixman-timer.c", |
| 160 | + "*/pixman/pixman-trap.c", |
| 161 | + "*/pixman/pixman-utils.c", |
| 162 | + "*/pixman/pixman-x86.c", |
| 163 | + -- the runtime-dispatched implementations |
| 164 | + "*/pixman/pixman-sse2.c", |
| 165 | + "*/pixman/pixman-ssse3.c", |
| 166 | + }, |
| 167 | + |
| 168 | + cflags = { "-D_GNU_SOURCE", "-DHAVE_CONFIG_H", "-fPIC" }, |
| 169 | + |
| 170 | + -- The whole reason this package needs no fork. Each entry gives ONE |
| 171 | + -- file the instruction set it implements, so the compiler may emit |
| 172 | + -- those instructions there and nowhere else — which is what makes |
| 173 | + -- pixman's CPUID dispatch in pixman-x86.c safe. |
| 174 | + flags = { |
| 175 | + { glob = "*/pixman/pixman-sse2.c", cflags = { "-msse2" } }, |
| 176 | + { glob = "*/pixman/pixman-ssse3.c", cflags = { "-mssse3" } }, |
| 177 | + }, |
| 178 | + |
| 179 | + targets = { ["pixman-1"] = { kind = "lib" } }, |
| 180 | + }, |
| 181 | +} |
0 commit comments