Make scripts arch-aware; add bootstrap-deps.sh
Detect the multiarch libdir via cc instead of hardcoding x86_64-linux-gnu so run.sh and build-casilda.sh work on aarch64. build-casilda.sh now exports PKG_CONFIG_PATH/LD_LIBRARY_PATH/GI_TYPELIB_PATH to the ~/.local prefix so meson finds the source-built gtk4/wlroots. Add bootstrap-deps.sh to build those deps (xkbcommon 1.8.1, wlroots 0.20.1, gtk4 4.22.4) from source into ~/.local; idempotent and skips already-installed versions.
This commit is contained in:
parent
7a35873e60
commit
280c1d069b
3 changed files with 126 additions and 2 deletions
116
bootstrap-deps.sh
Executable file
116
bootstrap-deps.sh
Executable file
|
|
@ -0,0 +1,116 @@
|
|||
#!/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"
|
||||
multiarch="$(cc -print-multiarch 2>/dev/null || echo x86_64-linux-gnu)"
|
||||
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="
|
||||
meson ninja-build gcc pkg-config bison gperf sassc
|
||||
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
|
||||
libglib2.0-dev libpango1.0-dev libharfbuzz-dev libcairo2-dev libgraphene-1.0-dev
|
||||
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"
|
||||
}
|
||||
|
||||
version_in_prefix() {
|
||||
pkg="$1"
|
||||
pkg-config --exists "$pkg" && [ "$(pkg-config --modversion "$pkg")" = "$2" ]
|
||||
}
|
||||
|
||||
if version_in_prefix xkbcommon "$xkbcommon_version"; then
|
||||
echo "xkbcommon $xkbcommon_version already installed; skipping"
|
||||
else
|
||||
download_and_extract "libxkbcommon-${xkbcommon_version}" "$xkbcommon_url" "libxkbcommon-${xkbcommon_version}.tar.gz"
|
||||
build_step "libxkbcommon-${xkbcommon_version}" libxkbcommon \
|
||||
"-Denable-tools=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false"
|
||||
fi
|
||||
|
||||
if version_in_prefix wlroots-0.20 "$wlroots_version"; then
|
||||
echo "wlroots $wlroots_version already installed; skipping"
|
||||
else
|
||||
download_and_extract "wlroots-${wlroots_version}" "$wlroots_url" "wlroots-${wlroots_version}.tar.bz2"
|
||||
build_step "wlroots-${wlroots_version}" wlroots "-Dexamples=false"
|
||||
fi
|
||||
|
||||
if version_in_prefix gtk4 "$gtk4_version"; then
|
||||
echo "gtk4 $gtk4_version already installed; skipping"
|
||||
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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue