Skip to content

Commit 6a65b8a

Browse files
support 32-bit compilation on windows
* Add support for 32 bit cross compile in mingw64 and windows 98 support * add check to error out on linux * update text * add instructions for 32-bit compilation on windows --------- Co-authored-by: p2r3 <41925384+p2r3@users.noreply.github.com>
1 parent 26f068b commit 6a65b8a

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ Before compiling, you'll need to dump registry data from a vanilla Minecraft ser
1919

2020
- To compile on Linux, install `gcc` and run `./build.sh`.
2121
- For compiling on Windows, there are a few options:
22-
- To compile a native Windows binary: install [MSYS2](https://www.msys2.org/) and open the "MSYS2 MINGW64" shell. From there, run `pacman -Sy mingw-w64-x86_64-gcc`, navigate to this project's directory, and run `./build.sh`.
23-
- To compile a MSYS2-linked binary: install [MSYS2](https://www.msys2.org/), and open the "MSYS2 MSYS" shell. From there, install `gcc` (run `pacman -Sy gcc`), navigate to this project's directory and run `./build.sh`.
22+
- To compile a native Windows binary: install [MSYS2](https://www.msys2.org/) and open the "MSYS2 MINGW64" shell. From there, run `pacman -Sy mingw-w64-x86_64-gcc`, navigate to this project's directory, and run `./build.sh`.
23+
- To compile a native 32-bit binary (compatible with Windows 95/98, but why would you ever want that), use the same steps above, except with `pacman -Sy mingw-w64-cross-gcc` and `./build.sh --9x`.
24+
- To compile a MSYS2-linked binary: install [MSYS2](https://www.msys2.org/), and open the "MSYS2 MSYS" shell. From there, install `gcc` (run `pacman -Sy gcc`), navigate to this project's directory and run `./build.sh`.
2425
- To compile and run a Linux binary from Windows: install WSL, and from there install `gcc` and run `./build.sh` in this project's directory.
2526
- To target an ESP variant, set up a PlatformIO project (select the ESP-IDF framework, **not Arduino**) and clone this repository on top of it. See **Configuration** below for further steps. For better performance, consider changing the clock speed and enabling compiler optimizations. If you don't know how to do this, there are plenty of resources online.
2627

build.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ case "$unameOut" in
2222
;;
2323
esac
2424

25+
# Default compiler
26+
compiler="gcc"
27+
28+
# Handle arguments for windows 9x build
29+
for arg in "$@"; do
30+
case $arg in
31+
--9x)
32+
if [[ "$unameOut" == MINGW64_NT* ]]; then
33+
compiler="/opt/bin/i686-w64-mingw32-gcc"
34+
windows_linker="$windows_linker -Wl,--subsystem,console:4"
35+
else
36+
echo "Error: Compiling for Windows 9x is only supported when running under the MinGW64 shell."
37+
exit 1
38+
fi
39+
;;
40+
esac
41+
done
42+
2543
rm -f "bareiron$exe"
26-
gcc src/*.c -O3 -Iinclude -o "bareiron$exe" $windows_linker
44+
$compiler src/*.c -O3 -Iinclude -o "bareiron$exe" $windows_linker
2745
"./bareiron$exe"

0 commit comments

Comments
 (0)