Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/setup-webkit-libs.sh

2.3 KiB, 1 run

created by r2519314175:133, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1#!/usr/bin/env bash
2# setup-webkit-libs.sh — make Playwright's WebKit runnable on an unsupported host.
3#
4# Playwright's WebKit binary (webkit-2311) is built for Ubuntu 24.04 (ICU 74),
5# but this host is Ubuntu 25.10 (ICU 76), so `playwright install-deps webkit`
6# fails on package names that no longer exist. We do NOT need root: we fetch the
7# four genuinely-missing libraries from the 24.04 pool, extract just their .so
8# files, and drop them into WebKit's own runtime lib dirs. libjxl/libwpe are
9# already bundled by WebKit; only these four are missing on 25.10.
10#
11# Re-run this after any `playwright install webkit` (a reinstall wipes the copies).
12# Then run the WebKit suite: node dev/verify_webkit.mjs
13set -euo pipefail
14
15WKROOT="$HOME/.cache/ms-playwright/webkit-2311"
16STAGE="$HOME/webkit-libs"
17POOL="http://archive.ubuntu.com/ubuntu/pool"
18
19if [ ! -d "$WKROOT" ]; then
20 echo "webkit-2311 not found — run: node ~/.red-pw/node_modules/playwright-core/cli.js install webkit"
21 exit 1
22fi
23
24rm -rf "$STAGE/dl" "$STAGE/x" "$STAGE/lib"
25mkdir -p "$STAGE/dl" "$STAGE/x" "$STAGE/lib"
26cd "$STAGE/dl"
27
28grab() { # component pooldir debprefix
29 local base="$POOL/$1/$2/"
30 local deb
31 deb=$(curl -s "$base" | grep -oE "${3}_[^\"]*_amd64\.deb" | sort -V | tail -1)
32 [ -n "$deb" ] || { echo " !! not found: $3"; return 1; }
33 echo " $deb"
34 curl -s -O "$base$deb"
35}
36
37echo "Fetching the libs 25.10 is missing (ICU 74, libxml2, libmanette, libwoff, libevent)…"
38grab main i/icu libicu74
39grab main libx/libxml2 libxml2
40grab universe libm/libmanette libmanette-0.2-0
41grab main w/woff2 libwoff1
42# 25.10 ships libevent's split libraries (libevent_core/_extra/_pthreads) but not
43# the monolithic libevent-2.1.so.7 that WebKit's MiniBrowser links against, so it
44# dies with "cannot open shared object file" before it can even load a page.
45grab main libe/libevent libevent-2.1-7
46
47for d in *.deb; do dpkg-deb -x "$d" "$STAGE/x/"; done
48find "$STAGE/x" -name "*.so*" -exec cp -av {} "$STAGE/lib/" \; >/dev/null
49
50echo "Placing libs into WebKit's runtime dirs…"
51for d in minibrowser-wpe/lib minibrowser-wpe/sys/lib minibrowser-gtk/lib minibrowser-gtk/sys/lib; do
52 [ -d "$WKROOT/$d" ] && cp -f "$STAGE"/lib/*.so* "$WKROOT/$d/"
53done
54
55echo "Done. WebKit needs PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1 (verify_webkit.mjs sets it)."