Skip to content

Commit 633ccb7

Browse files
committed
wayland 1.26.0: four members, and the macros become a module
Rebased on upstream 1.26.0 (from 1.23.1) and reorganised around what the packages actually are: freedesktop.wayland-scanner the protocol generator freedesktop.wayland libwayland-client.so.0 + import wayland.client freedesktop.wayland-server libwayland-server.so.0 + import wayland.server freedesktop.wayland-util the macros, as entities a module can export Each library package now ships BOTH the C library and its module wrapper, so there is one package per library rather than a C one and a module one — the opencv shape. The namespace is the upstream org. The module wrappers add no API: every exported name is upstream's, spelled upstream's way, and the export lists are generated from the public headers so a version bump cannot quietly drop one. Macros were the one thing that could not come through. `export` names entities and a macro is not one, so wayland.util maps each to what it actually is — WL_MARSHAL_FLAG_DESTROY to a constexpr, wl_container_of to a function template, and the six *_for_each loops to ranges. Its test instantiates all of them, including the _safe removal guarantee, and links nothing: the list is wired by hand so a package of templates keeps zero dependencies. 1.26.0 needed one build fix over 1.23.1: scanner.c now calls strndup(), which -std=c11 hides, so the scanner carries -D_GNU_SOURCE= as well. CI runs the whole thing on gcc AND llvm — the export list is exactly where the two disagree — and still builds the tree with upstream meson, so "no upstream file is patched" has a test rather than a promise.
1 parent ec99bde commit 633ccb7

143 files changed

Lines changed: 10165 additions & 3715 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ indent_style = tab
99
indent_size = 8
1010
max_line_length = 80
1111

12-
[*.xml]
13-
indent_style = tab
12+
[*.{xml,xsl}]
13+
indent_style = space
1414
indent_size = 2
1515
tab_width = 8
1616

.git-blame-ignore-revs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Use the following command to ignore the following commits in git blame:
2+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
3+
4+
77b9eb76369e27142b8be296b5f2eb1ca466272a # protocol: reindent wayland.xml

.github/workflows/ci.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# Build all three members and prove the generated code is really generated.
2-
#
3-
# The interesting failure mode here is not "does it compile" — it is that a
4-
# HOST wayland-scanner would silently produce different code. 1.22 does not
5-
# know 1.23's `deprecated-since` attribute and rejects protocol/wayland.xml
6-
# outright, so the job asserts the generator that ran was the one this build
7-
# produced.
1+
# Build every member on BOTH toolchains, and check what a green compile would
2+
# not: that the generator is ours, that the sonames are canonical, and that the
3+
# two libraries do not overlap.
84
name: ci
95

106
on:
@@ -17,6 +13,14 @@ on:
1713
jobs:
1814
build:
1915
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# Both, because the module wrapper is where they differ most: GCC and
20+
# Clang disagree about what a `using ::name;` in an export block may
21+
# name, and a 300-entry export list is exactly where that shows up.
22+
toolchain: [gcc, llvm]
23+
name: build (${{ matrix.toolchain }})
2024
steps:
2125
- uses: actions/checkout@v4
2226

@@ -27,21 +31,24 @@ jobs:
2731
"$HOME/.xlings/bin/xlings" install mcpp -y
2832
2933
- name: Build the workspace
30-
run: mcpp build --workspace
34+
run: mcpp build --workspace --toolchain ${{ matrix.toolchain }}
3135

