Skip to content

Commit ec99bde

Browse files
committed
ci: build all three members, and check what an inline descriptor cannot
Four things the CI asserts that a green compile would not: * the scanner that ran is 1.23.1, not whatever is on PATH — a host 1.22 rejects this protocol/wayland.xml outright (`deprecated-since`); * the generated marshalling code says so in its header line; * both libraries carry the canonical SONAMEs, which is what lets Mesa's libEGL_mesa bind to them; * client and server export DISJOINT APIs. They must be two files with two sonames, and if one leaked the other's symbols a process loading both would resolve to whichever came first. It also builds the tree with upstream meson, so the claim "no upstream file is patched" has a test rather than a promise.
1 parent 708c4b0 commit ec99bde

3 files changed

Lines changed: 81 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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.
8+
name: ci
9+
10+
on:
11+
push:
12+
branches: [main]
13+
tags: ['v*']
14+
pull_request:
15+
workflow_dispatch:
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install xlings + mcpp
24+
run: |
25+
curl -fsSL https://d2learn.org/xlings-install.sh | bash
26+
echo "$HOME/.xlings/subos/default/bin" >> "$GITHUB_PATH"
27+
"$HOME/.xlings/bin/xlings" install mcpp -y
28+
29+
- name: Build the workspace
30+
run: mcpp build --workspace
31+
32+
- name: wayland-scanner runs and is 1.23.1
33+
run: |
34+
scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1)
35+
test -n "$scanner" || { echo "no wayland-scanner was built"; exit 1; }
36+
"$scanner" --version
37+
"$scanner" --version | grep -qx 'wayland-scanner 1.23.1'
38+
39+
- name: the generated protocol code came from THIS scanner
40+
run: |
41+
scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1)
42+
"$scanner" -s public-code protocol/wayland.xml /tmp/wayland-protocol.c
43+
head -1 /tmp/wayland-protocol.c
44+
grep -q 'Generated by wayland-scanner 1.23.1' /tmp/wayland-protocol.c
45+
46+
- name: both libraries carry the canonical SONAMEs
47+
run: |
48+
for pair in "client:libwayland-client.so.0" "server:libwayland-server.so.0"; do
49+
member=${pair%%:*}; want=${pair#*:}
50+
so=$(find "mcpp/$member/target" -name "${want%.0}" -type f | head -1)
51+
test -n "$so" || { echo "$member: no library built"; exit 1; }
52+
got=$(readelf -d "$so" | sed -n 's/.*SONAME.*\[\(.*\)\]/\1/p')
53+
echo "$member -> $got"
54+
test "$got" = "$want" || { echo "expected $want"; exit 1; }
55+
done
56+
57+
- name: the two libraries do not overlap
58+
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.
63+
c=$(find mcpp/client/target -name libwayland-client.so -type f | head -1)
64+
s=$(find mcpp/server/target -name libwayland-server.so -type f | head -1)
65+
readelf --dyn-syms -W "$c" | grep -q ' wl_display_connect' || exit 1
66+
readelf --dyn-syms -W "$c" | grep -q ' wl_display_create' && { echo "client leaked the server API"; exit 1; }
67+
readelf --dyn-syms -W "$s" | grep -q ' wl_display_create' || exit 1
68+
readelf --dyn-syms -W "$s" | grep -q ' wl_display_connect' && { echo "server leaked the client API"; exit 1; }
69+
echo "client and server APIs are disjoint"
70+
71+
- name: upstream's own build still works
72+
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.
76+
sudo apt-get update -qq
77+
sudo apt-get install -y -qq meson ninja-build libffi-dev libexpat1-dev
78+
meson setup build-meson -Ddocumentation=false -Ddtd_validation=false
79+
ninja -C build-meson

README.mcpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# wayland-m
1+
# mcpplibs/wayland
22

33
[Wayland](https://gitlab.freedesktop.org/wayland/wayland) 1.23.1 with mcpp build
44
support, consumed from [mcpp-index](https://github.com/mcpplibs/mcpp-index) as

mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# wayland-m — Wayland with mcpp build support.
1+
# wayland — Wayland with mcpp build support.
22
#
33
# A fork of freedesktop's wayland at 1.23.1, unmodified except for this
44
# directory tree: `mcpp/` adds manifests, `config.h` and `mcpp/include/` add the

0 commit comments

Comments
 (0)