Skip to content

Commit 82fbeca

Browse files
authored
Simplifying MinGW instructions (#8154)
1 parent 0dc534a commit 82fbeca

File tree

4 files changed

+47
-34
lines changed

4 files changed

+47
-34
lines changed

.github/workflows/Windows_MinGW_x64.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
run: >
3131
sudo apt-get update &&
3232
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 &&
33-
sudo rm /usr/x86_64-w64-mingw32/lib/libz.dll.a &&
3433
sudo Packaging/windows/mingw-prep64.sh
3534
3635
- name: Configure CMake

.github/workflows/Windows_MinGW_x86.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
run: >
3131
sudo apt update &&
3232
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 &&
33-
sudo rm /usr/i686-w64-mingw32/lib/libz.dll.a &&
3433
sudo Packaging/windows/mingw-prep.sh
3534
3635
- name: Configure CMake

Packaging/windows/mingw-prep.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ find "${MINGW_PREFIX}/lib/pkgconfig/" -name '*.pc' -exec \
5151
# Fixup CMake prefix:
5252
find "${MINGW_PREFIX}" -name '*.cmake' -exec \
5353
$SUDO sed -i "s|/opt/local/${MINGW_ARCH}|${MINGW_PREFIX}|" '{}' \;
54+
55+
# Fixup zlib linking:
56+
$SUDO mv "${MINGW_PREFIX}/lib/libz.dll.a" "${MINGW_PREFIX}/lib/libz.dll.a.bak"

docs/building.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -167,57 +167,47 @@ You can launch WSL anytime by typing wsl or ubuntu in a Command Prompt or Powers
167167
In a WSL terminal run these commands to get the source code for DevilutionX
168168

169169
```
170-
sudo apt install git
170+
sudo apt-get install git
171171
git clone https://github.com/diasurgical/devilutionx
172172
cd devilutionx
173173
```
174+
174175
</details>
175176

176177
### Installing dependencies on WSL, Debian and Ubuntu
177178

178-
### 32-bit
179-
180-
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).
179+
#### MinGW build tools
181180

182181
```bash
183-
# Install the 32-bit MinGW build tools
184-
sudo apt install cmake gcc-mingw-w64-i686 g++-mingw-w64-i686 pkg-config-mingw-w64-i686 libz-mingw-w64-dev git wget
185-
186-
# Download the 32-bit development libraries for SDL2 and libsodium
187-
# as well as the headers for zlib and place them in subfolders under
188-
# /usr/i686-w64-mingw32
189-
Packaging/windows/mingw-prep.sh
182+
# Install MinGW build tools
183+
sudo apt-get update
184+
sudo apt-get install cmake git libz-mingw-w64-dev mingw-w64 mingw-w64-tools smpq wget
190185
```
191186

192-
### 64-bit
187+
<details><summary>MinGW 32-bit</summary>
193188

194-
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).
189+
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`.
195190

196-
```bash
197-
# Install the 64-bit MinGW build tools
198-
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
199-
200-
# Download the 64-bit development libraries for SDL2 and libsodium
201-
# as well as the headers for zlib and place them in subfolders under
202-
# /usr/x86_64-w64-mingw32
203-
Packaging/windows/mingw-prep64.sh
204-
```
191+
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.
205192

206-
### Before compiling
193+
These can be done automatically by running [`Packaging/windows/mingw-prep.sh`](/Packaging/windows/mingw-prep.sh).
207194

208-
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.
195+
Note: If your `i686-w64-mingw32` directory is not in `/usr` (e.g. when on
196+
Debian), the mingw-prep scripts and the CMake command won't work. You need
197+
adjust the mingw-prep scripts and pass `-DCROSS_PREFIX=/path` to CMake to set
198+
the path to the parent of the `i686-w64-mingw32` directory.
209199

210200
```bash
211-
sudo mv /usr/i686-w64-mingw32/lib/libz.dll.a /usr/i686-w64-mingw32/lib/libz.dll.a.bak
212-
sudo mv /usr/x86_64-w64-mingw32/lib/libz.dll.a /usr/x86_64-w64-mingw32/lib/libz.dll.a.bak
201+
# Download the 32-bit development libraries for SDL2 and libsodium
202+
# as well as the headers for zlib and place them in subfolders under
203+
# /usr/i686-w64-mingw32
204+
Packaging/windows/mingw-prep.sh
213205
```
214206

215207
### Compiling
216208

217209
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.
218210

219-
### 32-bit
220-
221211
```bash
222212
# Configure the project to disable unit tests,
223213
# statically link bzip2 and libsodium,
@@ -231,7 +221,29 @@ cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc.toolchain.cm
231221
cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target package
232222
```
233223

234-
### 64-bit
224+
</details>
225+
226+
<details open><summary>MinGW 64-bit</summary>
227+
228+
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`.
229+
230+
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.
231+
232+
These can be done automatically by running [`Packaging/windows/mingw-prep64.sh`](/Packaging/windows/mingw-prep64.sh).
233+
234+
Note: If your `x86_64-w64-mingw32` directory is not in `/usr` (e.g. when
235+
on Debian), the mingw-prep scripts and the CMake command won't work. You need
236+
adjust the mingw-prep scripts and pass `-DCROSS_PREFIX=/path` to CMake to set
237+
the path to the parent of the `x86_64-w64-mingw32` directory.
238+
239+
```bash
240+
# Download the 64-bit development libraries for SDL2 and libsodium
241+
# as well as the headers for zlib and place them in subfolders under
242+
# /usr/x86_64-w64-mingw32
243+
Packaging/windows/mingw-prep64.sh
244+
```
245+
246+
### Compiling
235247

236248
```bash
237249
# Configure the project to disable unit tests,
@@ -246,10 +258,10 @@ cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc64.toolchain.
246258
cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target package
247259
```
248260

249-
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
250-
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
251-
of the `(i686|x86_64)-w64-mingw32` directory.
252261
</details>
262+
263+
</details>
264+
253265
<details><summary>Windows via Visual Studio</summary>
254266

255267
### Installing dependencies

0 commit comments

Comments
 (0)