From be9bab48be8a671f48def9d550d1028e0162b464 Mon Sep 17 00:00:00 2001 From: relnev Date: Wed, 19 Jun 2002 04:52:45 +0000 Subject: [PATCH] MacOS X updates (Ryan) --- Makefile | 17 ++++++++++++++--- README | 6 ++++++ include/osapi.h | 3 +++ include/pstypes.h | 11 +++++++++++ src/graphics/gropengl.cpp | 8 ++++++++ src/inetfile/cftp.cpp | 4 ++++ 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index abddddd..5a582f3 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,26 @@ # Makefile for code module # for that freespace 2 thing +MACOSX=false + CC=g++ AR=ar +RANLIB=ranlib CODE_BINARY=code.a FS_BINARY=freespace2 -LDFLAGS=$(shell sdl-config --libs) -lGL -lopenal +LDFLAGS=$(shell sdl-config --libs) -lopenal CFLAGS=-Wall -g -DPLAT_UNIX $(shell sdl-config --cflags) -Iinclude/ -fwritable-strings #CFLAGS+=-O2 #CFLAGS+=-DNDEBUG #CFLAGS+=-funroll-loops # -fomit-frame-pointer # not stable? #CFLAGS+=-march=pentiumpro -mcpu=pentiumpro # not stable? -CFLAGS+=-Wno-missing-braces -Wno-multichar +CFLAGS+=-Wno-missing-braces -Wno-multichar -fsigned-char + +ifeq ($(strip $(MACOSX)),true) + CFLAGS+=-D__MACOSX__=1 -I/System/Library/Frameworks/AGL.framework/Headers +else + LDFLAGS+= -lGL +endif %.o: %.cpp $(CC) -c -o $@ $< $(CFLAGS) @@ -261,7 +270,9 @@ all: $(FS_BINARY) $(CODE_BINARY): $(CODE_OBJECTS) rm -rf $(CODE_BINARY) $(AR) rc $(CODE_BINARY) $(CODE_OBJECTS) -# $(RANLIB) $(CODE_BINARY) +ifeq ($(strip $(MACOSX)),true) + $(RANLIB) $(CODE_BINARY) +endif $(FS_BINARY): $(CODE_BINARY) $(FS_OBJECTS) $(CC) -o $(FS_BINARY) $(LDFLAGS) $(FS_OBJECTS) $(CODE_BINARY) diff --git a/README b/README index 4e60785..7bdaa15 100644 --- a/README +++ b/README @@ -6,6 +6,7 @@ Linux port hacked together by: Dan Olson Steven Fuller Charles Mason +Ryan C. Gordon This project is NOT supported by Volition or Interplay. @@ -45,6 +46,11 @@ not tested. Linux-specific code is separated by a PLAT_UNIX define). Fred2, etc., were not touched. +- This code builds on MacOS X. Get the latest toolchain from Apple. Flip the +MACOSX flag in the Makefile to "true" and run "make" from a terminal in the +root of the source directory. Note that the game compiles and links, but will +NOT run at this time, due to byte ordering bugs in the source. + For more information about the game and its source code: http://www.freespace2.com/ http://www.volitionwatch.com/ diff --git a/include/osapi.h b/include/osapi.h index 48755ae..2136dbb 100644 --- a/include/osapi.h +++ b/include/osapi.h @@ -10,6 +10,9 @@ #define _OSAPI_H #include + +#include "pstypes.h" + // -------------------------------------------------------------------------------------------------- // OSAPI DEFINES/VARS // diff --git a/include/pstypes.h b/include/pstypes.h index 4907568..f3b280f 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -15,6 +15,9 @@ * Header file containg global typedefs, constants and macros * * $Log$ + * Revision 1.6 2002/06/19 04:52:45 relnev + * MacOS X updates (Ryan) + * * Revision 1.5 2002/06/17 06:33:08 relnev * ryan's struct patch for gcc 2.95 * @@ -226,7 +229,11 @@ #include // For NULL, etc #include #include + +#ifndef __MACOSX__ #include +#endif + #include #ifdef PLAT_UNIX @@ -248,6 +255,10 @@ #define LOCAL static // make module local varilable static. +#ifdef __MACOSX__ +typedef int socklen_t; +#endif + typedef __int64 longlong; typedef long fix; typedef unsigned char ubyte; diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index 8bd8698..8ee0ed7 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -15,6 +15,9 @@ * Code that uses the OpenGL graphics library * * $Log$ + * Revision 1.51 2002/06/19 04:52:45 relnev + * MacOS X updates (Ryan) + * * Revision 1.50 2002/06/18 23:20:44 relnev * fixed _splitpath. * @@ -286,7 +289,12 @@ #include #include #endif + +#ifdef __MACOSX__ +#include +#else #include +#endif #include "pstypes.h" #include "osapi.h" diff --git a/src/inetfile/cftp.cpp b/src/inetfile/cftp.cpp index 4716b56..2dc93aa 100644 --- a/src/inetfile/cftp.cpp +++ b/src/inetfile/cftp.cpp @@ -15,6 +15,9 @@ * FTP Client class (get only) * * $Log$ + * Revision 1.10 2002/06/19 04:52:45 relnev + * MacOS X updates (Ryan) + * * Revision 1.9 2002/06/17 06:33:09 relnev * ryan's struct patch for gcc 2.95 * @@ -80,6 +83,7 @@ #include #include +#include "pstypes.h" #include "cftp.h" void FTPObjThread( void * obj ) -- 2.39.2