From 7cfafb7663d56478f5f94f5b718aefe52b5916b9 Mon Sep 17 00:00:00 2001 From: sebi Date: Fri, 9 Jan 2026 17:22:48 -0500 Subject: [PATCH 1/4] docs: Add Linux build guide with convenience scripts Add comprehensive documentation for building on Linux: - SourceCode/Builds/build_on_linux.md: New guide covering: - Quick start with build-linux.sh and install-to-game.sh scripts - Prerequisites (Docker, Git, Wine) - Detailed script usage and options - Running the game under Wine - Troubleshooting common issues - Manual Docker commands for advanced users - SourceCode/Builds/build_guides.md: Add link to new Linux guide under Visual Studio 6 sub-guides section --- SourceCode/Builds/build_guides.md | 6 +- SourceCode/Builds/build_on_linux.md | 207 ++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 SourceCode/Builds/build_on_linux.md diff --git a/SourceCode/Builds/build_guides.md b/SourceCode/Builds/build_guides.md index ad894e9a..9bc6a6a5 100644 --- a/SourceCode/Builds/build_guides.md +++ b/SourceCode/Builds/build_guides.md @@ -60,7 +60,7 @@ environments. [Build with CMake & Visual Studio 6 (x86) (Windows)](build_with_msvc6) #### Sub-guides - + - **CLion & VC6 Toolchain** - A guide for using CLion with the Visual Studio 6 (VC6) toolchain for building the project. [Build with CLion & VC6 Toolchain](build_with_clion_vc6_toolchain) @@ -68,6 +68,10 @@ environments. - A guide for setting up Docker with the Visual Studio 6 (VC6) toolchain for building the project in a containerized environment. [Build with Docker & VC6](build_with_msvc6_on_docker) + - **Build on Linux** + - A guide for building the project on Linux using Docker with convenience scripts. + Includes instructions for installing built executables to an existing game. + [Build on Linux](build_on_linux) ### **Visual Studio 2022 Guides** diff --git a/SourceCode/Builds/build_on_linux.md b/SourceCode/Builds/build_on_linux.md new file mode 100644 index 00000000..ec6866ab --- /dev/null +++ b/SourceCode/Builds/build_on_linux.md @@ -0,0 +1,207 @@ +# Build Command & Conquer Generals on Linux + +This guide covers building Generals and Zero Hour on Linux using Docker. The build produces Windows executables that can run natively on Windows or under Wine on Linux. + +## Quick Start + +The repository includes convenience scripts that automate the Docker build process: + +```bash +# Clone the repository +git clone https://github.com/TheSuperHackers/GeneralsGameCode.git +cd GeneralsGameCode + +# Build using Docker (produces Windows executables) +./scripts/build-linux.sh + +# Install to your game (auto-detects Wine prefix) +./scripts/install-to-game.sh --detect +``` + +## Prerequisites + +- **Docker**: Install Docker Engine for your distribution + - [Debian/Ubuntu](https://docs.docker.com/engine/install/debian/) + - [Fedora](https://docs.docker.com/engine/install/fedora/) + - [Arch Linux](https://wiki.archlinux.org/title/Docker) +- **Git**: For cloning the repository +- **Wine** (optional): For running the built executables on Linux + +### Docker Setup + +Ensure Docker is running and your user has permission: + +```bash +# Start Docker daemon +sudo systemctl start docker + +# Add your user to the docker group (logout/login required) +sudo usermod -aG docker $USER +``` + +## Build Scripts + +### build-linux.sh + +The main build script that manages the Docker-based build process. + +```bash +# Full build (both Generals and Zero Hour) +./scripts/build-linux.sh + +# Build Zero Hour only +./scripts/build-linux.sh --game zh + +# Build Generals only +./scripts/build-linux.sh --game generals + +# Build specific target +./scripts/build-linux.sh --target generalszh + +# Clean build directory first +./scripts/build-linux.sh --clean + +# Force CMake reconfiguration +./scripts/build-linux.sh --cmake + +# Enter container shell for debugging +./scripts/build-linux.sh --interactive +``` + +Build outputs are placed in `build/docker/`: + +| Directory | Contents | +|-----------|----------| +| `build/docker/GeneralsMD/` | Zero Hour executables | +| `build/docker/Generals/` | Generals executables | +| `build/docker/Core/` | Shared DLLs | + +### install-to-game.sh + +Installs built executables to an existing game installation. + +```bash +# Auto-detect game location (checks Wine prefixes and common paths) +./scripts/install-to-game.sh --detect + +# Specify game directory manually +./scripts/install-to-game.sh ~/.wine/drive_c/Program\ Files/EA\ Games/Command\ and\ Conquer\ Generals\ Zero\ Hour + +# Install Generals instead of Zero Hour +./scripts/install-to-game.sh --game generals /path/to/game + +# Dry run (show what would be installed) +./scripts/install-to-game.sh --dry-run --detect + +# Restore original files from backups +./scripts/install-to-game.sh --restore /path/to/game +``` + +The script will: +1. Backup your original executables (`.exe.backup`) +2. Copy newly built executables +3. Copy new DLLs (DebugWindow.dll, ParticleEditor.dll) +4. Preserve original mss32.dll and binkw32.dll (audio/video libraries) + +## Running the Game + +After building and installing, run the game with Wine: + +```bash +# Zero Hour +wine ~/.wine/drive_c/Program\ Files/EA\ Games/Command\ and\ Conquer\ Generals\ Zero\ Hour/Data/generalszh.exe + +# Or from the build directory (requires game data files) +wine build/docker/GeneralsMD/generalszh.exe +``` + +### Wine Configuration + +For best results: + +```bash +# Use 32-bit Wine prefix +WINEARCH=win32 WINEPREFIX=~/.wine-generals winecfg + +# Set Windows version to Windows XP or Windows 7 +winecfg +``` + +## Troubleshooting + +### Docker Permission Denied + +``` +Got permission denied while trying to connect to the Docker daemon +``` + +Solution: Add your user to the docker group and re-login: +```bash +sudo usermod -aG docker $USER +# Then logout and login again +``` + +### Build Directory Not Found + +``` +Build directory not found: /path/to/GeneralsGameCode/build/docker +``` + +Solution: Run the build script first: +```bash +./scripts/build-linux.sh +``` + +### Game Not Found + +``` +No game installation found +``` + +Solution: Specify the game directory manually: +```bash +./scripts/install-to-game.sh /path/to/your/game/installation +``` + +### Wine Errors + +If the game crashes or has graphical issues: + +1. Try different Wine versions (wine-staging often works better for games) +2. Install required dependencies: `winetricks directx9 vcrun6` +3. Use DXVK for better DirectX performance: `winetricks dxvk` + +## Manual Docker Build + +If you prefer to run the Docker commands manually instead of using the scripts: + +```bash +# Build the Docker image +docker build \ + --build-arg UID=$(id -u) \ + --build-arg GID=$(id -g) \ + resources/dockerbuild \ + -t zerohour-build + +# Run the build +docker run \ + -u $(id -u):$(id -g) \ + -v $(pwd):/build/cnc \ + --rm \ + zerohour-build + +# Enter container for debugging +docker run \ + -u $(id -u):$(id -g) \ + -v $(pwd):/build/cnc \ + --rm \ + -it \ + --entrypoint bash \ + zerohour-build +``` + +## See Also + +- [Build with VC6 on Docker](build_with_msvc6_on_docker.md) - Manual Docker setup +- [Build Configuration](build_configuration.md) - CMake presets and options +- [Build Guides](build_guides.md) - All build guides From 765e519a133897b0c494e9b18137677a12f8b53f Mon Sep 17 00:00:00 2001 From: sebi Date: Sun, 11 Jan 2026 10:10:33 -0500 Subject: [PATCH 2/4] docs: Update Linux build guide for renamed Docker scripts - Update build-linux.sh references to docker-build.sh - Update install-to-game.sh references to docker-install.sh - Use quoted paths instead of escaped paths for readability Co-Authored-By: Claude Opus 4.5 --- SourceCode/Builds/build_on_linux.md | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/SourceCode/Builds/build_on_linux.md b/SourceCode/Builds/build_on_linux.md index ec6866ab..f2a7ee27 100644 --- a/SourceCode/Builds/build_on_linux.md +++ b/SourceCode/Builds/build_on_linux.md @@ -12,10 +12,10 @@ git clone https://github.com/TheSuperHackers/GeneralsGameCode.git cd GeneralsGameCode # Build using Docker (produces Windows executables) -./scripts/build-linux.sh +./scripts/docker-build.sh # Install to your game (auto-detects Wine prefix) -./scripts/install-to-game.sh --detect +./scripts/docker-install.sh --detect ``` ## Prerequisites @@ -41,31 +41,31 @@ sudo usermod -aG docker $USER ## Build Scripts -### build-linux.sh +### docker-build.sh The main build script that manages the Docker-based build process. ```bash # Full build (both Generals and Zero Hour) -./scripts/build-linux.sh +./scripts/docker-build.sh # Build Zero Hour only -./scripts/build-linux.sh --game zh +./scripts/docker-build.sh --game zh # Build Generals only -./scripts/build-linux.sh --game generals +./scripts/docker-build.sh --game generals # Build specific target -./scripts/build-linux.sh --target generalszh +./scripts/docker-build.sh --target generalszh # Clean build directory first -./scripts/build-linux.sh --clean +./scripts/docker-build.sh --clean # Force CMake reconfiguration -./scripts/build-linux.sh --cmake +./scripts/docker-build.sh --cmake # Enter container shell for debugging -./scripts/build-linux.sh --interactive +./scripts/docker-build.sh --interactive ``` Build outputs are placed in `build/docker/`: @@ -76,25 +76,25 @@ Build outputs are placed in `build/docker/`: | `build/docker/Generals/` | Generals executables | | `build/docker/Core/` | Shared DLLs | -### install-to-game.sh +### docker-install.sh Installs built executables to an existing game installation. ```bash # Auto-detect game location (checks Wine prefixes and common paths) -./scripts/install-to-game.sh --detect +./scripts/docker-install.sh --detect # Specify game directory manually -./scripts/install-to-game.sh ~/.wine/drive_c/Program\ Files/EA\ Games/Command\ and\ Conquer\ Generals\ Zero\ Hour +./scripts/docker-install.sh "$HOME/.wine/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour" # Install Generals instead of Zero Hour -./scripts/install-to-game.sh --game generals /path/to/game +./scripts/docker-install.sh --game generals /path/to/game # Dry run (show what would be installed) -./scripts/install-to-game.sh --dry-run --detect +./scripts/docker-install.sh --dry-run --detect # Restore original files from backups -./scripts/install-to-game.sh --restore /path/to/game +./scripts/docker-install.sh --restore /path/to/game ``` The script will: @@ -109,7 +109,7 @@ After building and installing, run the game with Wine: ```bash # Zero Hour -wine ~/.wine/drive_c/Program\ Files/EA\ Games/Command\ and\ Conquer\ Generals\ Zero\ Hour/Data/generalszh.exe +wine "$HOME/.wine/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour/Data/generalszh.exe" # Or from the build directory (requires game data files) wine build/docker/GeneralsMD/generalszh.exe @@ -149,7 +149,7 @@ Build directory not found: /path/to/GeneralsGameCode/build/docker Solution: Run the build script first: ```bash -./scripts/build-linux.sh +./scripts/docker-build.sh ``` ### Game Not Found @@ -160,7 +160,7 @@ No game installation found Solution: Specify the game directory manually: ```bash -./scripts/install-to-game.sh /path/to/your/game/installation +./scripts/docker-install.sh /path/to/your/game/installation ``` ### Wine Errors From 39fb71e8490a666e2eaa70f797a59cb40dc4bf1b Mon Sep 17 00:00:00 2001 From: sebi Date: Sat, 24 Jan 2026 10:10:47 -0500 Subject: [PATCH 3/4] docs: Simplify example paths in Linux build guide Address PR review feedback about overly verbose example paths. Replace long Wine prefix paths with simpler /path/to/game placeholders. Co-Authored-By: Claude Opus 4.5 --- SourceCode/Builds/build_on_linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SourceCode/Builds/build_on_linux.md b/SourceCode/Builds/build_on_linux.md index f2a7ee27..75d082ee 100644 --- a/SourceCode/Builds/build_on_linux.md +++ b/SourceCode/Builds/build_on_linux.md @@ -85,7 +85,7 @@ Installs built executables to an existing game installation. ./scripts/docker-install.sh --detect # Specify game directory manually -./scripts/docker-install.sh "$HOME/.wine/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour" +./scripts/docker-install.sh /path/to/game # Install Generals instead of Zero Hour ./scripts/docker-install.sh --game generals /path/to/game @@ -108,8 +108,8 @@ The script will: After building and installing, run the game with Wine: ```bash -# Zero Hour -wine "$HOME/.wine/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour/Data/generalszh.exe" +# Zero Hour (path depends on your installation) +wine /path/to/game/generalszh.exe # Or from the build directory (requires game data files) wine build/docker/GeneralsMD/generalszh.exe From 84eb7dce95213b1b4a8c1c82b6752dfb43a7f013 Mon Sep 17 00:00:00 2001 From: sebi Date: Thu, 19 Feb 2026 12:12:55 -0500 Subject: [PATCH 4/4] docs: Fix markdown linting issues in Linux build guide - Wrap long line in introduction - Fix table column spacing - Add blank lines around code blocks and lists - Add language specifier to error message code blocks Co-Authored-By: Claude Opus 4.5 --- SourceCode/Builds/build_on_linux.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/SourceCode/Builds/build_on_linux.md b/SourceCode/Builds/build_on_linux.md index 75d082ee..a0544a60 100644 --- a/SourceCode/Builds/build_on_linux.md +++ b/SourceCode/Builds/build_on_linux.md @@ -1,6 +1,7 @@ # Build Command & Conquer Generals on Linux -This guide covers building Generals and Zero Hour on Linux using Docker. The build produces Windows executables that can run natively on Windows or under Wine on Linux. +This guide covers building Generals and Zero Hour on Linux using Docker. The build produces Windows +executables that can run natively on Windows or under Wine on Linux. ## Quick Start @@ -70,11 +71,11 @@ The main build script that manages the Docker-based build process. Build outputs are placed in `build/docker/`: -| Directory | Contents | -|-----------|----------| -| `build/docker/GeneralsMD/` | Zero Hour executables | -| `build/docker/Generals/` | Generals executables | -| `build/docker/Core/` | Shared DLLs | +| Directory | Contents | +| --------------------------- | ---------------------- | +| `build/docker/GeneralsMD/` | Zero Hour executables | +| `build/docker/Generals/` | Generals executables | +| `build/docker/Core/` | Shared DLLs | ### docker-install.sh @@ -98,6 +99,7 @@ Installs built executables to an existing game installation. ``` The script will: + 1. Backup your original executables (`.exe.backup`) 2. Copy newly built executables 3. Copy new DLLs (DebugWindow.dll, ParticleEditor.dll) @@ -131,11 +133,12 @@ winecfg ### Docker Permission Denied -``` +```text Got permission denied while trying to connect to the Docker daemon ``` Solution: Add your user to the docker group and re-login: + ```bash sudo usermod -aG docker $USER # Then logout and login again @@ -143,22 +146,24 @@ sudo usermod -aG docker $USER ### Build Directory Not Found -``` +```text Build directory not found: /path/to/GeneralsGameCode/build/docker ``` Solution: Run the build script first: + ```bash ./scripts/docker-build.sh ``` ### Game Not Found -``` +```text No game installation found ``` Solution: Specify the game directory manually: + ```bash ./scripts/docker-install.sh /path/to/your/game/installation ```