Commit graph

287 commits

Author SHA1 Message Date
Thomas Green
daa0c2c1bf Add improvements to Makefile for OSX. 2017-10-22 17:54:55 +02:00
Yamagi Burmeister
e5c39eeb7f Set -ffloat-store when building with gcc for i386.
This helps the old and crappy x87 FPU to produce correct values. And
finally implement compiler detection in the Makefile.
2017-09-21 18:40:12 +02:00
Yamagi Burmeister
6ab2b3227a Rename common/misc.c to common/frame.c.
Now that we moved the CRC stuff to crc.c only the frame handling is
left in this files.
2017-09-07 13:31:52 +02:00
Yamagi Burmeister
7ca4e2ea5d Revert "Pass -Wno-misleading-indentation to silence spurious warnings."
Clang 4.0 doesn't like this and I'm too lazy to implement per compiler
CFLAGS.
2017-08-01 18:39:42 +02:00
mulander
60bef10748 Don't use -Wl,--no-undefined on OpenBSD
Breaks the build since version 7.00
2017-07-20 17:47:56 +02:00
Yamagi Burmeister
6da4a31740 Pass -Wno-misleading-indentation to silence spurious warnings.
Recent GCC versions print a lot of missleading indentation" warnings
in third party code, making the build log more or less unreadable.
2017-06-30 14:12:57 +02:00
Simon McVittie
992f453016 Only use /usr/local/opt/openal-soft on Darwin
Commit 883781c selected these paths for all OSs, but when linking to
a system copy of OpenAL for Linux distribution binaries we want the
normal OpenAL in /usr.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-06-18 15:33:51 +01:00
Daniel Gibson
1da7ff5594 Fix Jennell Jaquays' name in credits and quit screen
the latter is done by identifying the baseq2 pics/quit.pcx in LoadPCX()
and changing some pixels
2017-06-12 18:32:56 +02:00
Yamagi Burmeister
4c8d504cf7 Enforce static linking of libgcc on Windows.
This is part of issue #205.
2017-06-10 10:01:05 +02:00
Yamagi Burmeister
c5f10dd879 Switch to a new, MSYS2 based build environment for Windows.
Highlights are:
- Since MSYS2 is much more unixlike than our old build environment we
  can remove most Windows specific hacks from the Makefile.
- MSYS2 has an package manager, the build environment can be updated
  by "pacman -Syu" just like an ordenary Arch Linux installation.
- Parallel builds are now working.
- git is integrated into the build envirment.
- zlib is now linked as a dynamic lib.

After this commit the old bild environment will no longer work! The
latest version must be downloaded and extracted to C:\MSYS2. Get it
here: https://deponie.yamagi.org/quake2/windows/build/
2017-05-25 11:21:52 +02:00
Yamagi Burmeister
38e60005cb Add back the GLAD_INCLUDE variable, lost in 4bd263c. 2017-04-10 19:22:23 +02:00
Yamagi Burmeister
4bd263c4d4 Some cleanup to the Makefile.
- Rename REFGL to REFGL1 for consistency with REFGL3.
- Fix some comments.
- There's no need to link flash.c and rand.c into both renderer libs.
2017-04-10 15:50:25 +02:00
Daniel Gibson
54b38176ef Fix Windows build (missing OSTYPE => YQ2_OSTYPE in Makefile) 2017-04-04 17:34:19 +02:00
Daniel Gibson
182948fecc Rename ref_gl.* to ref_gl1.* 2017-04-02 16:23:00 +02:00
Daniel Gibson
fcae894c1e Makefile: OSTYPE => YQ2_OSYTPE, ARCH => YQ2_ARCH, -std=gnu99
Hopefully this fixes the build on SUSE Linux.
2017-04-02 15:58:35 +02:00
Daniel Gibson
0d81fd6080 Fix OSX build (with Makefile) 2017-02-19 06:03:08 +01:00
Daniel Gibson
0b35ceabdc GL3: added missing source files and stubs of most functions
still no 3D rendering, but in theory it should be able to load models,
bsps etc, just not render them yet.

also moved/copied md2.c and sp2.c to gl/ and gl3/ because they use
renderer-specific types
2017-02-19 06:03:07 +01:00
Daniel Gibson
678410bfb4 Added super simple shaders, does render videos now 2017-02-19 06:03:07 +01:00
Daniel Gibson
56661fd43f GL3: Add remaining stubs, add HandMadeMath, update Copyrights 2017-02-19 06:03:07 +01:00
Daniel Gibson
64a456b867 Moved LoadWal() to r_image.c/gl3_image.c
It returns the renderer-specific image_t*; wal.c is now
renderer-agnostic and only contains GetWalInfo().
2017-02-19 06:03:07 +01:00
Daniel Gibson
9970dc43ad some further steps; ref_shared.h shared between ref libs
still nothing useful..
2017-02-19 06:03:07 +01:00
Daniel Gibson
324eaa8048 begin implementing ref_gl3
so far it can't even be loaded completely and has no code for
rendering yet
2017-02-19 06:03:07 +01:00
Daniel Gibson
c901ad9bb6 Fix build on OSX 2017-02-19 06:03:07 +01:00
Daniel Gibson
aaa73236ec refexport_t::Init() now returns bool and has no args; minor things
the arguments were not used anyway, and returning true/false is clearer
than returning -1 (for error) or sth else (which has no deeper meaning
anyway).

