# Conflicts: # .github/workflows/linux-appimage.yml # launcher-rust/src/core/settings.rs # launcher-rust/src/lib.rs # launcher-rust/src/startup.rs # launcher-rust/tests/startup.rs # packaging/linux/smoke-test.sh # packaging/windows/package.sh
3.4 KiB
SpartanPort launcher (Rust)
Rust rewrite of the Python/Tk launcher. src/core/ holds the launcher logic and never depends on the UI crate; src/ui/ holds the graphical front end.
Toolchain
Install Rust with rustup. rust-toolchain.toml pins the toolchain version; rustup downloads it on the first build.
- Windows: install Visual Studio Build Tools with the "Desktop development with C++" workload.
- Ubuntu:
sudo apt-get install build-essential pkg-config libwayland-dev libxkbcommon-dev - macOS: see below.
macOS
On macOS you can build and run the launcher, but not the game: main doesn't build the game's runtime for macOS yet, so PLAY doesn't start anything. Apple Silicon support is in progress in #798.
-
Install the Xcode Command Line Tools if they are missing:
xcode-select --install. -
Install Rust with rustup. Use the official installer rather than Homebrew's
rustup, which putscargooutside yourPATH:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shChoose the standard installation. It adds
~/.cargo/binto yourPATHthrough~/.zshenv. -
Open a new terminal and check that
cargois available:cargo --versionIf the command is not found, add
. "$HOME/.cargo/env"to~/.zshenvand open a new terminal. -
Build and run from the repository root. The first build downloads the pinned toolchain and takes a few minutes:
cd launcher-rust cargo build --release cd .. ./launcher-rust/target/release/spartanport-launchercargo run --releaseinlauncher-rust/builds and runs in one step.cargo cleanthere removes the build output (launcher-rust/target/).
Tests
cd launcher-rust
cargo test
The tests in tests/dump.rs need a real game folder (the patches of the real eboot.bin, the pause menu and the glyph WADs against the Python's) and return at once without one. Point SPARTAN_GAME_DIR at the dump to run them; the dump is only read:
cd launcher-rust
SPARTAN_GAME_DIR=<game folder> cargo test --test dump
On Windows PowerShell: $env:SPARTAN_GAME_DIR = "<game folder>"; cargo test --test dump. Drop --test dump to run the whole suite with the dump. These tests also run the Python scripts (the interpreter is set under Environment below) to compare their files with the Rust ones.
Environment
SPARTAN_RELEASE_TAG: read at build time, not at run time. The release tag the binary is (windows-v2.8.0-issue1-test2); without it the binary is the stable ofCargo.toml. The release workflows set it from their tag. Name test tags<system>-v<version>-<issue>-test<N>: the launcher offers the next build of the same series. A local test build:$env:SPARTAN_RELEASE_TAG = 'windows-v2.8.0-issue1-test2'; cargo build --release --locked(PowerShell) orSPARTAN_RELEASE_TAG=windows-v2.8.0-issue1-test2 cargo build --release --locked.SPARTAN_PORT_DIR: the port folder (withbin/) and, unlessSPARTAN_DATA_DIRis set, the data folder. Defaults to the executable's folder; point it at the repository root to run acargobuild.SPARTANPORT_PYTHON: the Python the dump tests compare against (the frozen Python launcher and runner). Defaults topy -3on Windows andpython3elsewhere. The exe itself never runs Python.