mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
Build fix for OSX/PowerPC
git-svn-id: https://svn.eduke32.com/eduke32@1935 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a9290a0d29
commit
563d42856e
10 changed files with 86 additions and 39 deletions
|
@ -34,8 +34,7 @@ else
|
|||
endif
|
||||
|
||||
OURCFLAGS=$(BASECFLAGS) \
|
||||
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include \
|
||||
$(ARCH)
|
||||
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include
|
||||
|
||||
OURCXXFLAGS=$(BASECXXFLAGS)
|
||||
NASMFLAGS=$(BASEASFLAGS)
|
||||
|
@ -62,7 +61,9 @@ else
|
|||
LIBS+= -pthread
|
||||
endif
|
||||
ifneq (0,$(PROFILER))
|
||||
LIBS+= -lprofiler
|
||||
ifneq ($(PLATFORM),DARWIN)
|
||||
LIBS+= -lprofiler
|
||||
endif
|
||||
debug+= -pg
|
||||
endif
|
||||
OBJ=obj
|
||||
|
|
|
@ -93,6 +93,7 @@ else
|
|||
debug+= -fmudflapth
|
||||
endif
|
||||
ifneq (0,$(PROFILER))
|
||||
# might need to be disabled for Darwin:
|
||||
LIBS+= -lprofiler
|
||||
debug+= -pg
|
||||
endif
|
||||
|
@ -109,7 +110,7 @@ W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(W_NO_UNUSED_RESULT))
|
|||
|
||||
BASECFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
|
||||
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
|
||||
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) \
|
||||
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) $(ARCH) \
|
||||
-Wextra -Wstrict-overflow=1 #-Wwrite-strings -Waddress -Wlogical-op
|
||||
ifneq (0,$(USE_LIBPNG))
|
||||
BASECFLAGS+= -DUSE_LIBPNG
|
||||
|
|
|
@ -108,8 +108,10 @@ ifeq ($(PLATFORM),LINUX)
|
|||
ASFLAGS+= -f elf
|
||||
endif
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \
|
||||
$(OBJ)//osxbits.$o
|
||||
ifneq ($(findstring ppc,$(ARCH)),ppc)
|
||||
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o
|
||||
endif
|
||||
ENGINEOBJS += $(OBJ)/osxbits.$o
|
||||
ASFLAGS += -DUNDERSCORES -f macho
|
||||
OURCFLAGS += -DUNDERSCORES -fno-pic
|
||||
TARGETOPTS += -DNOASM
|
||||
|
|
|
@ -101,6 +101,9 @@ ifeq ($(PLATFORM),DARWIN)
|
|||
BUILDCFLAGS += $(F_NO_STACK_PROTECTOR) -arch i386
|
||||
else
|
||||
# ASM won't work on PowerPC or x86_64
|
||||
ifeq ($(findstring ppc,$(ARCH)),ppc)
|
||||
BUILDCFLAGS += $(F_NO_STACK_PROTECTOR)
|
||||
endif
|
||||
override NOASM = 1
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -120,6 +120,9 @@ static inline float nearbyintf(float x)
|
|||
# define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
// redefined for apple/ppc, which chokes on stderr when linking...
|
||||
#define ERRprintf(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
|
||||
|
||||
#if defined(__linux)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
@ -145,12 +148,18 @@ static inline float nearbyintf(float x)
|
|||
# define B_SWAP16(x) __bswap16(x)
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
#if defined __i386__ && defined __GNUC__
|
||||
// PK 20110617: is*() crashes for me in x86 code compiled from 64-bit.
|
||||
#if !defined __x86_64__ && defined __GNUC__
|
||||
// PK 20110617: is*() crashes for me in x86 code compiled from 64-bit, and gives link errors on ppc
|
||||
// This hack patches all occurences.
|
||||
# define isdigit(ch) ({ int32_t c__dontuse_=ch; c__dontuse_>='0' && c__dontuse_<='9'; })
|
||||
# define isalpha(ch) ({ int32_t c__dontuse2_=ch; (c__dontuse2_>='A' && c__dontuse2_<='Z') || (c__dontuse2_>='a' && c__dontuse2_<='z'); })
|
||||
# define isalnum(ch2) ({ int32_t c2__dontuse_=ch2; isalpha(c2__dontuse_) || isdigit(c2__dontuse_); })
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define isspace(ch) ({ int32_t c__dontuse_=ch; (c__dontuse_==' ' || c__dontuse_=='\t' || c__dontuse_=='\n' || c__dontuse_=='\v' || c__dontuse_=='\f' || c__dontuse_=='\r'); })
|
||||
# define isprint(ch) ({ int32_t c__dontuse_=ch; (c__dontuse_>=0x20 && c__dontuse_<0x7f); })
|
||||
# undef ERRprintf
|
||||
# define ERRprintf(fmt, ...) printf(fmt, ## __VA_ARGS__)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__LITTLE_ENDIAN__)
|
||||
# define B_LITTLE_ENDIAN 1
|
||||
|
|
|
@ -7459,7 +7459,7 @@ static void sighandler(int32_t sig, const siginfo_t *info, void *ctx)
|
|||
default:
|
||||
s = "?! (unknown)"; break;
|
||||
}
|
||||
fprintf(stderr, "Caught SIGFPE at address %p, code %s. Aborting.\n", info->si_addr, s);
|
||||
ERRprintf("Caught SIGFPE at address %p, code %s. Aborting.\n", info->si_addr, s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
# include "osxbits.h"
|
||||
#elif defined HAVE_GTK2
|
||||
# include "gtkbits.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if (!defined __APPLE__ && !defined HAVE_GTK2) || (defined __APPLE__ && defined __BIG_ENDIAN__)
|
||||
int32_t startwin_open(void) { return 0; }
|
||||
int32_t startwin_close(void) { return 0; }
|
||||
int32_t startwin_puts(const char *s) { s=s; return 0; }
|
||||
|
@ -185,6 +187,7 @@ int32_t main(int32_t argc, char *argv[])
|
|||
_buildargc = argc;
|
||||
_buildargv = (const char **)argv;
|
||||
|
||||
#if !(defined __APPLE__ && defined __BIG_ENDIAN__)
|
||||
// pipe standard outputs to files
|
||||
if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL)
|
||||
if (!Bstrcasecmp(argp, "TRUE"))
|
||||
|
@ -201,6 +204,7 @@ int32_t main(int32_t argc, char *argv[])
|
|||
*stderr = *fp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if ((argp = Bgetenv("BUILD_NOFOG")) != NULL)
|
||||
|
@ -231,7 +235,7 @@ void setvsync(int32_t sync)
|
|||
static void attach_debugger_here(void) {}
|
||||
|
||||
/* XXX: libexecinfo could be used on systems without gnu libc. */
|
||||
#if defined __GNUC__ && !defined __OpenBSD__
|
||||
#if defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__)
|
||||
# define PRINTSTACKONSEGV 1
|
||||
# include <execinfo.h>
|
||||
#endif
|
||||
|
@ -426,7 +430,7 @@ void initprintf(const char *f, ...)
|
|||
//
|
||||
void debugprintf(const char *f, ...)
|
||||
{
|
||||
#ifdef DEBUGGINGAIDS
|
||||
#if defined DEBUGGINGAIDS && !(defined __APPLE__ && defined __BIG_ENDIAN__)
|
||||
va_list va;
|
||||
|
||||
va_start(va,f);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# build debug/release x86/x64 versions of mapster32 and eduke32 on OSX
|
||||
# build debug/release x86/x64/ppc versions of mapster32 and eduke32 on OSX
|
||||
|
||||
if [ `uname -s` != Darwin ]; then
|
||||
echo This script is for OSX only.
|
||||
|
@ -19,15 +19,15 @@ if [ $1 ]; then
|
|||
fi
|
||||
|
||||
if [ $onlyzip -eq 0 ]; then
|
||||
make veryclean
|
||||
WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo 64-bit debug build succeeded.
|
||||
cp mapster32 mapster32.debug.x64
|
||||
cp eduke32 eduke32.debug.x64
|
||||
else
|
||||
echo 64-bit debug build failed.
|
||||
fi
|
||||
# make veryclean
|
||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo 64-bit debug build succeeded.
|
||||
# cp mapster32 mapster32.debug.x64
|
||||
# cp eduke32 eduke32.debug.x64
|
||||
# else
|
||||
# echo 64-bit debug build failed.
|
||||
# fi
|
||||
|
||||
make veryclean
|
||||
WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 make -j 3
|
||||
|
@ -39,15 +39,15 @@ if [ $onlyzip -eq 0 ]; then
|
|||
echo 64-bit release build failed.
|
||||
fi
|
||||
|
||||
make veryclean
|
||||
WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 make -j 3
|
||||
if [ $? ]; then
|
||||
echo 32-bit debug build succeeded.
|
||||
cp mapster32 mapster32.debug.x86
|
||||
cp eduke32 eduke32.debug.x86
|
||||
else
|
||||
echo 32-bit debug build failed.
|
||||
fi
|
||||
# make veryclean
|
||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo 32-bit debug build succeeded.
|
||||
# cp mapster32 mapster32.debug.x86
|
||||
# cp eduke32 eduke32.debug.x86
|
||||
# else
|
||||
# echo 32-bit debug build failed.
|
||||
# fi
|
||||
|
||||
make veryclean
|
||||
WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=1 make -j 3
|
||||
|
@ -58,18 +58,40 @@ if [ $onlyzip -eq 0 ]; then
|
|||
else
|
||||
echo 32-bit release build failed.
|
||||
fi
|
||||
|
||||
# make veryclean
|
||||
# ARCH='-arch ppc' WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo PowerPC debug build succeeded.
|
||||
# cp mapster32 mapster32.debug.ppc
|
||||
# cp eduke32 eduke32.debug.ppc
|
||||
# else
|
||||
# echo PowerPC debug build failed.
|
||||
# fi
|
||||
|
||||
make veryclean
|
||||
ARCH='-arch ppc' WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo PowerPC release build succeeded.
|
||||
cp mapster32 mapster32.ppc
|
||||
cp eduke32 eduke32.ppc
|
||||
else
|
||||
echo PowerPC release build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
# Almost done...
|
||||
if [ -f mapster32.debug.x64 ] && [ -f mapster32.x64 ] && [ -f eduke32.debug.x86 ] && [ -f eduke32.x86 ]; then
|
||||
if [ -f mapster32.x64 ] && [ -f eduke32.x86 ] && [ -f eduke32.ppc ]; then
|
||||
echo Creating fat binaries.
|
||||
lipo -create mapster32.x64 mapster32.x86 -output mapster32
|
||||
lipo -create mapster32.debug.x64 mapster32.debug.x86 -output mapster32.debug
|
||||
lipo -create eduke32.x64 eduke32.x86 -output eduke32
|
||||
lipo -create eduke32.debug.x64 eduke32.debug.x86 -output eduke32.debug
|
||||
lipo -create mapster32.x64 mapster32.x86 mapster32.ppc -output mapster32
|
||||
# lipo -create mapster32.debug.x64 mapster32.debug.x86 -output mapster32.debug
|
||||
lipo -create eduke32.x64 eduke32.x86 eduke32.ppc -output eduke32
|
||||
# lipo -create eduke32.debug.x64 eduke32.debug.x86 -output eduke32.debug
|
||||
rev=`svn info | grep Revision | awk '{ print $2 }'`
|
||||
arfilename="eduke32-osx-$rev.zip"
|
||||
echo "This archive was produced from revision $rev by the osxbuild.sh script." > README.OSX
|
||||
echo "EDuke32 home: http://www.eduke32.com" >> README.OSX
|
||||
echo "OSX build discussion on Duke4.net: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/" >> README.OSX
|
||||
rm -f "$arfilename"
|
||||
zip "$arfilename" mapster32 eduke32 README.OSX
|
||||
fi
|
||||
|
|
|
@ -9304,7 +9304,7 @@ static void G_Startup(void)
|
|||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
G_Cleanup();
|
||||
fprintf(stderr, "G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
exit(6);
|
||||
}
|
||||
|
||||
|
@ -9764,7 +9764,7 @@ int32_t app_main(int32_t argc,const char **argv)
|
|||
{
|
||||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
fprintf(stderr, "app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
@ -10125,7 +10125,7 @@ CLEAN_DIRECTORY:
|
|||
{
|
||||
if (CONTROL_Startup(1, &GetTime, TICRATE))
|
||||
{
|
||||
fprintf(stderr, "There was an error initializing the CONTROL system.\n");
|
||||
ERRprintf("There was an error initializing the CONTROL system.\n");
|
||||
uninitengine();
|
||||
exit(5);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined __APPLE__ && defined __BIG_ENDIAN__
|
||||
// is* hacks for ppc...
|
||||
# include "compat.h"
|
||||
#endif
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "cache1d.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue