Files
xtool-mirror/Linux/build.sh
Kabir Oberai 1f28a80a13 build: compile xtool with Swift 6.4 (#272)
## What does this PR do?

Updates workflows to build with Swift 6.4. Blockers:

- [x] ~~GitHub's macos-26 runners don't yet support Xcode 27~~ They've
moved to a new nomenclature where the runner tracks the Xcode major
version. The new runner is `xcode-27`.
- [x] ~~Linux AppImage builds are failing due to
https://github.com/swiftlang/swift-build/issues/1764 (will be fixed in
6.4.1)~~ Switched to dynamic linking

## How was it tested?

- [x] Built locally with Xcode 27 and confirmed it runs
- [x] Built locally with `swift:6.4.0` docker image and confirmed it
runs

## AI tool usage

How much of this PR was AI-assisted? (check one)

- [x] **0** - No AI was used to write code
- [ ] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only

<!-- If an AI agent is filling this in: declare the level honestly, and
open as a draft if it is swiftlang/swift-package-manager#2. Do not lower
the declared level to get the PR reviewed. -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Build & Release**
  * macOS and iOS builds and macOS releases now use Xcode 27.
* Swift has been updated to version 6.4.0 for Docker and Netlify builds.

* **Bug Fixes**
* Linux packaging no longer copies `.resources` files into the AppDir,
which may affect packaged app resources.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-04 16:53:13 -04:00

58 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
set -e
shopt -s nullglob
cd "$(dirname "$0")"
if ! command -v fusermount &>/dev/null; then
# Docker doesn't support FUSE
export APPIMAGE_EXTRACT_AND_RUN=1
fi
rm -rf staging/tmp
mkdir -p staging/tmp staging/linuxdeploy
swift build --package-path .. -c release --product xtool
bin="$(swift build --package-path .. -c release --show-bin-path)"
strip "${bin}/xtool"
curr_git_info="$(curl -fsSL https://api.github.com/repos/linuxdeploy/linuxdeploy/git/refs/tags/continuous)"
curr_arch="$(uname -m)"
if [[ -f staging/linuxdeploy/git.json ]]; then
if ! cmp -s staging/linuxdeploy/git.json <(echo "$curr_git_info"); then
echo "[info] Updating linuxdeploy"
rm -rf staging/linuxdeploy/linuxdeploy.AppImage
fi
else
echo "[info] Downloading linuxdeploy"
rm -rf staging/linuxdeploy/linuxdeploy.AppImage
fi
if [[ ! -f staging/linuxdeploy/linuxdeploy.AppImage ]]; then
curl -fsSL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${curr_arch}.AppImage" \
-o staging/linuxdeploy/linuxdeploy.AppImage
chmod +x staging/linuxdeploy/linuxdeploy.AppImage
echo "$curr_git_info" > staging/linuxdeploy/git.json
fi
mkdir -p staging/tmp/AppDir/usr/bin
find "${bin}"/ -name '*.resources' -or -name '*.bundle' -print0 | xargs -0 -I {} cp -a {} "${PWD}/staging/tmp/AppDir/usr/bin/"
export LINUXDEPLOY_OUTPUT_VERSION="${XTOOL_VERSION:-unversioned}"
export LDAI_OUTPUT="staging/tmp/xtool-${curr_arch}.AppImage"
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|xtool-org|xtool|latest|xtool-${curr_arch}.AppImage.zsync"
./staging/linuxdeploy/linuxdeploy.AppImage \
--appdir staging/tmp/AppDir \
--output appimage \
-e "${bin}/xtool" \
-d xtool.desktop \
-i xtool.png
mkdir -p packages
mv -f "staging/tmp/xtool-${curr_arch}.AppImage" "./xtool-${curr_arch}.AppImage.zsync" packages/
rm -rf staging/tmp
echo "[info] Success!"