32-
- name: wayland-scanner runs and is 1.23.1
36+
- name: The macro mappings actually run
37+
run: mcpp test -p mcpp/util --toolchain ${{ matrix.toolchain }}
38+
39+
- name: wayland-scanner is ours, and is 1.26.0
3340
run: |
3441
scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1)
3542
test -n "$scanner" || { echo "no wayland-scanner was built"; exit 1; }
3643
"$scanner" --version
37-
"$scanner" --version | grep -qx 'wayland-scanner 1.23.1'
44+
"$scanner" --version | grep -qx 'wayland-scanner 1.26.0'
3845
3946
- name: the generated protocol code came from THIS scanner
4047
run: |
4148
scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1)
4249
"$scanner" -s public-code protocol/wayland.xml /tmp/wayland-protocol.c
4350
head -1 /tmp/wayland-protocol.c
44-
grep -q 'Generated by wayland-scanner 1.23.1' /tmp/wayland-protocol.c
51+
grep -q 'Generated by wayland-scanner 1.26.0' /tmp/wayland-protocol.c
4552
4653
- name: both libraries carry the canonical SONAMEs
4754
run: |
@@ -56,10 +63,8 @@ jobs:
5663
5764
- name: the two libraries do not overlap
5865
run: |
59-
# Mesa's libEGL_mesa has DT_NEEDED on both; if one carried the
60-
# other's API the process would resolve it to whichever loaded
61-
# first. wl_display_create is server-only, wl_display_connect
62-
# client-only.
66+
# Mesa's libEGL_mesa has DT_NEEDED on both; if one carried the other's
67+
# API the process would bind to whichever loaded first.
6368
c=$(find mcpp/client/target -name libwayland-client.so -type f | head -1)
6469
s=$(find mcpp/server/target -name libwayland-server.so -type f | head -1)
6570
readelf --dyn-syms -W "$c" | grep -q ' wl_display_connect' || exit 1
@@ -68,11 +73,21 @@ jobs:
6873
readelf --dyn-syms -W "$s" | grep -q ' wl_display_connect' && { echo "server leaked the client API"; exit 1; }
6974
echo "client and server APIs are disjoint"
7075
71-
- name: upstream's own build still works
76+
- name: both modules produced a BMI
7277
run: |
73-
# The fork patches no upstream file, so meson must still be able to
74-
# build this tree. If this breaks, something was modified that should
75-
# not have been.
78+
for m in client server util; do
79+
find "mcpp/$m/target" -name '*.gcm' -o -name '*.pcm' | head -1 | grep -q . \
80+
|| { echo "$m: no module interface was produced"; exit 1; }
81+
done
82+
echo "wayland.client, wayland.server and wayland.util all have interfaces"
83+
84+
upstream:
85+
# The fork patches no upstream file, so meson must still build this tree.
86+
# If this breaks, something was modified that should not have been.
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
- run: |
7691
sudo apt-get update -qq
7792
sudo apt-get install -y -qq meson ninja-build libffi-dev libexpat1-dev
7893
meson setup build-meson -Ddocumentation=false -Ddtd_validation=false

.gitlab-ci.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ include:
4343
# API changes. If you need new features from ci-templates you must bump
4444
# this to the current SHA you require from the ci-templates repo, however
4545
# be aware that you may need to account for API changes when doing so.
46-
ref: b791bd48996e3ced9ca13f1c5ee82be8540b8adb
46+
ref: 48c2c583a865bd59be21e8938df247faf460099c
4747
file:
4848
- '/templates/debian.yml'
4949
- '/templates/freebsd.yml'
@@ -62,6 +62,13 @@ stages:
6262
- "Build and test"
6363
- "Other build configurations"
6464

65+
workflow:
66+
rules:
67+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
68+
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
69+
when: never
70+
- if: $CI_COMMIT_BRANCH
71+
6572
.ci-rules:
6673
rules:
6774
- when: on_success
@@ -70,12 +77,11 @@ stages:
7077
.os-debian:
7178
variables:
7279
BUILD_OS: debian
73-
FDO_DISTRIBUTION_VERSION: bookworm
74-
FDO_DISTRIBUTION_PACKAGES: 'build-essential pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl python3-pip python3-setuptools ninja-build'
75-
FDO_DISTRIBUTION_EXEC: 'pip3 install --break-system-packages meson~=0.57.2'
80+
FDO_DISTRIBUTION_VERSION: trixie
81+
FDO_DISTRIBUTION_PACKAGES: 'build-essential pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl mdbook meson ninja-build'
7682
# bump this tag every time you change something which requires rebuilding the
7783
# base image
78-
FDO_DISTRIBUTION_TAG: "2024-03-28.2"
84+
FDO_DISTRIBUTION_TAG: "2026-01-31.0"
7985

8086
.debian-x86_64:
8187
extends:
@@ -94,6 +100,7 @@ stages:
94100
- .os-debian
95101
variables:
96102
BUILD_ARCH: "armv7"
103+
FDO_DISTRIBUTION_PLATFORM: "linux/arm/v7"
97104

98105

99106
# Does not inherit .ci-rules as we only want it to run in MR context.
@@ -147,13 +154,12 @@ armv7-debian-container_prep:
147154
stage: "Base container"
148155
variables:
149156
GIT_STRATEGY: none
150-
FDO_BASE_IMAGE: "arm32v7/debian:$FDO_DISTRIBUTION_VERSION"
151157

152158

