Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: ports/quakespasm/nacl.patch

Issue 337323007: Add quakespasm, and OpenGL+SDL-based port of quake1. (Closed) Base URL: https://naclports.googlecode.com/svn/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ports/quakespasm/index.html ('k') | ports/quakespasm/pkg_info » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ports/quakespasm/nacl.patch
diff --git a/ports/quakespasm/nacl.patch b/ports/quakespasm/nacl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3175e6005263d315d8675d8190b743e0b4994a35
--- /dev/null
+++ b/ports/quakespasm/nacl.patch
@@ -0,0 +1,221 @@
+diff --git a/Quake/Makefile b/Quake/Makefile
+index 6ad9a72..840064a 100644
+--- a/Quake/Makefile
++++ b/Quake/Makefile
+@@ -14,7 +14,7 @@ USE_CODEC_MP3=1
+ USE_CODEC_VORBIS=1
+
+ # which library to use for mp3 decoding: mad or mpg123
+-MP3LIB=mad
++MP3LIB=mpg123
+ # which library to use for ogg decoding: vorbis or tremor
+ VORBISLIB=vorbis
+
+@@ -45,11 +45,19 @@ STRIP ?= strip
+ #CPUFLAGS= -mtune=k8
+ #CPUFLAGS= -march=atom
+ CPUFLAGS=
+-LDFLAGS =
++LDFLAGS ?=
+ DFLAGS ?=
+-CFLAGS ?= -Wall -Wno-trigraphs
++CFLAGS ?= -Wall
++CFLAGS += -Wno-unused-result -Wno-trigraphs
++CFLAGS += -DREGAL_NO_ENUM_GL_EXT_TEXTURE_FILTER_ANISOTROPIC -DREGAL_NO_ENUM_GL_SGIX_VERTEX_PRECLIP_HINT
+ CFLAGS += $(CPUFLAGS)
+
++ifneq ($(V),1)
++RUN_CC = @echo " CC " $@;
++RUN_CCLD = @echo " CCLD " $@;
++RUN_STRIP = @echo " STRIP " $@;
++endif
++
+ ifneq ($(DEBUG),0)
+ DFLAGS += -DDEBUG
+ CFLAGS += -g
+@@ -59,7 +67,7 @@ DFLAGS += -DNDEBUG
+ CFLAGS += -O2
+ CFLAGS += $(call check_gcc,-fweb,)
+ CFLAGS += $(call check_gcc,-frename-registers,)
+-cmd_strip=$(STRIP) $(1)
++cmd_strip=$(RUN_STRIP)$(STRIP) $(1)
+ define do_strip
+ $(call cmd_strip,$(1));
+ endef
+@@ -81,8 +89,8 @@ X11BASE_GUESS := $(shell \
+ X11BASE ?= $(X11BASE_GUESS)
+
+ ifneq ($(X11BASE),)
+-LDFLAGS+= -L$(X11BASE)/lib
+-CFLAGS += -I$(X11BASE)/include
++LDFLAGS += -L$(X11BASE)/lib
++CPPFLAGS += -I$(X11BASE)/include
+ endif
+
+ SDL_CONFIG ?= sdl-config
+@@ -91,7 +99,7 @@ SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
+
+ ifeq ($(SDLNET),1)
+ NET_LIBS :=-lSDL_net
+-CFLAGS +=-D_USE_SDLNET
++CPPFLAGS +=-D_USE_SDLNET
+ else
+ ifeq ($(HOST_OS),sunos)
+ NET_LIBS :=-lsocket -lnsl -lresolv
+@@ -101,7 +109,7 @@ endif
+ endif
+
+ ifeq ($(USE_QS_CONBACK),1)
+-CFLAGS+= -DUSE_QS_CONBACK
++CPPFLAGS += -DUSE_QS_CONBACK
+ endif
+
+ ifneq ($(VORBISLIB),vorbis)
+@@ -133,18 +141,21 @@ endif
+
+ CODECLIBS :=
+ ifeq ($(USE_CODEC_WAVE),1)
+-CFLAGS+= -DUSE_CODEC_WAVE
++CPPFLAGS += -DUSE_CODEC_WAVE
+ endif
+ ifeq ($(USE_CODEC_VORBIS),1)
+-CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
++CPPFLAGS += -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
+ CODECLIBS+= $(lib_vorbisdec)
+ endif
+ ifeq ($(USE_CODEC_MP3),1)
+-CFLAGS+= -DUSE_CODEC_MP3
++CPPFLAGS+= -DUSE_CODEC_MP3
+ CODECLIBS+= $(lib_mp3dec)
+ endif
+
+-COMMON_LIBS:= -lm -lGL
++COMMON_LIBS := -lm
++ifndef NACL_ARCH
++COMMON_LIBS += -lGL
++endif
+
+ LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)
+
+@@ -154,14 +165,14 @@ LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)
+
+ .PHONY: clean debug release
+
+-DEFAULT_TARGET := quakespasm
++DEFAULT_TARGET := quakespasm$(EXEEXT)
+
+ # ---------------------------
+ # rules
+ # ---------------------------
+
+ %.o: %.c
+- $(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
++ $(RUN_CC)$(CC) $(DFLAGS) -c $(CPPFLAGS) $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
+
+ # ----------------------------------------------------------------------------
+ # objects
+@@ -254,11 +265,11 @@ OBJS := strlcat.o \
+ # Linux build rules
+ # ------------------------
+
+-quakespasm: $(OBJS)
+- $(LINKER) $(OBJS) $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@
++quakespasm$(EXEEXT): $(OBJS)
++ $(RUN_CCLD)$(LINKER) $(OBJS) $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@
+ $(call do_strip,$@)
+
+-release: quakespasm
++release: quakespasm$(EXEEXT)
+ debug:
+ $(error Use "make DEBUG=1")
+
+diff --git a/Quake/net_udp.c b/Quake/net_udp.c
+index 92ab2a5..04b6f9c 100644
+--- a/Quake/net_udp.c
++++ b/Quake/net_udp.c
+@@ -132,7 +132,9 @@ sys_socket_t UDP_OpenSocket (int port)
+ {
+ sys_socket_t newsocket;
+ struct sockaddr_in address;
++#ifdef FIONBIO
+ int _true = 1;
++#endif
+ int err;
+
+ if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET)
+@@ -142,8 +144,10 @@ sys_socket_t UDP_OpenSocket (int port)
+ return INVALID_SOCKET;
+ }
+
++#ifdef FIONBIO
+ if (ioctlsocket (newsocket, FIONBIO, &_true) == SOCKET_ERROR)
+ goto ErrorReturn;
++#endif
+
+ memset(&address, 0, sizeof(struct sockaddr_in));
+ address.sin_family = AF_INET;
+@@ -152,7 +156,9 @@ sys_socket_t UDP_OpenSocket (int port)
+ if (bind (newsocket, (struct sockaddr *)&address, sizeof(address)) == 0)
+ return newsocket;
+
++#ifdef FIONBIO
+ ErrorReturn:
++#endif
+ err = SOCKETERRNO;
+ Con_SafePrintf("UDP_OpenSocket: %s\n", socketerror(err));
+ UDP_CloseSocket (newsocket);
+@@ -235,7 +241,9 @@ int UDP_Connect (sys_socket_t socketid, struct qsockaddr *addr)
+
+ sys_socket_t UDP_CheckNewConnections (void)
+ {
++#ifdef FIONREAD
+ int available;
++#endif
+ struct sockaddr_in from;
+ socklen_t fromlen;
+ char buff[1];
+@@ -243,6 +251,7 @@ sys_socket_t UDP_CheckNewConnections (void)
+ if (net_acceptsocket == INVALID_SOCKET)
+ return INVALID_SOCKET;
+
++#ifdef FIONREAD
+ if (ioctl (net_acceptsocket, FIONREAD, &available) == -1)
+ {
+ int err = SOCKETERRNO;
+@@ -250,6 +259,8 @@ sys_socket_t UDP_CheckNewConnections (void)
+ }
+ if (available)
+ return net_acceptsocket;
++#endif
++
+ // quietly absorb empty packets
+ recvfrom (net_acceptsocket, buff, 0, 0, (struct sockaddr *) &from, &fromlen);
+ return INVALID_SOCKET;
+@@ -382,6 +393,7 @@ int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr)
+
+ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
+ {
++#ifndef __native_client__
+ struct hostent *hostentry;
+
+ hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr,
+@@ -391,6 +403,7 @@ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
+ strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);
+ return 0;
+ }
++#endif
+
+ strcpy (name, UDP_AddrToString (addr));
+ return 0;
+diff --git a/Quake/sys_sdl_unix.c b/Quake/sys_sdl_unix.c
+index fcdff11..0b211c4 100644
+--- a/Quake/sys_sdl_unix.c
++++ b/Quake/sys_sdl_unix.c
+@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <sys/time.h>
++#include <sys/select.h>
+ #include <fcntl.h>
+ #include <time.h>
+
« no previous file with comments | « ports/quakespasm/index.html ('k') | ports/quakespasm/pkg_info » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698