Also:
* PrepareForWindow() can now return -1 if there's an error
* suppress some warnings in Makefile
* fix error for building ref_gl.dylib on OSX
2017-02-19 06:03:07 +01:00
Daniel Gibson
4ede163794 Fix window build with Makefile
the problem is that sdl2-config --libs apparently includes shit that's only
useful for the executable, but not dlls, like linking against SDL2main and
libmingw32 and setting -mwindows

Furthermore I forgot to add -lopengl32 and -shared to the ref_gl Windows
LDFLAGS.
2017-02-19 06:03:07 +01:00
Daniel Gibson
7f27c549a8 It works again, ref_gl doesn't use any client symbols anymore
So in theory this should even work on Windows now.
2017-02-19 06:03:07 +01:00
Daniel Gibson
2062b319e9 move qgl.[ch] to src/client/refresh/gl/ 2017-02-19 05:53:56 +01:00
Daniel Gibson
f13e15e561 ref_gl.so builds and works (on Linux, with Makefile)
still dirty, seems to use some symbols from client directly, which will
not work on Windows.
2017-02-19 05:53:56 +01:00
Daniel Gibson
883781c6f0 Also fix OSX build with OpenAL when *not* using dlopen()
using dlopen() (DLOPEN_OPENAL) is default, though.
2016-12-18 00:00:47 +01:00
Daniel Gibson
10899195b4 Fix OSX build with OpenAL if it's dlopen()'ed 2016-12-17 23:51:17 +01:00
Yamagi Burmeister
20caca09e3 Force the normal Windows build to OSTYPE := Windows
If someone really want's overwrite OSTYPE on Windows it's much easier to
just alter one line in the Makefile than supporting setting it through
the command line.
2016-12-03 09:17:21 +01:00
Yamagi Burmeister
ae2b4744a1 MinGW defines a global OSTYPE. Just overwrite it. 2016-12-02 16:53:30 +01:00
Yamagi Burmeister
e0b1f98f40 Make user overwriteable OSTYPE and ARCH somewhat more saner
In the Makefile we can use whatever variables we want. It's only
necessary that we don't leak them into the compiler context.
2016-10-31 10:22:17 +01:00
Yamagi Burmeister
aa897e3965 Make OSTYPE and ARCH user defineable.
The old implementation had two problems:

  * OSTYPE and ARCH are systemwide defines, overriding them may break
    the global libc headers. This is a theoretical problem, I've never
    seen it in praxis.

  * Not all system set ARCH correctly when building in a chroot env.
    For example on Linux ARCH is set to x86_64 when building in an
    i386 chroot. Now the user can do something like "make YQ2ARCH=i386"
    to get things right.
2016-10-24 18:02:17 +02:00
Yamagi Burmeister
6d7d15af30 Fix Windows build. On Windows OpenAL32.dll must be opened at runtime. 2016-07-05 19:17:06 +02:00
Yamagi
5323873476 Merge pull request #143 from smcv/link-libopenal
Optionally link libopenal at compile time
2016-07-05 19:13:57 +02:00
Simon McVittie
5887a9e79e Optionally link libopenal at compile time
In Linux distributions, having the executable depend on the right
libraries and arrange for them to be installed is straightforward,
and there's a lot of infrastructure for tracking which library
version a particular executable needs, including making sure we have
a version that contains all of the symbols that were used. Loading
libopenal at runtime defeats that infrastructure.

The ability to substitute a different-but-compatible libopenal,
or operate with reduced functionality without libopenal, might
still be desirable for generic/portable binary releases.

The CMake build system already linked the executable to
${OPENAL_LIBRARY} anyway, so it is already a hard dependency in that
build system.
2016-07-01 09:44:00 +01:00
Simon McVittie
c00707d449 Override __DATE__ from SOURCE_DATE_EPOCH if set
For deterministic/reproducible builds (where the same source and
toolchain can be verified to produce the same binary, allowing
maliciously substituted binaries to be detected) it is desirable to
take the software's idea of the build date from the build system;
otherwise, the real-time clock at the time of building affects the
result, making it non-reproducible.

SOURCE_DATE_EPOCH is a distribution-neutral specification for how
to do that. It is meant to be set by meta-build systems such as
dpkg or RPM, using a date/time that is already part of the source code,
for example the date of the latest git commit, the date in
the package's debian/changelog, or the date in the RPM spec file.

