2026-08-13 21:20:20 +10:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
# Build and install the source-built dependencies needed by the Casilda fork
|
|
|
|
|
# into ~/.local: libxkbcommon, wlroots, and gtk4. Idempotent: each step is
|
|
|
|
|
# skipped if the pinned version is already found in ~/.local.
|
|
|
|
|
#
|
|
|
|
|
# Requires a Debian/Ubuntu-family system (apt + multiarch libdir).
|
|
|
|
|
|
|
|
|
|
prefix="$HOME/.local"
|
|
|
|
|
src_dir="$HOME/src"
|
2026-08-13 22:52:53 +10:00
|
|
|
multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || cc -print-multiarch 2>/dev/null || echo x86_64-linux-gnu)"
|
2026-08-13 21:20:20 +10:00
|
|
|
pc_path="$prefix/lib/$multiarch/pkgconfig"
|
|
|
|
|
tmp_dir="/tmp/opencode"
|
|
|
|
|
|
|
|
|
|
xkbcommon_version="1.8.1"
|
|
|
|
|
wlroots_version="0.20.1"
|
|
|
|
|
gtk4_version="4.22.4"
|
|
|
|
|
|
|
|
|
|
xkbcommon_url="https://codeload.github.com/xkbcommon/libxkbcommon/tar.gz/refs/tags/xkbcommon-${xkbcommon_version}"
|
|
|
|
|
wlroots_url="https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/${wlroots_version}/wlroots-${wlroots_version}.tar.bz2"
|
|
|
|
|
gtk4_url="https://download.gnome.org/sources/gtk/4.22/gtk-${gtk4_version}.tar.xz"
|
|
|
|
|
|
|
|
|
|
export PKG_CONFIG_PATH="$pc_path${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
|
|
|
|
export LD_LIBRARY_PATH="$prefix/lib/$multiarch${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
|
|
|
|
export GI_TYPELIB_PATH="$prefix/lib/$multiarch/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
|
|
|
|
|
export GSETTINGS_SCHEMA_DIR="$prefix/share/glib-2.0/schemas"
|
|
|
|
|
|
|
|
|
|
mkdir -p "$prefix" "$src_dir" "$tmp_dir"
|
|
|
|
|
|
|
|
|
|
apt_packages="
|
2026-08-13 22:52:53 +10:00
|
|
|
meson ninja-build gcc pkg-config bison gperf sassc dpkg-dev gettext
|
2026-08-13 21:20:20 +10:00
|
|
|
libwayland-dev wayland-protocols libdrm-dev libgbm-dev libseat-dev
|
|
|
|
|
libinput-dev libpixman-1-dev libgles2-mesa-dev libegl1-mesa-dev libudev-dev
|
|
|
|
|
libdisplay-info-dev hwdata
|
2026-08-13 22:52:53 +10:00
|
|
|
libglib2.0-dev libpango1.0-dev libharfbuzz-dev libcairo2-dev libgraphene-1.0-dev libgdk-pixbuf-2.0-dev
|
2026-08-13 21:20:20 +10:00
|
|
|
libepoxy-dev libx11-dev libxcursor-dev libxdamage-dev libxfixes-dev libxi-dev
|
|
|
|
|
libxkbcommon-x11-dev libgirepository1.0-dev gobject-introspection
|
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
missing=""
|
|
|
|
|
for pkg in $apt_packages; do
|
|
|
|
|
if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "^install ok installed"; then
|
|
|
|
|
missing="$missing $pkg"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
|
echo "Installing missing packages:$missing"
|
|
|
|
|
sudo apt-get install -y $missing
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
download_and_extract() {
|
|
|
|
|
name="$1"
|
|
|
|
|
url="$2"
|
|
|
|
|
file="$3"
|
|
|
|
|
if [ -d "$src_dir/$name" ]; then
|
|
|
|
|
echo "Source $name already present at $src_dir/$name; skipping download"
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
echo "Downloading $file"
|
|
|
|
|
if ! curl -fsSL -o "$tmp_dir/$file" "$url"; then
|
|
|
|
|
echo "ERROR: failed to download $url" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "Extracting $file"
|
|
|
|
|
tar -xf "$tmp_dir/$file" -C "$src_dir"
|
|
|
|
|
rm -f "$tmp_dir/$file"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build_step() {
|
|
|
|
|
name="$1"
|
|
|
|
|
module="$2"
|
|
|
|
|
dir="$src_dir/$name"
|
|
|
|
|
if [ ! -d "$dir" ]; then
|
|
|
|
|
echo "ERROR: source dir $dir missing" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
if [ -d "$dir/build" ]; then
|
|
|
|
|
echo "Build dir $dir/build exists; reconfiguring"
|
|
|
|
|
meson setup --reconfigure "$dir/build" "$dir" --prefix "$prefix" ${3:-}
|
|
|
|
|
else
|
|
|
|
|
meson setup "$dir/build" "$dir" --prefix "$prefix" ${3:-}
|
|
|
|
|
fi
|
|
|
|
|
meson compile -C "$dir/build"
|
|
|
|
|
meson install -C "$dir/build"
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-13 22:52:53 +10:00
|
|
|
version_at_least() {
|
2026-08-13 21:20:20 +10:00
|
|
|
pkg="$1"
|
2026-08-13 22:52:53 +10:00
|
|
|
pkg-config --atleast-version="$2" "$pkg"
|
2026-08-13 21:20:20 +10:00
|
|
|
}
|
|
|
|
|
|
2026-08-13 22:52:53 +10:00
|
|
|
if version_at_least xkbcommon "$xkbcommon_version"; then
|
|
|
|
|
echo "xkbcommon >= $xkbcommon_version already installed; skipping"
|
2026-08-13 21:20:20 +10:00
|
|
|
else
|
2026-08-13 22:52:53 +10:00
|
|
|
download_and_extract "libxkbcommon-xkbcommon-${xkbcommon_version}" "$xkbcommon_url" "libxkbcommon-${xkbcommon_version}.tar.gz"
|
|
|
|
|
build_step "libxkbcommon-xkbcommon-${xkbcommon_version}" libxkbcommon \
|
2026-08-13 21:20:20 +10:00
|
|
|
"-Denable-tools=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-08-13 22:52:53 +10:00
|
|
|
if version_at_least wlroots-0.20 "$wlroots_version"; then
|
|
|
|
|
echo "wlroots >= $wlroots_version already installed; skipping"
|
2026-08-13 21:20:20 +10:00
|
|
|
else
|
|
|
|
|
download_and_extract "wlroots-${wlroots_version}" "$wlroots_url" "wlroots-${wlroots_version}.tar.bz2"
|
2026-08-13 22:52:53 +10:00
|
|
|
build_step "wlroots-${wlroots_version}" wlroots "-Dexamples=false -Dbackends= -Dsession=disabled"
|
2026-08-13 21:20:20 +10:00
|
|
|
fi
|
|
|
|
|
|
2026-08-13 22:52:53 +10:00
|
|
|
if version_at_least gtk4 "$gtk4_version"; then
|
|
|
|
|
echo "gtk4 >= $gtk4_version already installed; skipping"
|
2026-08-13 21:20:20 +10:00
|
|
|
else
|
|
|
|
|
download_and_extract "gtk-${gtk4_version}" "$gtk4_url" "gtk-${gtk4_version}.tar.xz"
|
|
|
|
|
build_step "gtk-${gtk4_version}" gtk \
|
|
|
|
|
"-Dbuild-tests=false -Dbuild-testsuite=false -Dbuild-examples=false -Dbuild-demos=false -Dmedia-gstreamer=disabled -Dcloudproviders=disabled -Dsysprof=disabled -Dtracker=disabled -Dprint-cups=disabled -Dvulkan=disabled -Dintrospection=enabled"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "All dependencies installed to $prefix"
|