SwAS git · main
SwAS - app switcher for sway (SVG/PNG icons, themeable)
C 97.5% Markdown 1.6%git clone https://git.christianimmanuel.de/sway/SwAS.gitwget https://git.christianimmanuel.de/sway/SwAS/archive/SwAS.tar.gz..
README.md | 6 ++++-- build-portable.sh | 57 +++++++++++++++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 451e9b5..ca4b7e6 100644 --- a/README.md +++ b/README.md @@ -110,8 +110,10 @@ Docker or Podman): ./build-portable.sh # builds against ubuntu:22.04 (glibc 2.35) ./build-portable.sh 20.04 # older glibc 2.31 -> even wider compatibility ``` -The result runs on that Ubuntu release and anything newer. (There's still no -prebuilt binary in this repo on purpose — a portable build has to be pinned to a +The result runs on that Ubuntu release and anything newer. It pins a known-good SDL +release (`release-3.2.14`) and links it statically; override with +`SDL_TAG=release-3.2.30 ./build-portable.sh` if you want a newer one. (There's still +no prebuilt binary in this repo on purpose — a portable build has to be pinned to a specific glibc/toolchain, which is a choice best made on your end.) ### 4. Put it on your PATH diff --git a/build-portable.sh b/build-portable.sh index 1d7dff6..3a70cab 100644 --- a/build-portable.sh +++ b/build-portable.sh @@ -7,19 +7,26 @@ # anything newer — fixing "GLIBC_2.xx not found" errors you get when you build on # a bleeding-edge distro (Arch, Fedora rawhide, ...) and run on Ubuntu. # -# SDL3 is linked statically (no libSDL3.so needed on the target). SDL still loads -# the system's Wayland/X11 libraries at runtime via dlopen, which is why this is -# NOT a fully-static binary — that approach doesn't work for SDL. This one links -# only glibc dynamically, against an old-enough version. +# SDL3 is linked statically (no libSDL3.so needed on the target) and pinned to a +# known-good release. SDL still loads the system's Wayland/X11 libraries at runtime +# via dlopen, so this is NOT a fully-static binary — that approach doesn't work for +# SDL. It links only glibc dynamically, against an old-enough version. # # Requires Docker or Podman on the machine you run this from. # # Usage: -# ./build-portable.sh # build against ubuntu:22.04 -# ./build-portable.sh 20.04 # even older glibc (2.31), wider compatibility +# ./build-portable.sh # ubuntu:22.04, SDL release-3.2.14 +# ./build-portable.sh 20.04 # older glibc (2.31) -> wider compatibility +# SDL_TAG=release-3.2.30 ./build-portable.sh # a different SDL release +# +# Note: newer SDL releases sometimes add X11 checks (e.g. XTEST) that need extra +# -dev packages. If you bump SDL_TAG and configure fails on a missing package, +# add it to the apt line below (or install it and re-run). set -euo pipefail -TAG="${1:-22.04}" + +UBUNTU_TAG="${1:-22.04}" +SDL_TAG="${SDL_TAG:-release-3.2.14}" ENGINE="$(command -v docker || command -v podman || true)" if [ -z "$ENGINE" ]; then @@ -27,33 +34,37 @@ if [ -z "$ENGINE" ]; then exit 1 fi -echo ">> building appwheel inside ubuntu:$TAG (this compiles SDL3, give it a few minutes)" +echo ">> building appwheel in ubuntu:$UBUNTU_TAG against SDL $SDL_TAG" +echo ">> (this compiles SDL3 from source; give it a few minutes)" -"$ENGINE" run --rm -v "$PWD":/src -w /src "ubuntu:$TAG" bash -euc ' +"$ENGINE" run --rm -e SDL_TAG="$SDL_TAG" -v "$PWD":/src -w /src "ubuntu:$UBUNTU_TAG" bash -euc ' export DEBIAN_FRONTEND=noninteractive apt-get update -qq + # Complete dependency set for SDL 3.2.x video (X11 + Wayland + GL). No audio / + # input-device libs: we build SDL video-only below, so those arent needed. apt-get install -y --no-install-recommends \ build-essential git cmake pkg-config ca-certificates file \ - libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev \ - libxss-dev libxrender-dev libxinerama-dev \ - libwayland-dev wayland-protocols libxkbcommon-dev libgl1-mesa-dev libegl1-mesa-dev + libx11-dev libxext-dev libxcursor-dev libxi-dev libxfixes-dev libxrandr-dev \ + libxss-dev libxrender-dev libxinerama-dev libxkbcommon-dev \ + libwayland-dev wayland-protocols libgl1-mesa-dev libegl1-mesa-dev + + # Clone the pinned SDL into a container-local dir (not your mounted repo), so + # this never reuses a previous checkout and never clutters your project. + git clone --depth 1 --branch "$SDL_TAG" https://github.com/libsdl-org/SDL /tmp/SDL - if [ ! -d SDL ]; then - git clone --depth 1 https://github.com/libsdl-org/SDL - fi - # Video-only SDL: appwheel only uses SDL_INIT_VIDEO, so we switch off audio, - # input-device, and misc subsystems. That avoids pulling ALSA/PulseAudio/udev - # /dbus dev packages and keeps the dependency surface (and build) small. - cmake -S SDL -B SDL/build \ + # Video-only SDL: appwheel only uses SDL_INIT_VIDEO, so switch off audio, + # input-device and misc subsystems. Smaller build, fewer dependencies. + cmake -S /tmp/SDL -B /tmp/SDL/build \ -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON -DSDL_SHARED=OFF \ -DSDL_AUDIO=OFF -DSDL_JOYSTICK=OFF -DSDL_HAPTIC=OFF -DSDL_SENSOR=OFF \ -DSDL_CAMERA=OFF -DSDL_POWER=OFF -DSDL_DBUS=OFF -DSDL_IBUS=OFF \ -DSDL_TEST_LIBRARY=OFF -DSDL_EXAMPLES=OFF >/dev/null - cmake --build SDL/build -j"$(nproc)" - cmake --install SDL/build >/dev/null + cmake --build /tmp/SDL/build -j"$(nproc)" + cmake --install /tmp/SDL/build >/dev/null ldconfig export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH:-}" + # Build appwheel (in /src, your mounted repo) with SDL baked in. make static strip appwheel 2>/dev/null || true @@ -64,5 +75,5 @@ echo ">> building appwheel inside ubuntu:$TAG (this compiles SDL3, give it a few ' echo -echo ">> done. ./appwheel should now run on Ubuntu $TAG and newer (and other" -echo ">> distros whose glibc is at least that version)." +echo ">> done. ./appwheel should now run on Ubuntu $UBUNTU_TAG and newer" +echo ">> (and other distros whose glibc is at least that version)."