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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 diff --git a/Quake/Makefile b/Quake/Makefile
2 index 6ad9a72..840064a 100644
3 --- a/Quake/Makefile
4 +++ b/Quake/Makefile
5 @@ -14,7 +14,7 @@ USE_CODEC_MP3=1
6 USE_CODEC_VORBIS=1
7
8 # which library to use for mp3 decoding: mad or mpg123
9 -MP3LIB=mad
10 +MP3LIB=mpg123
11 # which library to use for ogg decoding: vorbis or tremor
12 VORBISLIB=vorbis
13
14 @@ -45,11 +45,19 @@ STRIP ?= strip
15 #CPUFLAGS= -mtune=k8
16 #CPUFLAGS= -march=atom
17 CPUFLAGS=
18 -LDFLAGS =
19 +LDFLAGS ?=
20 DFLAGS ?=
21 -CFLAGS ?= -Wall -Wno-trigraphs
22 +CFLAGS ?= -Wall
23 +CFLAGS += -Wno-unused-result -Wno-trigraphs
24 +CFLAGS += -DREGAL_NO_ENUM_GL_EXT_TEXTURE_FILTER_ANISOTROPIC -DREGAL_NO_ENUM_GL_ SGIX_VERTEX_PRECLIP_HINT
25 CFLAGS += $(CPUFLAGS)
26
27 +ifneq ($(V),1)
28 +RUN_CC = @echo " CC " $@;
29 +RUN_CCLD = @echo " CCLD " $@;
30 +RUN_STRIP = @echo " STRIP " $@;
31 +endif
32 +
33 ifneq ($(DEBUG),0)
34 DFLAGS += -DDEBUG
35 CFLAGS += -g
36 @@ -59,7 +67,7 @@ DFLAGS += -DNDEBUG
37 CFLAGS += -O2
38 CFLAGS += $(call check_gcc,-fweb,)
39 CFLAGS += $(call check_gcc,-frename-registers,)
40 -cmd_strip=$(STRIP) $(1)
41 +cmd_strip=$(RUN_STRIP)$(STRIP) $(1)
42 define do_strip
43 $(call cmd_strip,$(1));
44 endef
45 @@ -81,8 +89,8 @@ X11BASE_GUESS := $(shell \
46 X11BASE ?= $(X11BASE_GUESS)
47
48 ifneq ($(X11BASE),)
49 -LDFLAGS+= -L$(X11BASE)/lib
50 -CFLAGS += -I$(X11BASE)/include
51 +LDFLAGS += -L$(X11BASE)/lib
52 +CPPFLAGS += -I$(X11BASE)/include
53 endif
54
55 SDL_CONFIG ?= sdl-config
56 @@ -91,7 +99,7 @@ SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
57
58 ifeq ($(SDLNET),1)
59 NET_LIBS :=-lSDL_net
60 -CFLAGS +=-D_USE_SDLNET
61 +CPPFLAGS +=-D_USE_SDLNET
62 else
63 ifeq ($(HOST_OS),sunos)
64 NET_LIBS :=-lsocket -lnsl -lresolv
65 @@ -101,7 +109,7 @@ endif
66 endif
67
68 ifeq ($(USE_QS_CONBACK),1)
69 -CFLAGS+= -DUSE_QS_CONBACK
70 +CPPFLAGS += -DUSE_QS_CONBACK
71 endif
72
73 ifneq ($(VORBISLIB),vorbis)
74 @@ -133,18 +141,21 @@ endif
75
76 CODECLIBS :=
77 ifeq ($(USE_CODEC_WAVE),1)
78 -CFLAGS+= -DUSE_CODEC_WAVE
79 +CPPFLAGS += -DUSE_CODEC_WAVE
80 endif
81 ifeq ($(USE_CODEC_VORBIS),1)
82 -CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
83 +CPPFLAGS += -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
84 CODECLIBS+= $(lib_vorbisdec)
85 endif
86 ifeq ($(USE_CODEC_MP3),1)
87 -CFLAGS+= -DUSE_CODEC_MP3
88 +CPPFLAGS+= -DUSE_CODEC_MP3
89 CODECLIBS+= $(lib_mp3dec)
90 endif
91
92 -COMMON_LIBS:= -lm -lGL
93 +COMMON_LIBS := -lm
94 +ifndef NACL_ARCH
95 +COMMON_LIBS += -lGL
96 +endif
97
98 LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)
99
100 @@ -154,14 +165,14 @@ LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)
101
102 .PHONY: clean debug release
103
104 -DEFAULT_TARGET := quakespasm
105 +DEFAULT_TARGET := quakespasm$(EXEEXT)
106
107 # ---------------------------
108 # rules
109 # ---------------------------
110
111 %.o: %.c
112 - $(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
113 + $(RUN_CC)$(CC) $(DFLAGS) -c $(CPPFLAGS) $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
114
115 # ----------------------------------------------------------------------------
116 # objects
117 @@ -254,11 +265,11 @@ OBJS := strlcat.o \
118 # Linux build rules
119 # ------------------------
120
121 -quakespasm: $(OBJS)
122 - $(LINKER) $(OBJS) $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@
123 +quakespasm$(EXEEXT): $(OBJS)
124 + $(RUN_CCLD)$(LINKER) $(OBJS) $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@
125 $(call do_strip,$@)
126
127 -release: quakespasm
128 +release: quakespasm$(EXEEXT)
129 debug:
130 $(error Use "make DEBUG=1")
131
132 diff --git a/Quake/net_udp.c b/Quake/net_udp.c
133 index 92ab2a5..04b6f9c 100644
134 --- a/Quake/net_udp.c
135 +++ b/Quake/net_udp.c
136 @@ -132,7 +132,9 @@ sys_socket_t UDP_OpenSocket (int port)
137 {
138 sys_socket_t newsocket;
139 struct sockaddr_in address;
140 +#ifdef FIONBIO
141 int _true = 1;
142 +#endif
143 int err;
144
145 if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_S OCKET)
146 @@ -142,8 +144,10 @@ sys_socket_t UDP_OpenSocket (int port)
147 return INVALID_SOCKET;
148 }
149
150 +#ifdef FIONBIO
151 if (ioctlsocket (newsocket, FIONBIO, &_true) == SOCKET_ERROR)
152 goto ErrorReturn;
153 +#endif
154
155 memset(&address, 0, sizeof(struct sockaddr_in));
156 address.sin_family = AF_INET;
157 @@ -152,7 +156,9 @@ sys_socket_t UDP_OpenSocket (int port)
158 if (bind (newsocket, (struct sockaddr *)&address, sizeof(address)) == 0)
159 return newsocket;
160
161 +#ifdef FIONBIO
162 ErrorReturn:
163 +#endif
164 err = SOCKETERRNO;
165 Con_SafePrintf("UDP_OpenSocket: %s\n", socketerror(err));
166 UDP_CloseSocket (newsocket);
167 @@ -235,7 +241,9 @@ int UDP_Connect (sys_socket_t socketid, struct qsockaddr *ad dr)
168
169 sys_socket_t UDP_CheckNewConnections (void)
170 {
171 +#ifdef FIONREAD
172 int available;
173 +#endif
174 struct sockaddr_in from;
175 socklen_t fromlen;
176 char buff[1];
177 @@ -243,6 +251,7 @@ sys_socket_t UDP_CheckNewConnections (void)
178 if (net_acceptsocket == INVALID_SOCKET)
179 return INVALID_SOCKET;
180
181 +#ifdef FIONREAD
182 if (ioctl (net_acceptsocket, FIONREAD, &available) == -1)
183 {
184 int err = SOCKETERRNO;
185 @@ -250,6 +259,8 @@ sys_socket_t UDP_CheckNewConnections (void)
186 }
187 if (available)
188 return net_acceptsocket;
189 +#endif
190 +
191 // quietly absorb empty packets
192 recvfrom (net_acceptsocket, buff, 0, 0, (struct sockaddr *) &from, &from len);
193 return INVALID_SOCKET;
194 @@ -382,6 +393,7 @@ int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockad dr *addr)
195
196 int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
197 {
198 +#ifndef __native_client__
199 struct hostent *hostentry;
200
201 hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_ad dr,
202 @@ -391,6 +403,7 @@ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
203 strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);
204 return 0;
205 }
206 +#endif
207
208 strcpy (name, UDP_AddrToString (addr));
209 return 0;
210 diff --git a/Quake/sys_sdl_unix.c b/Quake/sys_sdl_unix.c
211 index fcdff11..0b211c4 100644
212 --- a/Quake/sys_sdl_unix.c
213 +++ b/Quake/sys_sdl_unix.c
214 @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021 11-1307, USA.
215 #include <unistd.h>
216 #include <sys/stat.h>
217 #include <sys/time.h>
218 +#include <sys/select.h>
219 #include <fcntl.h>
220 #include <time.h>
221
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698