From c1e1a4570de2ab7c3b1c00142adf3d7c8d4934bc Mon Sep 17 00:00:00 2001 From: Edward E Date: Sun, 7 Feb 2021 22:37:47 -0600 Subject: [PATCH] Add Windows/MSYS2 build instructions Also user scripts for running the produced executable --- INSTALL.markdown | 21 +++++++++++++++++++++ contrib/msys2/README.md | 7 +++++++ contrib/msys2/d1x-32bit.bat | 3 +++ contrib/msys2/d1x-64bit.bat | 3 +++ contrib/msys2/d2x-32bit.bat | 3 +++ contrib/msys2/d2x-64bit.bat | 3 +++ 6 files changed, 40 insertions(+) create mode 100644 contrib/msys2/README.md create mode 100644 contrib/msys2/d1x-32bit.bat create mode 100644 contrib/msys2/d1x-64bit.bat create mode 100644 contrib/msys2/d2x-32bit.bat create mode 100644 contrib/msys2/d2x-64bit.bat diff --git a/INSTALL.markdown b/INSTALL.markdown index 8d08cad6e..f4b00ca31 100644 --- a/INSTALL.markdown +++ b/INSTALL.markdown @@ -69,6 +69,9 @@ previous Rebirth release and installing current PhysFS headers. However, building from source is recommended to ensure a consistent environment. +#### MSYS2/mingw-w64 (Windows alternate method) +* `pacman -S git ${MINGW_PACKAGE_PREFIX}-{gcc,pkgconf,scons,SDL,SDL_image,SDL_mixer,libpng,physfs}` + #### Linux Install the listed prerequisites through your system package manager. * Arch PKGBUILD files are in `contrib/arch/` @@ -208,6 +211,24 @@ Linux output with **program\_name** unset: * *build-directory*/d1x-rebirth/d1x-rebirth*[-editor]* * *build-directory*/d2x-rebirth/d2x-rebirth*[-editor]* +##### Compiling with MSYS2 +MSYS2 offers its users three terminal environments: msys2, for building with POSIX compatibility (linking to runtime `/usr/bin/msys-2.0.dll`); and mingw32 and mingw64, for building portable native Windows apps (linking to `C:\WINDOWS\System32\msvcrt.dll`), on i686 and x86_64 respectively. +* Install [MSYS2](https://www.msys2.org), following the directions on the main page. +* In either a mingw32 or mingw64 (not msys2) terminal: + + pacman -Syuu # update MSYS2, as needed + pacman -S --needed git ${MINGW_PACKAGE_PREFIX}-{gcc,pkgconf,scons,SDL,SDL_image,SDL_mixer,libpng,physfs} + # ^ substitute SDL2 for SDL if desired + git clone https://github.com/dxx-rebirth/dxx-rebirth.git + cd dxx-rebirth + scons + # Or (for example) to build d1x only, with SDL 2, with lower process priority, on all cores: + time nice scons -j$(nproc) sdl2=1 d1x=1 + +* A locally built executable will run anywhere if it's invoked from inside the appropriate mingw32 or mingw64 terminal. To run it instead directly in Windows, either: + 1. The linked mingw-w64 libraries will need to be added to PATH (See [contrib/msys2](contrib/msys2) for working example batch files); or + 2. Dependency DLLs from MSYS2 will need to be copied to the same directory as the executable. + #### Installing For Windows and Linux, DXX-Rebirth installs only the main game binary. The binary can be run from anywhere and can be installed by copying the game binary. The game does not inspect the name of its binary. You may rename the output after compilation without affecting the game. diff --git a/contrib/msys2/README.md b/contrib/msys2/README.md new file mode 100644 index 000000000..743d32b7c --- /dev/null +++ b/contrib/msys2/README.md @@ -0,0 +1,7 @@ +### MSYS2 example batch files + +These scripts add the mingw-w64 DLL directory to `PATH`, then run a locally built copy of Descent. They assume MSYS2 is installed at its default location `C:\msys64`, along with dxx-rebirth's dependencies; see the [MSYS2 build instructions](../../INSTALL.markdown#compiling-with-msys2). + +How to use: +* Copy the appropriate batch file to the same directory as the executable you just built. For example, put `d2x-64bit.bat` along with your 64-bit build of `d2x-rebirth.exe` in the Descent 2 data directory. +* Run the batch file. diff --git a/contrib/msys2/d1x-32bit.bat b/contrib/msys2/d1x-32bit.bat new file mode 100644 index 000000000..03298c08a --- /dev/null +++ b/contrib/msys2/d1x-32bit.bat @@ -0,0 +1,3 @@ +@ECHO OFF +PATH=C:\msys64\mingw32\bin;%PATH% +d1x-rebirth.exe diff --git a/contrib/msys2/d1x-64bit.bat b/contrib/msys2/d1x-64bit.bat new file mode 100644 index 000000000..98be4c839 --- /dev/null +++ b/contrib/msys2/d1x-64bit.bat @@ -0,0 +1,3 @@ +@ECHO OFF +PATH=C:\msys64\mingw64\bin;%PATH% +d1x-rebirth.exe diff --git a/contrib/msys2/d2x-32bit.bat b/contrib/msys2/d2x-32bit.bat new file mode 100644 index 000000000..11786cb3f --- /dev/null +++ b/contrib/msys2/d2x-32bit.bat @@ -0,0 +1,3 @@ +@ECHO OFF +PATH=C:\msys64\mingw32\bin;%PATH% +d2x-rebirth.exe diff --git a/contrib/msys2/d2x-64bit.bat b/contrib/msys2/d2x-64bit.bat new file mode 100644 index 000000000..8a12750c3 --- /dev/null +++ b/contrib/msys2/d2x-64bit.bat @@ -0,0 +1,3 @@ +@ECHO OFF +PATH=C:\msys64\mingw64\bin;%PATH% +d2x-rebirth.exe