From 222345b5d127e040ed08abb68eff8f9dd1825b78 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 12 Oct 2026 18:58:25 +0200 Subject: [PATCH] Build Horizon on Windows and package playable folders The control socket reports itself unavailable on Windows, which has no Unix domain sockets, and horizon-ctl uses the same stream type. A release workflow builds the Windows client by hand; packaging/package.sh assembles the binary, the resource preparation tool and PLAY.txt, without any of Minecraft's files. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 24 +++++++++ crates/horizon-client/src/bin/horizon-ctl.rs | 3 +- crates/horizon-client/src/control.rs | 51 +++++++++++++++++++- packaging/PLAY.txt | 35 ++++++++++++++ packaging/package.sh | 13 +++++ 5 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 packaging/PLAY.txt create mode 100755 packaging/package.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6d78ef57e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: release builds +# Started by hand: gh workflow run release.yml --ref +# Builds the Windows x64 client and uploads the playable folder as an artifact. +# Linux and macOS builds are made on the development machines. +on: + workflow_dispatch: +permissions: + contents: read +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust toolchain + run: rustup toolchain install stable --profile minimal + - name: Build the client + run: cargo +stable build --release --locked -p horizon-client --bin horizon-client + - name: Package + shell: bash + run: packaging/package.sh target/release/horizon-client.exe dist/horizon-windows-x64 + - uses: actions/upload-artifact@v4 + with: + name: horizon-windows-x64 + path: dist/horizon-windows-x64 diff --git a/crates/horizon-client/src/bin/horizon-ctl.rs b/crates/horizon-client/src/bin/horizon-ctl.rs index ea807ef17..962a4885d 100644 --- a/crates/horizon-client/src/bin/horizon-ctl.rs +++ b/crates/horizon-client/src/bin/horizon-ctl.rs @@ -2,13 +2,14 @@ #![forbid(unsafe_code)] use std::{ io::{BufRead, BufReader, Write}, - os::unix::net::UnixStream, path::{Path, PathBuf}, process::{Command, ExitCode, Stdio}, thread, time::{Duration, Instant}, }; +use horizon_client::control::UnixStream; + const USAGE: &str = "usage: horizon-ctl [--socket PATH] COMMAND [ARGS...] Local commands: diff --git a/crates/horizon-client/src/control.rs b/crates/horizon-client/src/control.rs index eb8c6a619..880b88f5b 100644 --- a/crates/horizon-client/src/control.rs +++ b/crates/horizon-client/src/control.rs @@ -5,12 +5,61 @@ //! that depend on a later frame (screenshots, benchmarks) arrive when ready. use std::{ io::{BufRead, BufReader, Write}, - os::unix::net::{UnixListener, UnixStream}, path::{Path, PathBuf}, sync::mpsc, thread, }; +#[cfg(unix)] +pub use std::os::unix::net::{UnixListener, UnixStream}; +#[cfg(not(unix))] +pub use unsupported::{UnixListener, UnixStream}; + +/// Windows' standard library has no Unix domain sockets: there the control +/// socket reports itself unavailable and the game runs without it. +#[cfg(not(unix))] +mod unsupported { + use std::{io, path::Path}; + + fn unavailable() -> io::Error { + io::Error::new( + io::ErrorKind::Unsupported, + "the control socket needs Unix domain sockets (Linux or macOS)", + ) + } + pub struct UnixStream; + impl UnixStream { + pub fn connect>(_: P) -> io::Result { + Err(unavailable()) + } + pub fn try_clone(&self) -> io::Result { + Err(unavailable()) + } + } + impl io::Read for UnixStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Err(unavailable()) + } + } + impl io::Write for UnixStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Err(unavailable()) + } + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } + } + pub struct UnixListener; + impl UnixListener { + pub fn bind>(_: P) -> io::Result { + Err(unavailable()) + } + pub fn incoming(&self) -> std::iter::Empty> { + std::iter::empty() + } + } +} + /// One command line from a client, with the channel for its JSON reply. pub struct Request { pub line: String, diff --git a/packaging/PLAY.txt b/packaging/PLAY.txt new file mode 100644 index 000000000..45fedc50e --- /dev/null +++ b/packaging/PLAY.txt @@ -0,0 +1,35 @@ +Horizon: Minecraft Java Edition 26.3, rewritten in Rust +========================================================= + +Horizon is an unofficial fan project, not affiliated with, endorsed by or +connected to Mojang Studios or Microsoft. Minecraft is a trademark of Mojang +and Microsoft. This package contains none of Minecraft's code, textures or +sounds: you need your own copy of Minecraft Java Edition, and Horizon uses the +files from it. + +What you need + - Minecraft Java Edition, bought and installed with the official launcher, + with version 26.3 downloaded at least once (play it once from the launcher). + - Python 3.12 or newer. + - Java 25 (a JDK, e.g. Eclipse Temurin 25). + - A graphics driver with Vulkan (Linux, Windows) or any Apple Silicon Mac. + +First start (once, a few minutes) + 1. Open a terminal in this folder. + 2. Run: python3 tools/prepare_native_client.py --prepare + (on Windows: py tools\prepare_native_client.py --prepare) + It reads the game files from your own Minecraft installation and writes + the resources Horizon needs into .local/ in this folder. If your launcher + keeps the game elsewhere, add --minecraft-dir PATH. + +Play + Linux: ./horizon-client + macOS: ./horizon-client (first time: right-click > Open, or + xattr -d com.apple.quarantine horizon-client) + Windows: horizon-client.exe + Run it from this folder. horizon-client --help lists the options + (render distance, world, seed, joining a server...). + +Controls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl +sprint, left click break, right click place/use, 1-9 or scroll for the hotbar, +E inventory, Q drop, F1 hide the HUD, F3 debug, Esc pause. diff --git a/packaging/package.sh b/packaging/package.sh new file mode 100755 index 000000000..0cab07331 --- /dev/null +++ b/packaging/package.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# packaging/package.sh BINARY OUTDIR: a playable Horizon folder with the game +# binary, the resource preparation tool and what it compiles, and PLAY.txt. +# It holds none of Minecraft's files: players prepare those from their own copy. +set -euo pipefail +bin=$1 +out=$2 +repo=$(git -C "$(dirname "$0")" rev-parse --show-toplevel) +rm -rf "$out" +mkdir -p "$out" +git -C "$repo" archive HEAD tools mods/horizon/src/test/java research-lock.json LICENSE | tar -x -C "$out" +cp "$bin" "$out/" +cp "$repo/packaging/PLAY.txt" "$out/PLAY.txt"