Browse Source

Simplifying MinGW instructions (#8154)

pull/8157/head
Trihedraf 7 months ago committed by GitHub
parent
commit
82fbeca6ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      .github/workflows/Windows_MinGW_x64.yml
  2. 1
      .github/workflows/Windows_MinGW_x86.yml
  3. 3
      Packaging/windows/mingw-prep.sh
  4. 76
      docs/building.md

1
.github/workflows/Windows_MinGW_x64.yml

@ -30,7 +30,6 @@ jobs:
run: >
sudo apt-get update &&
sudo apt-get install -y cmake gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 pkg-config-mingw-w64-x86-64 libz-mingw-w64-dev gettext dpkg-dev wget git sudo smpq &&
sudo rm /usr/x86_64-w64-mingw32/lib/libz.dll.a &&
sudo Packaging/windows/mingw-prep64.sh
- name: Configure CMake

1
.github/workflows/Windows_MinGW_x86.yml

@ -30,7 +30,6 @@ jobs:
run: >
sudo apt update &&
sudo apt install -y cmake gcc-mingw-w64-i686 g++-mingw-w64-i686 pkg-config-mingw-w64-i686 libz-mingw-w64-dev gettext dpkg-dev wget git sudo smpq &&
sudo rm /usr/i686-w64-mingw32/lib/libz.dll.a &&
sudo Packaging/windows/mingw-prep.sh
- name: Configure CMake

3
Packaging/windows/mingw-prep.sh

@ -51,3 +51,6 @@ find "${MINGW_PREFIX}/lib/pkgconfig/" -name '*.pc' -exec \
# Fixup CMake prefix:
find "${MINGW_PREFIX}" -name '*.cmake' -exec \
$SUDO sed -i "s|/opt/local/${MINGW_ARCH}|${MINGW_PREFIX}|" '{}' \;
# Fixup zlib linking:
$SUDO mv "${MINGW_PREFIX}/lib/libz.dll.a" "${MINGW_PREFIX}/lib/libz.dll.a.bak"

76
docs/building.md

@ -167,57 +167,47 @@ You can launch WSL anytime by typing wsl or ubuntu in a Command Prompt or Powers
In a WSL terminal run these commands to get the source code for DevilutionX
```
sudo apt install git
sudo apt-get install git
git clone https://github.com/diasurgical/devilutionx
cd devilutionx
```
</details>
### Installing dependencies on WSL, Debian and Ubuntu
### 32-bit
In addition to the 32-bit MinGW build tools, the build process depends on the 32-bit MinGW Development Libraries for [SDL2](https://www.libsdl.org/download-2.0.php) and [libsodium](https://github.com/jedisct1/libsodium/releases) as well as headers for [zlib](https://zlib.net/zlib-1.2.12.tar.gz). These dependencies will need to be placed in the appropriate subfolders under `/usr/i686-w64-mingw32`. This can be done automatically by running [`Packaging/windows/mingw-prep.sh`](/Packaging/windows/mingw-prep.sh).
#### MinGW build tools
```bash
# Install the 32-bit MinGW build tools
sudo apt install cmake gcc-mingw-w64-i686 g++-mingw-w64-i686 pkg-config-mingw-w64-i686 libz-mingw-w64-dev git wget
# Download the 32-bit development libraries for SDL2 and libsodium
# as well as the headers for zlib and place them in subfolders under
# /usr/i686-w64-mingw32
Packaging/windows/mingw-prep.sh
# Install MinGW build tools
sudo apt-get update
sudo apt-get install cmake git libz-mingw-w64-dev mingw-w64 mingw-w64-tools smpq wget
```
### 64-bit
<details><summary>MinGW 32-bit</summary>
In addition to the 64-bit MinGW build tools, the build process depends on the 64-bit MinGW Development Libraries of [SDL2](https://www.libsdl.org/download-2.0.php) and [libsodium](https://github.com/jedisct1/libsodium/releases) as well as headers for [zlib](https://zlib.net/zlib-1.2.12.tar.gz). These dependencies will need to be placed in the appropriate subfolders under `/usr/x86_64-w64-mingw32`. This can be done automatically by running [`Packaging/windows/mingw-prep64.sh`](/Packaging/windows/mingw-prep64.sh).
The 32-bit build depends on the 32-bit MinGW Development Libraries for [SDL2](https://www.libsdl.org/download-2.0.php) and [libsodium](https://github.com/jedisct1/libsodium/releases) as well as headers for [zlib](https://zlib.net/zlib-1.2.12.tar.gz). These dependencies will need to be placed in the appropriate subfolders under `/usr/i686-w64-mingw32`.
```bash
# Install the 64-bit MinGW build tools
sudo apt install cmake gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 pkg-config-mingw-w64-x86-64 libz-mingw-w64-dev git wget
# Download the 64-bit development libraries for SDL2 and libsodium
# as well as the headers for zlib and place them in subfolders under
# /usr/x86_64-w64-mingw32
Packaging/windows/mingw-prep64.sh
```
When linking zlib, libpng will always prefer dynamically linking with `libz.dll.a` if it can be found. We recommend renaming or deleting `libz.dll.a` to force libpng to use static linkage. This will prevent errors about missing dlls when you attempt to run the game.
### Before compiling
These can be done automatically by running [`Packaging/windows/mingw-prep.sh`](/Packaging/windows/mingw-prep.sh).
When linking zlib, libpng will always prefer dynamically linking with `libz.dll.a` if it can be found. We recommend renaming or deleting `libz.dll.a` to force libpng to use static linkage. This will prevent errors about missing dlls when you attempt to run the game.
Note: If your `i686-w64-mingw32` directory is not in `/usr` (e.g. when on
Debian), the mingw-prep scripts and the CMake command won't work. You need
adjust the mingw-prep scripts and pass `-DCROSS_PREFIX=/path` to CMake to set
the path to the parent of the `i686-w64-mingw32` directory.
```bash
sudo mv /usr/i686-w64-mingw32/lib/libz.dll.a /usr/i686-w64-mingw32/lib/libz.dll.a.bak
sudo mv /usr/x86_64-w64-mingw32/lib/libz.dll.a /usr/x86_64-w64-mingw32/lib/libz.dll.a.bak
# Download the 32-bit development libraries for SDL2 and libsodium
# as well as the headers for zlib and place them in subfolders under
# /usr/i686-w64-mingw32
Packaging/windows/mingw-prep.sh
```
### Compiling
By compiling the `package` target, the build will produce the `devilutionx.zip` archive which should contain all the dlls necessary to run the game. If you encounter any errors suggesting a dll is missing, try extracting the dlls from the zip archive.
### 32-bit
```bash
# Configure the project to disable unit tests,
# statically link bzip2 and libsodium,
@ -231,7 +221,29 @@ cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc.toolchain.cm
cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target package
```
### 64-bit
</details>
<details open><summary>MinGW 64-bit</summary>
The 64-bit build depends on the 64-bit MinGW Development Libraries of [SDL2](https://www.libsdl.org/download-2.0.php) and [libsodium](https://github.com/jedisct1/libsodium/releases) as well as headers for [zlib](https://zlib.net/zlib-1.2.12.tar.gz). These dependencies will need to be placed in the appropriate subfolders under `/usr/x86_64-w64-mingw32`.
When linking zlib, libpng will always prefer dynamically linking with `libz.dll.a` if it can be found. We recommend renaming or deleting `libz.dll.a` to force libpng to use static linkage. This will prevent errors about missing dlls when you attempt to run the game.
These can be done automatically by running [`Packaging/windows/mingw-prep64.sh`](/Packaging/windows/mingw-prep64.sh).
Note: If your `x86_64-w64-mingw32` directory is not in `/usr` (e.g. when
on Debian), the mingw-prep scripts and the CMake command won't work. You need
adjust the mingw-prep scripts and pass `-DCROSS_PREFIX=/path` to CMake to set
the path to the parent of the `x86_64-w64-mingw32` directory.
```bash
# Download the 64-bit development libraries for SDL2 and libsodium
# as well as the headers for zlib and place them in subfolders under
# /usr/x86_64-w64-mingw32
Packaging/windows/mingw-prep64.sh
```
### Compiling
```bash
# Configure the project to disable unit tests,
@ -246,10 +258,10 @@ cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc64.toolchain.
cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target package
```
Note: If your `(i686|x86_64)-w64-mingw32` directory is not in `/usr` (e.g. when on Debian), the mingw-prep scripts and the CMake
command won't work. You need adjust the mingw-prep scripts and pass `-DCROSS_PREFIX=/path` to CMake to set the path to the parent
of the `(i686|x86_64)-w64-mingw32` directory.
</details>
</details>
<details><summary>Windows via Visual Studio</summary>
### Installing dependencies

Loading…
Cancel
Save