See https://reproducible-builds.org/specs/source-date-epoch/ for the
specification of SOURCE_DATE_EPOCH, or https://reproducible-builds.org/
for more information on reproducible builds in general.
2016-07-01 09:41:23 +01:00
Yamagi Burmeister
5a384c79b1 Switch from an arch whitelist to an "all archs are supported" approach.
The old whitelist was a leftover from the early days of YQ2. It should
run on most / all architectures, as long SDL supports them. As suggested
by smcv in issue #138 generate the OSTYPE and ARCH defines by the build
system instead of hardcoding it.

Savegame compatibility is provided by bumping the savegame version. Old
savegames are compared against the old OSTYPE and ARCH defined, new ones
against the new defines. This compatibility code should be removed
somewhere in the distant future.
2016-06-11 09:23:10 +02:00
Jarvik7
ca753d4f87 Fix broken OSX makefile
Makefile rewrite forgot to include OpenAL folders for Darwin
2016-03-17 11:26:39 +08:00
svdijk
a7e0338c56 Makefile: The OSX library extension is "dylib", not "dynlib" 2015-11-06 18:52:45 +01:00
svdijk
ec9657134f Windows: icon.rc is a source file, so move it to the source directory. 2015-11-04 21:05:30 +01:00
Yamagi Burmeister
9e4d26399e Switch Windows to dynamic binaries 2015-09-08 18:09:56 +02:00
Yamagi Burmeister
565f7f6e67 Let the Makefile generate a game.dynlib on OS X
This should have been done years ago, .dynlib is the canocial extension
for libraries on OS X. In a broader sense this simplifies the CMake
build system a little bit, since CMake enforces .dynlib for OS X
libraries.
2015-08-12 18:55:35 +02:00
Daniel Gibson
41ea8879e7 Fix bug with high velocities in vents in 32bit builds, fix #71
See https://github.com/yquake2/yquake2/issues/71
and https://github.com/yquake2/xatrix/issues/4

In ClientThink(), the float value ent->velocity[i]*8 is saved into
a short and if the value is too big for a short, in 32bit gcc builds
the short is set to SHRT_MIN, resulting in the player being pressed
down instead of up.
Now we put the result in a 32bit int first (which should be big enough)
and assign the int to the short. This still overflows, but with -fwrapv
at least in a defined way (most probably the same way the original
binaries did).

And while I was at it, when the game lib is loaded, it prints the date
it was built, this is especially interesting for our Win32 binaries.
2015-05-17 18:52:18 +02:00
Daniel Gibson
544a464eea Implement gamedata loading from binary path
even if $PWD is not the same path as the executable is in, the game
will look for game data in directories next to the executable.
2015-04-11 20:11:42 +02:00
jarvik7
5eeef2edcc Autodetect architecture in makefile
Can now build a 32bit version.
Note that all your dependencies will also need to support 32-bit.
Install SDL2, libel, libvorbis, openal-soft in Homebrew using
‘--universal’ flag
2015-03-29 12:19:16 +09:00
jarvik7
e85b6999a7 Re-add OS X support
No changes to source were needed, just to makefile.
The build process is now also different.
Frameworks are no longer needed, but you will need to get some packages
from Homebrew to compile.

Install homebrew, then get the following packages before compiling.

openal-soft
libogg
libvorbis
sdl2
2015-03-21 16:39:55 +09:00
Yamagi Burmeister
177b424ba1 Remove Mac OS X support
No, this is not a rage quit but the result of a long discussion. There
are several reasons for us to drop OS X support:

- OS X support was always more or less hacky. For example is was never
  really integrated into the build system and some features like the
  OpenAL sound backend never worked well.
- The OS X support never grew into the new world based upon SDL2.
- It was broken since at least Lion which was released 4 years ago.
- None of the developers has a Mac or plans to buy one. Supporting
  a software for a platform not used by the developers is more or
  less impossible.
- And despite several appeals no one from the OS X community ever
  stept up and send patches.

Removed are:
- Makefile support
- The OpenAL quirks
- The Cocoa bindings
- The framworks

Not removed is:
- Savegame support
- Memory management support
- Platform detection
- OpenGL and SDL includes

So, if someone steps up and does a modern, fully integrated port based
upon SDL2 we're happy to merge it back. The requirements are:
- It must be a clean port, without any hacks
- Full build system integration must be provided
- The port must be maintained even after it was merged. At every release
  binaries must be build, API / ABI changes with new OS X versions must
  be tracked.
2015-03-20 17:33:46 +01:00
Daniel Gibson
47cde06e27 Use stb_image for retexturing support, also support png, no more libjpeg
Retexturing support is now always on (you can still switch it off with
the gl_retexturing  CVAR), as we don't have the additional libjpeg
dependency anymore.

stb_image is used for tga, jpg and the newly supported png, so the
old tga and jpeg loading code has been removed.

I furthermore cleaned up the somehow messy and possibly slightly broken
retexturing selection code in R_FindImage()
2015-03-20 17:33:37 +01:00