This was requested several times, the last time in pull request #523.
Only the optimization level, warning level and debug stuff may be
overridden. All other options are enforces because they're required.
While here add a new variable to force a debug build: `make DEBUG=1`.
Loading libcurl at runtime instead of linking it at compile time makes
things a lot easier and more reliable on Windows. On other platform
libcurl can be installed as optional dependency instead as an hard one.
This is a very first cut:
* It compiles
* It doesn't crash
What's missing:
* cmake integration
* CURL should be loaded dynamically
* Integration between download code and filesystem
* Likely UTF-8 stuff
* cl_http.c needs cleanup
* Windows support
I've chosen the minimal invasive way for this:
* Import miniz and remove -lz linker flags.
* Create a short header minizconf.h roviding everything we need
originally defined by zconf.h and not provided by miniz.
* Replace zlib.h with miniz.h and minizconf.h.
The input system backend was once used in the client and the renderers,
but for some years now it has been an integral part of the client only.
Move it there.
* CDA was only supported of the client was build with SDL 1.2. Our
Windows binaries had no CDA support for years, I'm pretty sure that
it never worked on Linux and no computer build after 2005 has even
the necessary hardware. So let's just remove it.
* X11GAMMA was a hack to work around SDL 1.2s inability to set the
gamma on newer xorg-server versions. It has been broken for some
time now an is rather ugly. Remove it.
This is the first step in removing SDL 1.2 support.
FreeBSD has supported printing backtraces for years. The API is the same
as on Linux, the only difference is that libexecinfo must be linked as a
seperate library. Since the last FreeBSD version with backtrace support
(FreeBSD 9.3) went out of support some time ago unconditionally enable
the printing.
By default minizip uses fopen64(), fseek64() and so on. Those may not
be defined on all system, especially the BSDs. While FreeBSD already
has a special case, for example OpenBSD hasn't. Work around this by
forcing minizip to use fopen(), fseek() and so on everything that's not
Linux or Windows. This is not 100% correct, it may prevent the usage of
ZIPs lager than 2GB on Solaris and other rarely used systems. But I
doubt that anyone has such large ZIPs with assets, they would likely hit
other internal limits.
In the future Quake II should use off_t instead of int were applicable.
With that we could set -D_FILE_OFFSET_BITS=64.
This change is based upon a patch send by @devnexen in pr #279.
There's no need to duplicate machine independent parts of the client
initialization and the main loop for every platform.
While at it remove the nearly empty unix.h header and move Windows
main() into an own file. Not both platform have the same basic layout.
While building the wrapper as a console application is completely fine
there're some advantages by creating a "real" Windows GUI Application:
* Console applications always spawn an annoying console window.
* Windows GUI applications seem to have a much lower chance to trigger
my new best friend, the Windows Defender. As a console application
quake.exe triggered every time I started it, as Windows GUI
application not only once.
Use WinMain() instead of wWinMain() because MinGW doesn't know about
the later and it doesn't matter anyways.
libSDLmain.a has to be linked and must run anyways. So there's no need
for us to reinvent the wheel, just rely on SDLs process setup, argument
parsing, message handling and so on. As a nice side effect this may fix
some strange bugs related to message handling and argument parsing...
Before we can ship the softrenderer in the default install we'll need to
clean up the cvars. Currently the softrenderer is using the gl_* cvars
which is confusing.