86 lines
2.4 KiB
Bash
86 lines
2.4 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
# Builds a nightly AppImage of citron.
|
||
|
|
||
|
set -euo pipefail
|
||
|
|
||
|
# CITRON_REPO is the repository to download Citron from.
|
||
|
CITRON_REPO="${CITRON_REPO:-"https://git.rgst.io/mirrors/Citron.git"}"
|
||
|
|
||
|
# OUTPUT_DIR is the directory to output built artifacts to.
|
||
|
OUTPUT_DIR="$(pwd)/builds"
|
||
|
WORKING_DIR="/src/citron-nightly"
|
||
|
|
||
|
# Default flags for building Citron. We optimize for steamdeck only,
|
||
|
# currently.
|
||
|
WARNING_FLAGS="-Werror=lto-type-mismatch -Werror=strict-aliasing"
|
||
|
COMMON_FLAGS="-O2 -march=znver2 -mtune=znver2 -flto ${WARNING_FLAGS}"
|
||
|
CXX_FLAGS="${COMMON_FLAGS} -Wno-error"
|
||
|
C_FLAGS="${COMMON_FLAGS}"
|
||
|
|
||
|
mkdir -p "$WORKING_DIR" "$OUTPUT_DIR"
|
||
|
|
||
|
pushd "$WORKING_DIR" >/dev/null
|
||
|
# Clone the repo or update it if its already present
|
||
|
if [[ ! -e "Citron" ]]; then
|
||
|
git clone --recursive "$CITRON_REPO" "Citron"
|
||
|
else
|
||
|
pushd "Citron" >/dev/null
|
||
|
git pull
|
||
|
popd >/dev/null
|
||
|
fi
|
||
|
|
||
|
pushd "Citron" >/dev/null
|
||
|
|
||
|
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
|
||
|
RELEASE_NAME="nightly-steamdeck-$GIT_COMMIT_HASH"
|
||
|
OUTPUT_NAME="citron-$RELEASE_NAME.AppImage"
|
||
|
|
||
|
# Build citron
|
||
|
mkdir -p ./build
|
||
|
pushd "./build" >/dev/null
|
||
|
rm -rf deploy-linux
|
||
|
cmake .. -GNinja \
|
||
|
-DCITRON_ENABLE_LTO=ON \
|
||
|
-DCITRON_USE_BUNDLED_VCPKG=ON \
|
||
|
-DCITRON_TESTS=OFF \
|
||
|
-DCITRON_USE_LLVM_DEMANGLE=OFF \
|
||
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||
|
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||
|
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||
|
-DUSE_DISCORD_PRESENCE=OFF \
|
||
|
-DBUNDLE_SPEEX=ON \
|
||
|
-DCMAKE_BUILD_TYPE=Release
|
||
|
|
||
|
ninja
|
||
|
ninja install
|
||
|
popd >/dev/null
|
||
|
|
||
|
# Package it
|
||
|
|
||
|
./appimage-builder.sh citron "$(pwd)/build"
|
||
|
|
||
|
# Include required libraries
|
||
|
pushd "./build/deploy-linux" >/dev/null
|
||
|
cp /usr/lib/libSDL3.so* AppDir/usr/lib/
|
||
|
wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
||
|
chmod +x appimagetool-x86_64.AppImage
|
||
|
# Workaround for lack of FUSE support in WSL
|
||
|
./appimagetool-x86_64.AppImage --appimage-extract
|
||
|
chmod +x ./squashfs-root/AppRun
|
||
|
./squashfs-root/AppRun AppDir
|
||
|
popd >/dev/null
|
||
|
|
||
|
# Move the most recently created AppImage to a fresh output folder
|
||
|
APPIMAGE_PATH=$(ls -t ${WORKING_DIR}/Citron/build/deploy-linux/*.AppImage 2>/dev/null | head -n 1)
|
||
|
|
||
|
if [[ -n "$APPIMAGE_PATH" ]]; then
|
||
|
mv -f "$APPIMAGE_PATH" "${OUTPUT_DIR}/${OUTPUT_NAME}"
|
||
|
echo "✅ Build complete! The AppImage is located in ${OUTPUT_DIR}/${OUTPUT_NAME}"
|
||
|
else
|
||
|
echo "❌ Error: No .AppImage file found in $(pwd)/build/deploy-linux/"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
popd >/dev/null
|
||
|
popd >/dev/null
|