From: Rudolf Polzer Date: Tue, 22 Sep 2015 19:22:17 +0000 (-0400) Subject: Make the engine start up in PNaCl. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c437eb4f4bf01771031b11a460b0b4f8ae3285c0;p=xonotic%2Fdarkplaces.git Make the engine start up in PNaCl. --- diff --git a/makefile b/makefile index 1086e869..97f428b1 100644 --- a/makefile +++ b/makefile @@ -149,12 +149,13 @@ ifeq ($(DP_MAKE_TARGET), pnacl) # TODO is there a better way to get this path? # TODO is net/if.h really missing? - CFLAGS_EXTRA=-I$(HOME)/nacl_sdk/pepper_44/include/pnacl -DNOSUPPORTIPV6 + CFLAGS_EXTRA=-I$(HOME)/nacl_sdk/pepper_44/include -I$(HOME)/nacl_sdk/pepper_44/include/pnacl $(SDLCONFIG_CFLAGS) -DNOSUPPORTIPV6 CFLAGS_SSE= CFLAGS_SSE2= # TODO use pnacl-finalize and pnacl-compress - STRIP=: + CC=$(HOME)/nacl_sdk/pepper_44/toolchain/linux_pnacl/bin/pnacl-clang++ + STRIP=$(HOME)/nacl_sdk/pepper_44/toolchain/linux_pnacl/bin/pnacl-finalize --compress endif # Mac OS X configuration diff --git a/quakedef.h b/quakedef.h index 60d5db30..545d920b 100644 --- a/quakedef.h +++ b/quakedef.h @@ -431,6 +431,10 @@ extern cvar_t sessionid; # define LINK_TO_LIBVORBIS 1 # define DP_MOBILETOUCH 1 # define DP_FREETYPE_STATIC 1 +#elif defined(__native_client__) /* must come first because it also defines linux */ +# define DP_OS_NAME "NaCl" +# define DP_OS_STR "nacl" +# define USE_GLES2 1 #elif TARGET_OS_IPHONE /* must come first because it also defines MACOSX */ # define DP_OS_NAME "iPhoneOS" # define DP_OS_STR "iphoneos" diff --git a/sys_sdl.c b/sys_sdl.c index 5fd4c3af..54651b44 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -201,6 +201,18 @@ void Sys_InitConsole (void) { } +#ifdef __native_client__ +#include +static void NaCl_Init(void) +{ + mount("", "/dev", "dev", 0, ""); + mount("", "/.persistentfs", "html5fs", 0, "type=PERSISTENT,expected_size=8388608"); + mount("", "/.tempfs", "html5fs", 0, "type=TEMPORARY,expected_size=1073741824"); + int fd = open("/dev/console0", O_WRONLY, 0644); + outfd = fd; +} +#endif + int main (int argc, char *argv[]) { signal(SIGFPE, SIG_IGN); @@ -229,6 +241,10 @@ int main (int argc, char *argv[]) // we don't know which systems we'll want to init, yet... SDL_Init(0); +#ifdef __native_client__ + NaCl_Init(); +#endif + Host_Main(); return 0;