Migrate the Windows build from GNUWin to Git Bash and ezwinports's Make

This commit is contained in:
Lior Halphon
2025-07-07 22:34:45 +03:00
parent 4abb5f3539
commit bdd4522ca9
3 changed files with 16 additions and 23 deletions

View File

@@ -36,10 +36,14 @@ else
DEFAULT := sdl
endif
NULL := /dev/null
ifeq ($(PLATFORM),windows32)
ifneq ($(shell echo /dev/null*),/dev/null)
# Windows shell is not "aware" of /dev/null, use NUL and pray
NULL := NUL
endif
endif
PREFIX ?= /usr/local
ifneq ($(shell which xdg-open 2> $(NULL))$(FREEDESKTOP),)
@@ -210,9 +214,10 @@ CFLAGS += -DUPDATE_SUPPORT
endif
ifeq (,$(PKG_CONFIG))
ifneq ($(PLATFORM),windows32)
SDL_CFLAGS := $(shell sdl2-config --cflags)
SDL_LDFLAGS := $(shell sdl2-config --libs) -lpthread
endif
ifeq ($(PLATFORM),Darwin)
SDL_LDFLAGS += -framework AppKit
endif
@@ -668,11 +673,11 @@ $(BIN)/SDL/sameboy.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.
$(BIN)/SDL/sameboy_debugger.txt:
echo Looking for sameboy_debugger.exe? > $@
echo\>> $@
echo >> $@
echo Starting with SameBoy v1.0.1, sameboy.exe and sameboy_debugger.exe >> $@
echo have been merged into a single executable. You can open a debugger >> $@
echo console at any time by pressing Ctrl+C to interrupt the currently >> $@
echo open ROM. Once you're done debugging, you can close the debugger >> $@
echo open ROM. Once you\'re done debugging, you can close the debugger >> $@
echo console and resume normal execution. >> $@
ifneq ($(USE_WINDRES),)
@@ -685,13 +690,13 @@ $(OBJ)/%.res: %.rc
rc /fo $@ /dVERSION=\"$(VERSION)\" /dCOPYRIGHT_YEAR=\"$(COPYRIGHT_YEAR)\" $^
%.o: %.res
cvtres /OUT:"$@" $^
cvtres /MACHINE:X64 /OUT:"$@" $^
endif
# Copy required DLL files for the Windows port
$(BIN)/SDL/%.dll:
-@$(MKDIR) -p $(dir $@)
@$(eval MATCH := $(shell where $$LIB:$(notdir $@)))
@$(eval MATCH := $(shell where "$(lib)":$(notdir $@)))
cp "$(MATCH)" $@
# Tester

View File

@@ -47,8 +47,9 @@ SameBoy requires the following tools and libraries to build:
On Windows, SameBoy also requires:
* Visual Studio (For headers, etc.)
* [GnuWin](http://gnuwin32.sourceforge.net/)
* Running vcvars64 before running make. Make sure all required tools and libraries are in %PATH% and %lib%, respectively. (see [Build FAQ](https://github.com/LIJI32/SameBoy/blob/master/build-faq.md) for more details on Windows compilation)
* [Git Bash](https://git-scm.com/downloads/win) or another distribution of basic Unix utilities
* Git Bash does not include make, you can get it [here](https://sourceforge.net/projects/ezwinports/files/make-4.4.1-without-guile-w32-bin.zip/download).
* Running `vcvars64.bat` or `vcvarsx86_amd64.bat` before running make. Make sure all required tools, libraries, and headers are in %PATH%, %lib%, and %include%`, respectively. (see [Build FAQ](https://github.com/LIJI32/SameBoy/blob/master/build-faq.md) for more details on Windows compilation)
To compile, simply run `make`. The targets are:
* `cocoa` (Default for macOS)

View File

@@ -26,9 +26,9 @@ The following examples will be referenced later:
After downloading [rgbds](https://github.com/gbdev/rgbds/releases/), ensure that it is added to the `%PATH%`. This may be done by adding it to the user's or SYSTEM's Environment Variables, or may be added to the command line at compilation time via `set path=%path%;C:\path\to\rgbds`.
### GnuWin
### Git Bash & Make
Ensure that the `gnuwin32\bin\` directory is included in `%PATH%`. Like rgbds above, this may instead be manually included on the command line before installation: `set path=%path%;C:\path\to\gnuwin32\bin`.
Ensure that the `Git\usr\bin` directory is included in `%PATH%`. Like rgbds above, this may instead be manually included on the command line before installation: `set path=%path%;C:\path\to\Git\usr\bin`. Similarly, make sure that the directory containing `make.exe` is also included.
## Building
@@ -40,18 +40,5 @@ set lib=%lib%;C:\SDL2\lib\x64
set include=%include%;C:\SDL2\include
make
```
Please note that these directories (`C:\SDL2\*`) are the examples given within the "SDL Port" section above. Ensure that your `%PATH%` properly includes `rgbds` and `gnuwin32\bin`, and that the `lib` and `include` paths include the appropriate SDL2 directories.
On some versions of Visual Studio, you might need to use `vcvarsx86_amd64` instead of `vcvars64`. Please note that these directories (`C:\SDL2\*`) are the examples given within the "SDL Port" section above. Ensure that your `%PATH%` properly includes `rgbds` and `Git\usr\bin`, and that the `lib` and `include` paths include the appropriate SDL2 directories.
## Common Errors
### Error -1073741819
If encountering an error that appears as follows:
``` make: *** [build/bin/BootROMs/dmg_boot.bin] Error -1073741819```
Simply run `make` again, and the process will continue. This appears to happen occasionally with `build/bin/BootROMs/dmg_boot.bin` and `build/bin/BootROMs/sgb2_boot.bin`. It does not affect the compiled output. This appears to be an issue with GnuWin.
### The system cannot find the file specified (`usr/bin/mkdir`)
If errors arise (i.e., particularly with the `CREATE_PROCESS('usr/bin/mkdir')` calls, also verify that Git for Windows has not been installed with full Linux support. If it has, remove `C:\Program Files\Git\usr\bin` from the SYSTEM %PATH% until after compilation. This happens because the Git for Windows version of `which` is used instead of the GnuWin one, and it returns a Unix-style path instead of a Windows one.