Initial commit: Citron Arch Linux Docker Builder

Added a batch script to build Citron using an Arch Linux-based Docker container.
The container mounts the current working directory to output the Citron AppImage.
Script created with the help of the Citron Wiki and members of the official Discord community.
Ready for further improvements and automation. 🚀
This commit is contained in:
azazelv5 2025-02-14 16:21:54 -06:00
commit b50273e3ce
6 changed files with 215 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.AppImage
*.Dockerfile

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
# Use Arch Linux as the base image
FROM archlinux:latest
# Install dependencies
RUN pacman -Syu --needed --noconfirm base-devel boost catch2 cmake ffmpeg fmt git glslang libzip lz4 \
mbedtls ninja nlohmann-json openssl opus qt5 sdl2 zlib zstd zip unzip qt6-base qt6-tools qt6-svg \
qt6-declarative qt6-webengine sdl3 qt6-multimedia clang qt6-wayland fuse2 rapidjson wget sdl3 dos2unix
# Set working directory
WORKDIR /root
# Copy the build script
COPY build-citron.sh /root/build-citron.sh
RUN chmod +x /root/build-citron.sh
# Convert any CRLF line endings to just LF
RUN dos2unix /root/build-citron.sh
# Set output directory as a volume
VOLUME ["/output"]
# Set default entrypoint
ENTRYPOINT ["/root/build-citron.sh"]

51
LICENSE Normal file
View file

@ -0,0 +1,51 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
### TERMS AND CONDITIONS
#### 0. Definitions
“This License” refers to version 3 of the GNU General Public License.
“The Program” refers to any copyrightable work licensed under this License.
“You” (or “your”) means an individual or entity exercising permissions granted by this License.
#### 1. Source Code
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
#### 2. Basic Permissions
All rights granted under this License are granted for the term of the copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under Article 11 of the WIPO treaty.
#### 4. Conveying Verbatim Copies
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish a copy of this License on each copy.
#### 5. Conveying Modified Source Versions
You may modify your copy or copies of the Program, and you may distribute such modifications under the terms of Section 4, provided that you also meet all of these conditions:
(a) The modified work must carry prominent notices stating that you have changed the files and the date of any change.
(b) You must license the entire work, as a whole, under this License.
#### 6. Disclaimer of Warranty
There is no warranty for the Program, to the extent permitted by applicable law. Except when otherwise stated in writing, the copyright holders and/or other parties provide the Program “as is” without warranty of any kind, either expressed or implied.
For the full license text, visit: https://www.gnu.org/licenses/gpl-3.0.html

79
build-citron.sh Normal file
View file

