# bottles-bin - prebuilt package of https://github.com/bottlesdevs/Bottles # (GTK4 + LibAdwaita wine/proton prefix manager written in Python). # # Upstream only supports Flatpak officially and publishes no usable binary # assets, so build_artifact() builds from the release tarball, carrying the # same de-flatpak patch the AUR source package uses (upstream's meson refuses # to configure outside a Flatpak sandbox and the code hard-requires the # portal). UPSTREAM_REPO="bottlesdevs/Bottles" # fvs-lab/fvs2 (+ its core library) is AUR-only, so the binary is built here # and bundled under /usr/lib/bottles. Versions pinned to the combination the # AUR fvs2 package ships; bump on new fvs2 releases. FVS2_VERSION=0.8.1 FVS2_CORE_VERSION=0.1.1 # Installed in CI (pacman) before build_artifact runs. blueprint-compiler # resolves Gtk/Adw/GtkSource imports via their typelibs, hence the GUI libs. BUILD_DEPS=(meson ninja blueprint-compiler gobject-introspection desktop-file-utils appstream-glib gettext glib2-devel python python-gobject gtk4 libadwaita gtksourceview5 libportal-gtk4 go python-pip) latest_version() { gh api "repos/$UPSTREAM_REPO/releases/latest" --jq '.tag_name' | sed 's/^v//' } # build_artifact build_artifact() { local ver="$1" outfile="$2" local pkgdir workdir destdir srctree pkgdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" workdir="$(mktemp -d)" destdir="$(mktemp -d)" curl -sfL "https://github.com/$UPSTREAM_REPO/archive/refs/tags/$ver.tar.gz" | tar -xz -C "$workdir" srctree="$workdir/Bottles-$ver" patch -d "$srctree" -p1 < "$pkgdir/remove-flatpak-checks.patch" # the bundled fvs2 lives outside $PATH; point Bottles at it grep -q 'return "fvs2"' "$srctree/bottles/fvs/repo.py" \ || { echo "fvs2 path hook not found in bottles/fvs/repo.py" >&2; return 1; } sed -i 's|return "fvs2"|return "/usr/lib/bottles/fvs2"|' "$srctree/bottles/fvs/repo.py" meson setup "$workdir/build" "$srctree" --prefix=/usr --buildtype=release meson install -C "$workdir/build" --destdir "$destdir" # Build the fvs2 CLI (Go) and bundle it. Its "core" library is a sibling # repository that go.mod expects next to the source tree. mkdir -p "$workdir/fvs" "$destdir/usr/lib/bottles" curl -sfL "https://github.com/fvs-lab/fvs2/archive/refs/tags/v$FVS2_VERSION.tar.gz" | tar -xz -C "$workdir/fvs" curl -sfL "https://github.com/fvs-lab/core/archive/refs/tags/v$FVS2_CORE_VERSION.tar.gz" | tar -xz -C "$workdir/fvs" ln -s "core-$FVS2_CORE_VERSION" "$workdir/fvs/core" (cd "$workdir/fvs/fvs2-$FVS2_VERSION" && \ GOPATH="$workdir/gopath" \ GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" \ go build -o "$destdir/usr/lib/bottles/fvs2" ./cmd/fvs2) # patool, pathvalidate and vkbasalt-cli are AUR-only pure-python libs; # bundle them into the app's module dir, which the launcher puts on # sys.path. patool/pathvalidate pinned via upstream's requirements.txt. grep -E '^(patool|pathvalidate)==' "$srctree/requirements.txt" > "$workdir/bundle-reqs.txt" [[ "$(wc -l < "$workdir/bundle-reqs.txt")" -eq 2 ]] || { echo "expected patool+pathvalidate pins in requirements.txt" >&2; return 1; } echo 'vkbasalt-cli' >> "$workdir/bundle-reqs.txt" python -m pip install --isolated --no-deps --target "$destdir/usr/share/bottles" \ -r "$workdir/bundle-reqs.txt" rm -rf "$destdir/usr/share/bottles/bin" # These caches are generated by pacman hooks; shipping them would cause # file conflicts on install. rm -f "$destdir/usr/share/glib-2.0/schemas/gschemas.compiled" \ "$destdir/usr/share/applications/mimeinfo.cache" \ "$destdir/usr/share/icons/hicolor/icon-theme.cache" tar --zstd --sort=name --owner=0 --group=0 --numeric-owner --mtime='@0' \ -cf "$outfile" -C "$destdir" usr rm -rf "$workdir" "$destdir" }