153159
# Core build environment.
154160
.build-env:
155161
variables:
156-
MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined"
162+
MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined -Ddocbook_validation=true"
157163
# See https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/154
158164
ASAN_OPTIONS: "detect_odr_violation=0"
159165
before_script:
@@ -216,11 +222,11 @@ armv7-debian-container_prep:
216222
- .ci-rules
217223
stage: "Build and test"
218224
script:
219-
- cd "$BUILDDIR"
220-
- meson --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons --fatal-meson-warnings -Dwerror=true ${MESON_BUILD_TYPE} ..
221-
- ninja -k0 -j${FDO_CI_CONCURRENT:-4}
222-
- meson test --num-processes ${FDO_CI_CONCURRENT:-4}
223-
- ninja clean
225+
- meson setup $BUILDDIR --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons --fatal-meson-warnings -Dwerror=true ${MESON_BUILD_TYPE}
226+
- ninja -C $BUILDDIR -k0 -j${FDO_CI_CONCURRENT:-4}
227+
- meson test -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4}
228+
- ninja -C $BUILDDIR install
229+
- ninja -C $BUILDDIR clean
224230
artifacts:
225231
name: wayland-$CI_JOB_NAME
226232
when: always
@@ -243,7 +249,7 @@ armv7-debian-container_prep:
243249
# the workspace to see details about the failed tests.
244250
- |
245251
set +e
246-
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson $BUILDDIR --prefix=$PREFIX $MESON_BUILD_TYPE $MESON_ARGS && ninja -C $BUILDDIR -j${FDO_CI_CONCURRENT:-4}"
252+
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson setup $BUILDDIR --prefix=$PREFIX $MESON_BUILD_TYPE $MESON_ARGS && ninja -C $BUILDDIR -j${FDO_CI_CONCURRENT:-4}"
247253
/app/vmctl exec "meson test --print-errorlogs -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4}" && touch .tests-successful
248254
set -ex
249255
scp -r vm:$BUILDDIR/meson-logs .
@@ -299,11 +305,11 @@ armv7-release-debian-build:
299305
.os-freebsd:
300306
variables:
301307
BUILD_OS: freebsd
302-
FDO_DISTRIBUTION_VERSION: "13.2"
308+
FDO_DISTRIBUTION_VERSION: "14.4"
303309
FDO_DISTRIBUTION_PACKAGES: 'libxslt meson ninja pkgconf expat libffi libepoll-shim libxml2'
304310
# bump this tag every time you change something which requires rebuilding the
305311
# base image
306-
FDO_DISTRIBUTION_TAG: "2023-08-02.0"
312+
FDO_DISTRIBUTION_TAG: "2026-03-10.0"
307313
# Don't build documentation since installing the required tools massively
308314
# increases the VM image (and therefore container) size.
309315
MESON_ARGS: "--fatal-meson-warnings -Dwerror=true -Ddocumentation=false"

README.mcpp.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# mcpplibs/wayland
22

