adplug / adplay-unix

AdPlug's UNIX console-based frontend
GNU General Public License v2.0
12 stars 15 forks source link

Mingw32 4.8.0 #23

Closed dmitrysmagin closed 8 months ago

dmitrysmagin commented 1 year ago

Here's a PR for windows-specific modifications. 1) Renamed local sdl.h -> sdlx.h to avoid confusion #include "sdl.h" vs #include 2) Added sdl-win-fix.sh script which fixes resulting Makefiles for compiling console application instead of windows one. 3) Smaller header fixes for SDL2

And yes, both compiling against old SDL12 and newer SDL2 is working (--with-sdl=sdl12 or --with-sdl=sdl2 configure flags)

./configure --prefix=/mingw CXXFLAGS=-fpermissive

Also, a bit ugly, but I had to add #undef main just before main(), because SDL on windows does #define main SDLmain somewhere inside its headers and it can't be overriden in mingw command line. This #undef does no harm on other platforms, though.

mywave82 commented 1 year ago

TODO list:

mywave82 commented 1 year ago

25 should remove the typecast needed for getopt_long. The const in the middle is a leftover from the original GNU implementation which lingers around many places.

mywave82 commented 1 year ago

Sorry for all the extra forced pushes, but I have reworked your patches, and rebased them to the current master.

mywave82 commented 1 year ago

fprintf (stderr, ""); // temporary bug-workaround. Running getopt_long in wine atleast without stderr being initialized causes a strlen(NULL) exception somehow

Should be debugged some probably. Atleast for me if I run the result binary under wine; it crashes without it. All a bit wierd.

No longer happens with my test-setup

dmitrysmagin commented 1 year ago

Thanks for the effort. Using sed in configure.ac to fix the flags is quite curious, much cleaner that using a separate script.