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