@ -0,0 +1,79 @@
#!/bin/bash
set -e # Exit on error
# ============================================
# Citron Build Script for Docker with WSL
# ============================================
# This script:
# - Clones or updates the Citron repository
# - Checks out a specific version (default: master)
# - Builds Citron using CMake and Ninja
# - Creates an AppImage package
# - Saves the output to /output
#
# Usage:
# - Default version (latest master): `docker run --rm -v ${PWD}:/output citron-builder`
# - Specific version: `docker run --rm -e CITRON_VERSION=v0.4-canary-refresh -v ${PWD}:/output citron-builder`
# ============================================
# Set the Citron version (default to 'master' if not provided)
CITRON_VERSION=${CITRON_VERSION:-master}
echo "🛠️ Building Citron (Version: ${CITRON_VERSION})"
# Clone or update Citron repo
if [ -d "/root/Citron" ]; then
echo "🔄 Updating Citron repository..."
cd /root/Citron
git fetch --all
git reset --hard origin/master # Ensure a clean state
git checkout ${CITRON_VERSION} || git checkout tags/${CITRON_VERSION}
git pull
else
echo "📥 Cloning Citron repository..."
git clone --recursive https://git.citron-emu.org/Citron/Citron.git /root/Citron
cd /root/Citron
git checkout ${CITRON_VERSION} || git checkout tags/${CITRON_VERSION}
fi
# Build Citron
mkdir -p /root/Citron/build
cd /root/Citron/build
cmake .. -GNinja -DCITRON_USE_BUNDLED_VCPKG=ON -DCITRON_TESTS=OFF -DCITRON_USE_LLVM_DEMANGLE=OFF \
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_FLAGS="-march=native -mtune=native" \
-DCMAKE_C_FLAGS="-march=native -mtune=native" -DUSE_DISCORD_PRESENCE=ON -DBUNDLE_SPEEX=ON
ninja
sudo ninja install
# Build the AppImage
cd /root/Citron
sudo /root/Citron/appimage-builder.sh citron /root/Citron/build
# Prepare AppImage deployment
cd /root/Citron/build/deploy-linux
sudo cp /usr/lib/libSDL3.so* /root/Citron/build/deploy-linux/AppDir/usr/lib/
sudo 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
# Set output file name
if [[ "$CITRON_VERSION" == "master" ]]; then
OUTPUT_NAME="citron-nightly.AppImage"
else
OUTPUT_NAME="citron-${CITRON_VERSION}.AppImage"
fi
# Move the most recently created AppImage to a shared output folder
mkdir -p /output
APPIMAGE_PATH=$(ls -t /root/Citron/build/deploy-linux/*.AppImage 2>/dev/null | head -n 1)
if [[ -n "$APPIMAGE_PATH" ]]; then
mv -f "$APPIMAGE_PATH" "/output/${OUTPUT_NAME}"
echo "✅ Build complete! The AppImage is located in /output/${OUTPUT_NAME}"
else
echo "❌ Error: No .AppImage file found in /root/Citron/build/deploy-linux/"
exit 1
fi

42
readme.md Normal file
View file

@ -0,0 +1,42 @@
# Citron Arch Linux Docker Builder
This repository contains a script to build Citron using an Arch Linux Docker container. It automates the process of setting up a clean environment and generating a Citron AppImage for Arch Linux / Steam OS / Steam Deck.
## Features
- Uses Docker to provide a consistent build environment
- Automatically removes old Docker images to prevent duplication
- Outputs a Citron AppImage in the current working directory
## Requirements
- [Docker](https://docs.docker.com/desktop/setup/install/windows-install/) installed on your system
- Windows (for the provided batch script) or a manual setup for Linux/macOS
## Usage
1. Clone this repository:
```sh
git clone https://github.com/azazelv5/citron-arch-builder.git
cd citron-arch-builder
```
2. Run the batch script:
```sh
start_build_windows_wsl.bat
```
3. The Citron AppImage will be created in the current directory.
### Examples
Modify the batch file accordingly:
- Default version (latest master):
```sh
docker run --rm -v ${PWD}:/output citron-builder
```
- Specific version:
```sh
docker run --rm -e CITRON_VERSION=v0.4-canary-refresh -v ${PWD}:/output citron-builder
```
## Credits
This script was created with the help of the [Citron Wiki](https://git.citron-emu.org/Citron/Citron/wiki/?action=_pages) and members of the [Citron Discord](https://discord.gg/VcSDxrBYUJ) community.
## License
This project is licensed under the GNU GENERAL PUBLIC LICENSE. See the LICENSE file for details.

View file

@ -0,0 +1,18 @@
@echo off
:: Check if the Docker image exists
FOR /F "tokens=* USEBACKQ" %%i IN (`docker images -q citron-builder`) DO SET IMAGE_EXISTS=%%i
IF NOT "%IMAGE_EXISTS%"=="" (
echo Removing existing citron-builder image...
docker rmi -f citron-builder
)
:: Build the new image
docker build -t citron-builder .
:: Run the container and create the AppImage
@REM docker run --rm -e CITRON_VERSION=v0.4-canary-refresh -v %CD%:/output citron-builder
docker run --rm -v %CD%:/output citron-builder
echo Citron AppImage created in %CD%!
pause