r451 - in trunk: . code/renderer code/tools/asm code/tools/lcc code/unix code/win32
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Dec 28 19:04:41 EST 2005
Author: tma
Date: 2005-12-28 19:04:41 -0500 (Wed, 28 Dec 2005)
New Revision: 451
Added:
trunk/cross-make-mingw.sh
Modified:
trunk/README
trunk/code/renderer/qgl.h
trunk/code/tools/asm/Makefile
trunk/code/tools/lcc/Makefile
trunk/code/unix/Makefile
trunk/code/win32/win_main.c
Log:
* Support for MinGW cross compilation
Modified: trunk/README
===================================================================
--- trunk/README 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/README 2005-12-29 00:04:41 UTC (rev 451)
@@ -55,6 +55,28 @@
Then run "make copyfiles", beware that this will overwrite any binaries
installed previously, even official id ones.
+Compiling under Windows using MinGW
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+It is possible to compile ioQ3 using the MinGW (Minimalist GNU for Windows)
+toolset. It's a little more involved than compiling for Linux; steps are as
+follows:
+
+1. Download and install MinGW and MSys from http://www.mingw.org/.
+2. Download http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
+ and untar in into your MinGW directory (usually C:\MinGW).
+3. Perform the usual precompilation sacrificial ritual.
+4. Open an MSys terminal, and follow the instructions for compiling on Linux.
+5. Steal underpants
+6. ?????
+7. Profit!
+
+It is also possible to cross compile for Windows using MinGW. A script is
+available to build a cross compilation environment from
+http://www.libsdl.org/extras/win32/cross/build-cross.sh. The gcc/binutils
+version numbers that the script downloads may need to be altered. After you
+have successfully run this script cross compiling is simply a case of using
+'./cross-make-mingw.sh' in place of 'make'.
+
Using shared libraries instead of qvm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To make quake3 prefer shared libraries instead of qvm run it with
@@ -63,7 +85,7 @@
Using Demo Data Files
~~~~~~~~~~~~~~~~~~~~~
-you only need demoq3/pak0.pk3 from the demo installer. The qvm files inside
+You only need demoq3/pak0.pk3 from the demo installer. The qvm files inside
pak0.pk3 will not work, you have to use the native shared libraries from this
project. To do so copy or link ui*.so, qagame*.so, cgame*.so from baseq3 to
demoq3 and run quake3 with the parameters described above.
@@ -80,59 +102,7 @@
Note if you simply wish to run mods on a 64bit platform you do not need to
recompile anything since by default Q3 uses a virtual machine system.
-Futhermore, ioq3 has an experimental JIT compiler for x86_64 which will result
-in better performance. To enable this find these lines in code/Makefile:
- # experimental x86_64 jit compiler! you need as
- #HAVE_VM_COMPILED = true
-
-..and change them to:
-
- # experimental x86_64 jit compiler! you need as
- HAVE_VM_COMPILED = true
-
-Compiling under windows using MinGW
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-It is possible to compile ioQ3 using the MinGW (Minimalist GNU for Windows)
-toolset. It's a little more involved than compiling for linux; steps are as
-follows:
-
-1. Download and install MinGW and MSys from http://www.mingw.org/.
-2. Download and install the DirectX 9 SDK from
- http://msdn.microsoft.com/directx/. Previous versions of the SDK will
- probably work, but they have not been tested.
-3. Find the following in DXSDK/Include/dinput.h...
-
- } DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW;
- #ifdef UNICODE
- typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE;
- typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE;
- #else
- typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE;
- typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE;
- #endif // UNICODE
-
- typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA;
- typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW;
- > #ifdef UNICODE
- > typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE;
- > typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE;
- > #else
- > typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE;
- > typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE;
- > #endif // UNICODE
- typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE;
-
- ...and comment out/remove the duplicated code marked by '>'.
-
-4. If you didn't install the DirectX SDK in C:\DXSDK\, add DXSDK_DIR to
- code/unix/Makefile.local to reflect the new location.
-5. Perform the usual precompilation sacrificial ritual.
-6. Open an MSys terminal, and follow the instructions for compiling on Linux.
-7. Steal underpants
-8. ?????
-9. Profit!
-
Creating mods compatible with Q3 1.32b
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're using this package to create mods for the last official release of
Modified: trunk/code/renderer/qgl.h
===================================================================
--- trunk/code/renderer/qgl.h 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/code/renderer/qgl.h 2005-12-29 00:04:41 UTC (rev 451)
@@ -42,7 +42,7 @@
#endif
#include <windows.h>
-#include <gl/gl.h>
+#include <GL/gl.h>
#elif defined(MACOS_X)
Modified: trunk/code/tools/asm/Makefile
===================================================================
--- trunk/code/tools/asm/Makefile 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/code/tools/asm/Makefile 2005-12-29 00:04:41 UTC (rev 451)
@@ -1,6 +1,5 @@
# yeah, couldn't do more simple really
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
ifeq ($(PLATFORM),mingw32)
BINEXT=.exe
else
Modified: trunk/code/tools/lcc/Makefile
===================================================================
--- trunk/code/tools/lcc/Makefile 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/code/tools/lcc/Makefile 2005-12-29 00:04:41 UTC (rev 451)
@@ -1,4 +1,3 @@
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
TEMPDIR=/tmp
A=.a
O=.o
@@ -19,7 +18,7 @@
DIFF=diff
RM=rm -f
RMDIR=rmdir
-BUILDDIR=build
+BUILDDIR=build-$(PLATFORM)-$(ARCH)
BD=$(BUILDDIR)/
ifeq ($(USE_CCACHE),1)
Modified: trunk/code/unix/Makefile
===================================================================
--- trunk/code/unix/Makefile 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/code/unix/Makefile 2005-12-29 00:04:41 UTC (rev 451)
@@ -11,20 +11,15 @@
# GNU Make required
#
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
-PLATFORM_RELEASE=$(shell uname -r)
+COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
-# Apple does some things a little differently...
-ifeq ($(PLATFORM),darwin)
- ARCH:= $(shell uname -p | sed -e s/i.86/i386/)
+ifeq ($(COMPILE_PLATFORM),darwin)
+ # Apple does some things a little differently...
+ COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
else
- ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
+ COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
endif
-ifeq ($(ARCH),powerpc)
- ARCH:=ppc
-endif
-
#############################################################################
#
# If you require a different configuration from the defaults below, create a
@@ -35,6 +30,31 @@
#############################################################################
-include Makefile.local
+ifndef PLATFORM
+PLATFORM=$(COMPILE_PLATFORM)
+endif
+export PLATFORM
+
+ifndef ARCH
+ARCH=$(COMPILE_ARCH)
+endif
+
+ifeq ($(ARCH),powerpc)
+ ARCH=ppc
+endif
+export ARCH
+
+ifneq ($(PLATFORM),$(COMPILE_PLATFORM))
+ CROSS_COMPILING=1
+else
+ CROSS_COMPILING=0
+
+ ifneq ($(ARCH),$(COMPILE_ARCH))
+ CROSS_COMPILING=1
+ endif
+endif
+export CROSS_COMPILING
+
ifndef COPYDIR
COPYDIR="/usr/local/games/quake3"
endif
@@ -48,11 +68,6 @@
GENERATE_DEPENDENCIES=1
endif
-# Used for building with mingw
-ifndef DXSDK_DIR
-DXSDK_DIR=C:/DXSDK
-endif
-
ifndef USE_CCACHE
USE_CCACHE=0
endif
@@ -84,8 +99,8 @@
#############################################################################
-BD=debug$(ARCH)$(GLIBC)
-BR=release$(ARCH)$(GLIBC)
+BD=debug-$(PLATFORM)-$(ARCH)
+BR=release-$(PLATFORM)-$(ARCH)
CDIR=$(MOUNT_DIR)/client
SDIR=$(MOUNT_DIR)/server
RDIR=$(MOUNT_DIR)/renderer
@@ -343,13 +358,10 @@
ifeq ($(PLATFORM),mingw32)
- GLIBC=-mingw
CC=gcc
WINDRES=windres
- ifeq ($(ARCH),i386)
- ARCH=x86
- endif
+ ARCH=x86
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
@@ -357,8 +369,6 @@
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
endif
- DX_CFLAGS = -I$(DXSDK_DIR)/Include
-
GL_CFLAGS =
MINGW_CFLAGS = -DDONT_TYPEDEF_INT32
@@ -685,18 +695,29 @@
ifneq ($(BUILD_CLIENT),1)
TARGETS := \
- $(subst $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/baseq3/ui$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/missionpack/ui$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/baseq3/vm/cgame.qvm,,\
- $(subst $(B)/baseq3/vm/ui.qvm,,\
- $(subst $(B)/missionpack/vm/cgame.qvm,,\
- $(subst $(B)/missionpack/vm/ui.qvm,,\
- $(subst $(B)/$(PLATFORM)quake3-smp$(BINEXT),,\
- $(subst $(B)/$(PLATFORM)quake3$(BINEXT),,$(TARGETS) ))))))))))
+ $(subst $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/baseq3/ui$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/missionpack/ui$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/baseq3/vm/cgame.qvm,,\
+ $(subst $(B)/baseq3/vm/ui.qvm,,\
+ $(subst $(B)/missionpack/vm/cgame.qvm,,\
+ $(subst $(B)/missionpack/vm/ui.qvm,,\
+ $(subst $(B)/$(PLATFORM)quake3-smp$(BINEXT),,\
+ $(subst $(B)/$(PLATFORM)quake3$(BINEXT),,$(TARGETS) ))))))))))
endif
+# Never build qvms when cross-compiling
+ifeq ($(CROSS_COMPILING),1)
+ TARGETS := \
+ $(subst $(B)/baseq3/vm/qagame.qvm,,\
+ $(subst $(B)/baseq3/vm/cgame.qvm,,\
+ $(subst $(B)/baseq3/vm/ui.qvm,,\
+ $(subst $(B)/missionpack/vm/qagame.qvm,,\
+ $(subst $(B)/missionpack/vm/cgame.qvm,,\
+ $(subst $(B)/missionpack/vm/ui.qvm,,$(TARGETS) ))))))
+endif
+
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
endif
@@ -769,9 +790,14 @@
Q3LCC=../tools/q3lcc$(BINEXT)
Q3ASM=../tools/q3asm$(BINEXT)
+ifeq ($(CROSS_COMPILING),1)
tools:
+ echo QVM tools not built when cross-compiling
+else
+tools:
$(MAKE) -C ../tools/lcc install
$(MAKE) -C ../tools/asm install
+endif
DO_Q3LCC=$(Q3LCC) -o $@ $<
@@ -1287,16 +1313,16 @@
$(B)/client/ftola.o : $(UDIR)/ftola.s; $(DO_AS)
$(B)/client/snapvectora.o : $(UDIR)/snapvectora.s; $(DO_AS)
-$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC) $(DX_CFLAGS)
+$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC)
+$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC)
+$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC)
+$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC)
+$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC)
+$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC)
+$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC)
+$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC)
+$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC)
+$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC)
$(B)/client/win_resource.o : $(W32DIR)/winquake.rc; $(DO_WINDRES)
$(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
Modified: trunk/code/win32/win_main.c
===================================================================
--- trunk/code/win32/win_main.c 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/code/win32/win_main.c 2005-12-29 00:04:41 UTC (rev 451)
@@ -47,7 +47,7 @@
#define ALT_SPANK
#ifdef ALT_SPANK
#include <stdio.h>
-#include <sys\stat.h>
+#include <sys/stat.h>
int fh = 0;
@@ -528,7 +528,6 @@
// fqpath buffersize must be at least MAX_QPATH+1 bytes long
void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPoint)(long, ...),
long (QDECL *systemcalls)(long, ...) ) {
- static int lastWarning = 0;
HINSTANCE libHandle;
void (QDECL *dllEntry)( long (QDECL *syscallptr)(long, ...) );
char *basepath;
@@ -536,6 +535,7 @@
char *gamedir;
char *fn;
#ifdef NDEBUG
+ static int lastWarning = 0;
int timestamp;
int ret;
#endif
Added: trunk/cross-make-mingw.sh
===================================================================
--- trunk/cross-make-mingw.sh 2005-12-28 23:05:22 UTC (rev 450)
+++ trunk/cross-make-mingw.sh 2005-12-29 00:04:41 UTC (rev 451)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+PREFIX=/usr/local/cross-tools
+TARGET=i386-mingw32msvc
+PATH="$PREFIX/bin:$PREFIX/$TARGET/bin:$PATH"
+export PATH
+export PLATFORM=mingw32
+exec make $*
Property changes on: trunk/cross-make-mingw.sh
___________________________________________________________________
Name: svn:executable
+ *
More information about the quake3-commits
mailing list