3-
[Wayland](https://gitlab.freedesktop.org/wayland/wayland) 1.23.1 with mcpp build
3+
[Wayland](https://gitlab.freedesktop.org/wayland/wayland) 1.26.0 with mcpp build
44
support, consumed from [mcpp-index](https://github.com/mcpplibs/mcpp-index) as
55
three packages:
66

77
| package | output |
88
|---|---|
9-
| `compat.wayland-scanner` | `wayland-scanner`, the protocol code generator |
10-
| `compat.wayland` | `libwayland-client.so.0` |
11-
| `compat.wayland-server` | `libwayland-server.so.0` |
9+
| `freedesktop.wayland-scanner` | `wayland-scanner`, the protocol code generator |
10+
| `freedesktop.wayland` | `libwayland-client.so.0` |
11+
| `freedesktop.wayland-server` | `libwayland-server.so.0` |
1212

1313
```bash
1414
mcpp build --workspace
@@ -42,5 +42,5 @@ version, so that mismatch is not expressible.
4242

4343
## Upstream
4444

45-
Tracking wayland 1.23.1. Upstream sources, `protocol/`, `tests/` and the meson
45+
Tracking wayland 1.26.0. Upstream sources, `protocol/`, `tests/` and the meson
4646
build are untouched, so `meson setup build && ninja -C build` still works.

config.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#pragma once
1717

1818
#define PACKAGE "wayland"
19-
#define PACKAGE_VERSION "1.23.1"
19+
#define PACKAGE_VERSION "1.26.0"
2020

2121
#define HAVE_SYS_PRCTL_H 1
2222
/* sys/procctl.h and sys/ucred.h are BSD; absent on linux. */
@@ -28,6 +28,8 @@
2828
#define HAVE_MEMFD_CREATE 1
2929
#define HAVE_MREMAP 1
3030
#define HAVE_STRNDUP 1
31+
/* new in 1.26: wayland-server uses it for the client thread id. */
32+
#define HAVE_GETTID 1
3133

3234
/* `struct xucred` is FreeBSD's; the socket peer-credential path uses
3335
* SO_PEERCRED on linux instead. */

cursor/convert_font.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* http://fontforge.org/pcf-format.html
3030
*/
3131

32-
#include <assert.h>
3332
#include <fcntl.h>
3433
#include <stdint.h>
3534
#include <stdio.h>

cursor/wayland-cursor.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "xcursor.h"
2828
#include "wayland-cursor.h"
2929
#include "wayland-client.h"
30+
#include <limits.h>
3031
#include <stdio.h>
3132
#include <stdlib.h>
3233
#include <stdint.h>
@@ -68,11 +69,16 @@ shm_pool_create(struct wl_shm *shm, int size)
6869
goto err_close;
6970

7071
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
72+
if (!pool->pool)
73+
goto err_unmap;
74+
7175
pool->size = size;
7276
pool->used = 0;
7377

7478
return pool;
7579

80+
err_unmap:
81+
munmap(pool->data, size);
7682
err_close:
7783
close(pool->fd);
7884
err_free:
@@ -279,7 +285,8 @@ wl_cursor_create_from_xcursor_images(struct xcursor_images *images,
279285
{
280286
struct cursor *cursor;
281287
struct cursor_image *image;
282-
int i, size;
288+
size_t size;
289+
int i;
283290

284291
cursor = malloc(sizeof *cursor);
285292
if (!cursor)
@@ -309,7 +316,12 @@ wl_cursor_create_from_xcursor_images(struct xcursor_images *images,
309316
image->image.hotspot_y = images->images[i]->yhot;
310317
image->image.delay = images->images[i]->delay;
311318

312-
size = image->image.width * image->image.height * 4;
319+
size = (size_t) image->image.width * image->image.height * 4;
320+
if (size > INT_MAX) {
321+
free(image);
322+
break;
323+
}
324+
313325
image->offset = shm_pool_allocate(theme->pool, size);
314326
if (image->offset < 0) {
315327
free(image);
@@ -339,6 +351,8 @@ load_callback(struct xcursor_images *images, void *data)
339351
{
340352
struct wl_cursor_theme *theme = data;
341353
struct wl_cursor *cursor;
354+
struct wl_cursor **p;
355+
size_t s;
342356

343357
if (wl_cursor_theme_get_cursor(theme, images->name)) {
344358
xcursor_images_destroy(images);
@@ -348,15 +362,14 @@ load_callback(struct xcursor_images *images, void *data)
348362
cursor = wl_cursor_create_from_xcursor_images(images, theme);
349363

350364
if (cursor) {
351-
theme->cursor_count++;
352-
theme->cursors =
353-
realloc(theme->cursors,
354-
theme->cursor_count * sizeof theme->cursors[0]);
365+
s = theme->cursor_count + 1;
366+
p = realloc(theme->cursors, s * sizeof theme->cursors[0]);
355367

356-
if (theme->cursors == NULL) {
357-
theme->cursor_count--;
368+
if (p == NULL) {
358369
free(cursor);
359370
} else {
371+
theme->cursor_count = s;
372+
theme->cursors = p;
360373
theme->cursors[theme->cursor_count - 1] = cursor;
361374
}
362375
}
@@ -384,6 +397,9 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
384397
if (!theme)
385398
return NULL;
386399

400+
if (size < 0 || (size > 0 && INT_MAX / size / 4 < size))
401+
goto err;
402+
387403
if (!name)
388404
name = "default";
389405

@@ -393,7 +409,7 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
393409

394410
theme->pool = shm_pool_create(shm, size * size * 4);
395411
if (!theme->pool)
396-
goto out_error_pool;
412+
goto err;
397413

398414
xcursor_load_theme(name, size, load_callback, theme);
399415

@@ -405,7 +421,7 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
405421

406422
return theme;
407423

408-
out_error_pool:
424+
err:
409425
free(theme);
410426
return NULL;
411427
}

0 commit comments

Comments
 (0)