Adds missing Makefile for NACL test and a couple of smaller fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
diff --git a/build-scripts/naclbuild.sh b/build-scripts/naclbuild.sh
old mode 100644
new mode 100755
diff --git a/test/nacl/Makefile b/test/nacl/Makefile
new file mode 100644
index 0000000..f09e83f
--- /dev/null
+++ b/test/nacl/Makefile
@@ -0,0 +1,63 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# GNU Makefile based on shared rules provided by the Native Client SDK.
+# See README.Makefiles for more details.
+
+VALID_TOOLCHAINS := pnacl
+
+# NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../../..)
+include $(NACL_SDK_ROOT)/tools/common.mk
+
+
+TARGET = sdl_app
+DEPS = ppapi_simple nacl_io
+# ppapi_simple ends up being listed twice due to dependency solving issues -- Gabriel
+LIBS = SDL2_test SDL2 ppapi_simple SDL2main $(DEPS) ppapi_gles2 ppapi_cpp ppapi pthread
+
+CFLAGS := -Wall
+SOURCES ?= testgles2.c
+
+# Build rules generated by macros from common.mk:
+# Overriden macro from NACL SDK to be able to customize the library search path -- Gabriel
+# Specific Link Macro
+#
+# $1 = Target Name
+# $2 = List of inputs
+# $3 = List of libs
+# $4 = List of deps
+# $5 = List of lib dirs
+# $6 = Other Linker Args
+#
+# For debugging, we translate the pre-finalized .bc file.
+#
+define LINKER_RULE
+all: $(1).pexe
+$(1)_x86_32.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-32 $$^ -o $$@)
+
+$(1)_x86_64.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-64 $$^ -o $$@)
+
+$(1)_arm.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch arm $$^ -o $$@)
+
+$(1).pexe: $(1).bc
+ $(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^)
+
+$(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
+ $(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(PNACL_LDFLAGS) $(foreach path,$(5),-L$(path)/pnacl/$(CONFIG)) -L./lib $(foreach lib,$(3),-l$(lib)) $(6))
+endef
+
+$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep))))
+$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
+
+ifeq ($(CONFIG),Release)
+$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
+$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
+else
+$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
+endif
+
+$(eval $(call NMF_RULE,$(TARGET),))
diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c
index 019107f..52c90c2 100644
--- a/test/testmultiaudio.c
+++ b/test/testmultiaudio.c
@@ -133,6 +133,16 @@ main(int argc, char **argv)
}
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+
+ #if __NACL__
+ SDL_RWUmount("/");
+ SDL_RWMount(
+ "", /* source */
+ "/", /* target */
+ "httpfs", /* filesystemtype */
+ 0, /* mountflags */
+ ""); /* data specific to the html5fs type */
+#endif
devcount = SDL_GetNumAudioDevices(0);
if (devcount < 1) {