ReviewOS

also looking at this

pantry-pm/pantry

feat(webkitgtk): add the GTK3 WebKit provider craft's Linux binary needs

#272
Merged glennmichael123 wants to merge feat/266-webkitgtk-provider into main
7 files +425 -4
packages/ts-pantry/src/recipes/webkitgtk.org.tsadded+174-0
Changes to packages/ts-pantry/src/recipes/webkitgtk.org.ts
@@ -0,0 +1,174 @@
1import type { Recipe } from '../../scripts/recipe-types'
2
3export const recipe: Recipe = {
4 domain: 'webkitgtk.org',
5 name: 'webkitgtk',
6 description: 'WebKit rendering engine for GTK, providing the webkit2gtk-4.1 API',
7 homepage: 'https://webkitgtk.org',
8 github: 'https://github.com/WebKit/WebKit',
9 programs: [],
10
11 // WebKitGTK 2.x builds exactly one API per configure, chosen by USE_GTK4:
12 // ON (upstream's default) gives GTK4 + webkitgtk-6.0, OFF gives GTK3 +
13 // webkit2gtk-4.1. Source/cmake/OptionsGTK.cmake sets WEBKITGTK_API_INFIX to
14 // "2" for 4.1, which is why the sonames are libwebkit2gtk-4.1.so.0 and
15 // libjavascriptcoregtk-4.1.so.0 — the two craft-native.org's Linux binary
16 // fails to resolve. 4.1 is GTK3 + libsoup3; upstream deprecated libsoup2
17 // (API 4.0), and 2.54's OptionsGTK.cmake now calls find_package(Soup3 3.0.0
18 // REQUIRED) unconditionally, so there is no soup2 variant left to pick.
19 // WPE and the GTK4 6.0 API are DIFFERENT APIs, not substitutes: neither
20 // provides these sonames.
21 platforms: ['linux/x86-64'],
22
23 versionSource: {
24 type: 'github-tags',
25 repo: 'WebKit/WebKit',
26 // The WebKit monorepo tags every port; only webkitgtk-* releases are ours.
27 // Anchored, with a bounded numeric capture, so a hypothetical
28 // webkitgtk-2.54.0-rc1 cannot match (github-tags carries no prerelease
29 // flag) and the pattern cannot backtrack super-linearly.
30 tagPattern: /^webkitgtk-(\d+(?:\.\d+){0,3})$/,
31 },
32
33 distributable: {
34 // Upstream's own release tarballs, not the monorepo archive: the GitHub
35 // tag tree is the whole of WebKit (every port) and does not carry the
36 // generated files the release tarball ships.
37 url: 'https://webkitgtk.org/releases/webkitgtk-.tar.xz',
38 stripComponents: 1,
39 },
40
41 // libwebkit2gtk does not do its own rendering in-process: it spawns
42 // WebKitWebProcess and WebKitNetworkProcess from PKGLIBEXECDIR and loads the
43 // injected bundle from the lib tree (Source/WebKit/PlatformGTK.cmake installs
44 // it under lib/webkit2gtk-4.1/injected-bundle). A consumer that bundles only
45 // the .so gets a library that loads and then fails the moment a page is
46 // created, so both directories travel with it.
47 runtimeResources: [
48 'libexec/webkit2gtk-4.1',
49 'lib/webkit2gtk-4.1/injected-bundle',
50 ],
51
52 // Every domain below is published for linux-x86-64 today; this closure was
53 // checked against the registry before the recipe was written, because a
54 // dependency declaration naming a provider that does not exist fails at
55 // install time rather than at publish time.
56 dependencies: {
57 'gtk.org/gtk3': '^3.24',
58 'gnome.org/glib': '^2',
59 'libsoup.org': '^3',
60 'unicode.org': '*',
61 'cairographics.org': '*',
62 'gnome.org/pango': '*',
63 'harfbuzz.org': '*',
64 'freetype.org': '*',
65 'freedesktop.org/fontconfig': '*',
66 'gnome.org/libxml2': '*',
67 'gnome.org/libxslt': '*',
68 'sqlite.org': '*',
69 'libjpeg-turbo.org': '*',
70 'libpng.org': '*',
71 'google.com/webp': '*',
72 'google.com/woff2': '*',
73 'gnu.org/libtasn1': '*',
74 'gnupg.org/libgcrypt': '*',
75 'littlecms.com': '*',
76 'gnome.org/atk': '*',
77 'gnome.org/gdk-pixbuf': '*',
78 'github.com/anholt/libepoxy': '*',
79 'gnome.org/libsecret': '*',
80 'openjpeg.org': '*',
81 'zlib.net': '*',
82 'x.org/x11': '*',
83 'x.org/exts': '*',
84 'wayland.freedesktop.org': '*',
85 'mesa3d.org': '*',
86 },
87
88 buildDependencies: {
89 'cmake.org': '^3',
90 'ninja-build.org': '*',
91 'freedesktop.org/pkg-config': '*',
92 'gnu.org/gettext': '*',
93 'gnu.org/gperf': '*',
94 'ruby-lang.org': '*',
95 'python.org': '^3',
96 },
97
98 build: {
99 script: [
100 'cmake -S . -B build -G Ninja $CMAKE_ARGS',
101 'cmake --build build',
102 'cmake --install build',
103 ],
104 env: {
105 CMAKE_ARGS: [
106 '-DPORT=GTK',
107 '-DCMAKE_BUILD_TYPE=Release',
108 '-DCMAKE_INSTALL_PREFIX=',
109 '-DCMAKE_INSTALL_LIBDIR=lib',
110 '-DCMAKE_INSTALL_LIBEXECDIR=libexec',
111 '-DCMAKE_INSTALL_RPATH=/lib',
112 '-DCMAKE_FIND_FRAMEWORK=LAST',
113 '-Wno-dev',
114
115 // The API selector. Everything else here exists to keep that build's
116 // dependency closure inside what Pantry actually publishes.
117 '-DUSE_GTK4=OFF',
118
119 // GStreamer is NOT optional behind ENABLE_VIDEO. GStreamerChecks.cmake
120 // guards on USE_GSTREAMER and then calls find_package(GStreamer 1.18.4
121 // REQUIRED COMPONENTS app pbutils) with app/pbutils listed
122 // unconditionally — turning off video and web audio alone still fails
123 // configure. Pantry's catalog has gstreamer.freedesktop.org/orc and no
124 // GStreamer core or gst-plugins-base, and neither does pkgx, so the
125 // whole subsystem is off until those recipes exist. Consequence, stated
126 // plainly: <video>, <audio> and WebAudio do not work in this build.
127 '-DUSE_GSTREAMER=OFF',
128 '-DENABLE_VIDEO=OFF',
129 '-DENABLE_WEB_AUDIO=OFF',
130 '-DENABLE_MEDIA_SOURCE=OFF',
131 '-DENABLE_MEDIA_STREAM=OFF',
132 '-DENABLE_MEDIA_RECORDER=OFF',
133 '-DENABLE_MEDIA_SESSION=OFF',
134 '-DUSE_GSTREAMER_WEBRTC=OFF',
135 // ENABLE_WEB_RTC already defaults OFF for this port; pinning it keeps
136 // the ENABLE_MEDIA_STREAM AND ENABLE_WEB_RTC branch in
137 // GStreamerChecks.cmake — which sits OUTSIDE the USE_GSTREAMER guard
138 // and would otherwise turn on the bundled libwebrtc — unreachable.
139 '-DENABLE_WEB_RTC=OFF',
140
141 // Each of these has a find_package ... FATAL_ERROR in OptionsGTK.cmake
142 // and no provider in the catalog: Enchant (spellcheck), libhyphen
143 // (automatic hyphenation), libmanette (gamepad), libdrm/GBM — and
144 // ENABLE_GPU_PROCESS depends on USE_GBM, so it goes with them.
145 '-DENABLE_SPELLCHECK=OFF',
146 '-DUSE_LIBHYPHEN=OFF',
147 '-DENABLE_GAMEPAD=OFF',
148 '-DUSE_LIBDRM=OFF',
149 '-DUSE_GBM=OFF',
150 '-DENABLE_GPU_PROCESS=OFF',
151 '-DENABLE_SPEECH_SYNTHESIS=OFF',
152 '-DENABLE_JOURNALD_LOG=OFF',
153 '-DUSE_LIBBACKTRACE=OFF',
154 '-DUSE_JPEGXL=OFF',
155 '-DUSE_AVIF=OFF',
156
157 // The sandbox needs bubblewrap and xdg-dbus-proxy at RUNTIME, found by
158 // absolute path; neither is a Pantry package, and a sandbox that cannot
159 // find its helper refuses to start the web process.
160 '-DENABLE_BUBBLEWRAP_SANDBOX=OFF',
161
162 // Introspection pulls gi-docgen for documentation; craft links the C
163 // ABI directly and needs no GIR, so both stay off to keep the build
164 // closure to libraries we publish.
165 '-DENABLE_INTROSPECTION=OFF',
166 '-DENABLE_DOCUMENTATION=OFF',
167
168 // MiniBrowser is a developer tool; this package ships libraries only
169 // (programs: []), so building it would be dead weight in the artifact.
170 '-DENABLE_MINIBROWSER=OFF',
171 ],
172 },
173 },
174}