]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Make the engine start up in PNaCl.
authorRudolf Polzer <divVerent@xonotic.org>
Tue, 22 Sep 2015 19:22:17 +0000 (15:22 -0400)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 22 Sep 2015 19:22:17 +0000 (15:22 -0400)
makefile
quakedef.h
sys_sdl.c

index 1086e869ea497de98d9caeedc65fea34e7878d13..97f428b136c3cd8b9289fdcd9b1d482d9be0a3e7 100644 (file)
--- 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
index 60d5db3004a84d52852513b8756d4fc1deda18d6..545d920bc9771d8edd853fa69619a3d0f4e53d05 100644 (file)
@@ -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"
index 5fd4c3af55ccdd4ad238b76619daefdc055c9de1..54651b44698a8ab106c4a2e10b059299a6bc89f1 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -201,6 +201,18 @@ void Sys_InitConsole (void)
 {
 }
 
+#ifdef __native_client__
+#include <sys/mount.h>
+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;