* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:

The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.


git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-06-21 11:10:38 +00:00
parent 291a531b44
commit 7a36701fa8
14 changed files with 104 additions and 78 deletions

View file

@ -1,7 +1,9 @@
# GNU Makefile for QuakeSpasm, Apr. 24, 2010
# GNU Makefile for QuakeSpasm unix targets, June 21, 2010
#
# You need SDL and SDL_net fully installed.
# "make DEBUG=1" builds debug client
# "make SDLNET=1" to enable SDL_net. otherwise the socket api will be
# used directly.
# "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations
#
# Build objects are separate from those of codeblocks for now
@ -18,6 +20,8 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1;
# ============================================================================
DEBUG ?= 0
SDLNET ?= 0
BUILDDIR := .
SYSNAME := $(shell uname -s)
@ -98,7 +102,12 @@ SDL_CONFIG ?= sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
ifeq ($(SDLNET),1)
NET_LIBS := SDL_net
CFLAGS +=-D_USE_SDLNET
else
NET_LIBS :=
endif
COMMON_LIBS:= m GL
@ -128,8 +137,11 @@ SYSOBJ_SND := snd_sdl.o
SYSOBJ_CDA := cd_sdl.o
SYSOBJ_INPUT := in_sdl.o
SYSOBJ_GL_VID:= gl_vidsdl.o
#SYSOBJ_NET := net_bsd.o net_udp.o
ifeq ($(SDLNET),1)
SYSOBJ_NET := net_sdl.o net_sdlnet.o
else
SYSOBJ_NET := net_bsd.o net_udp.o
endif
SYSOBJ_SYS := pl_linux.o sys_sdl.o
SYSOBJ_MAIN:= main_sdl.o
SYSOBJ_RES :=

View file

@ -1,7 +1,9 @@
# GNU Makefile for QuakeSpasm, Apr. 24, 2010
# GNU Makefile for QuakeSpasm for Darwin only, June 21, 2010
#
# You need SDL and SDL_net fully installed.
# "make DEBUG=1" builds debug client
# "make SDLNET=1" to enable SDL_net. otherwise the socket api will be
# used directly.
# "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations
#
# Build objects are separate from those of codeblocks for now
@ -18,6 +20,8 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1;
# ============================================================================
DEBUG ?= 0
SDLNET ?= 0
BUILDDIR := .
SYSNAME := $(shell uname -s)
@ -105,7 +109,12 @@ SDL_CONFIG=/usr/local/bin/sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
NET_LIBS = -L/usr/local/lib -l SDL_net
ifeq ($(SDLNET),1)
NET_LIBS =-L/usr/local/lib -l SDL_net
CFLAGS +=-D_USE_SDLNET
else
NET_LIBS =
endif
COMMON_LIBS = -Wl,-framework,OpenGL
@ -136,8 +145,11 @@ SYSOBJ_SND := snd_sdl.o
SYSOBJ_CDA := cd_sdl.o
SYSOBJ_INPUT := in_sdl.o
SYSOBJ_GL_VID:= gl_vidsdl.o
#SYSOBJ_NET := net_bsd.o net_udp.o
ifeq ($(SDLNET),1)
SYSOBJ_NET := net_sdl.o net_sdlnet.o
else
SYSOBJ_NET := net_bsd.o net_udp.o
endif
SYSOBJ_SYS := pl_osx.o sys_sdl.o
SYSOBJ_MAIN:= main_sdl.o
SYSOBJ_RES :=

View file

@ -1,6 +1,10 @@
# GNU Makefile for cross-compiling quakespasm.exe (Win32 : MinGW)
# using cross-toolchains on a linux host / Apr. 24, 2010.
# using cross-toolchains on a linux host / June 21, 2010.
# "make DEBUG=1" builds debug client
# "make WINSOCK2=1" to use WinSock2 api when not using SDL_net. otherwise,
# WinSock 1.1 will be used.
# "make SDLNET=1" to enable SDL_net. otherwise, the WinSock api will be
# used directly.
# "make SDL_CONFIG=/path/to/sdl-config" for sdl-config from cross-compiled SDL
# ============================================================================
@ -12,6 +16,8 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1;
# ============================================================================
DEBUG ?= 0
WINSOCK2 ?= 0
SDLNET ?= 0
TOPDIR := $(shell pwd)
@ -50,9 +56,21 @@ SDL_CONFIG ?= sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
#NET_LIBS := ws2_32
#NET_LIBS := wsock32
ifeq ($(WINSOCK2),1)
DEFWINSOCK :=-D_USE_WINSOCK2
LIBWINSOCK := ws2_32
else
DEFWINSOCK :=
LIBWINSOCK := wsock32
endif
ifeq ($(SDLNET),1)
NET_LIBS := SDL_net
CFLAGS +=-D_USE_SDLNET
else
CFLAGS += $(DEFWINSOCK)
NET_LIBS := $(LIBWINSOCK)
endif
COMMON_LIBS:= m opengl32
@ -84,8 +102,11 @@ SYSOBJ_SND := snd_sdl.o
SYSOBJ_CDA := cd_sdl.o
SYSOBJ_INPUT := in_sdl.o
SYSOBJ_GL_VID:= gl_vidsdl.o
#SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
ifeq ($(SDLNET),1)
SYSOBJ_NET := net_sdl.o net_sdlnet.o
else
SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
endif
SYSOBJ_SYS := pl_win.o sys_sdl.o
SYSOBJ_MAIN:= main_sdl.o
SYSOBJ_RES := QuakeSpasm.res

View file

@ -1,6 +1,10 @@
# GNU Makefile for cross-compiling quakespasm.exe (Win64 : MinGW-w64)
# using cross-toolchains on a linux host / Apr. 24, 2010.
# using cross-toolchains on a linux host / June 21, 2010.
# "make DEBUG=1" builds debug client
# "make WINSOCK2=0" to use the old WinSock 1.1 api when not using SDL_net.
# otherwise, WinSock2 api will be used.
# "make SDLNET=1" to enable SDL_net. otherwise, the WinSock api will be
# used directly.
# "make SDL_CONFIG=/path/to/sdl-config" for sdl-config from cross-compiled SDL
# ============================================================================
@ -12,6 +16,8 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1;
# ============================================================================
DEBUG ?= 0
WINSOCK2 ?= 1
SDLNET ?= 0
TOPDIR := $(shell pwd)
@ -50,9 +56,21 @@ SDL_CONFIG ?= sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
#NET_LIBS := ws2_32
#NET_LIBS := wsock32
ifeq ($(WINSOCK2),1)
DEFWINSOCK :=-D_USE_WINSOCK2
LIBWINSOCK := ws2_32
else
DEFWINSOCK :=
LIBWINSOCK := wsock32
endif
ifeq ($(SDLNET),1)
NET_LIBS := SDL_net
CFLAGS +=-D_USE_SDLNET
else
CFLAGS += $(DEFWINSOCK)
NET_LIBS := $(LIBWINSOCK)
endif
COMMON_LIBS:= m opengl32
@ -84,8 +102,11 @@ SYSOBJ_SND := snd_sdl.o
SYSOBJ_CDA := cd_sdl.o
SYSOBJ_INPUT := in_sdl.o
SYSOBJ_GL_VID:= gl_vidsdl.o
#SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
ifeq ($(SDLNET),1)
SYSOBJ_NET := net_sdl.o net_sdlnet.o
else
SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
endif
SYSOBJ_SYS := pl_win.o sys_sdl.o
SYSOBJ_MAIN:= main_sdl.o
SYSOBJ_RES := QuakeSpasm.res

View file

@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"

View file

@ -19,41 +19,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_dgrm.c
// This is enables a simple IP banning mechanism
//#define BAN_TEST disabled --kristian
#ifdef BAN_TEST
#if defined(_WIN32)
#include <windows.h>
#elif defined (NeXT)
#include <sys/socket.h>
#include <arpa/inet.h>
#else
#define AF_INET 2 /* internet */
struct in_addr
{
union
{
struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { unsigned short s_w1,s_w2; } S_un_w;
unsigned long S_addr;
} S_un;
};
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
struct sockaddr_in
{
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
char *inet_ntoa(struct in_addr in);
unsigned long inet_addr(const char *cp);
#endif
#endif // BAN_TEST
#define BAN_TEST
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"
#include "net_dgrm.h"

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_loop.c
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"
#include "net_loop.h"

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_main.c
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"

View file

@ -18,22 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"
#include "net_sdlnet.h"
#include "SDL.h"
#include "SDL_net.h"
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 255
#endif
#ifndef AF_INET
#define AF_INET 2 /* internet */
#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
#endif
#define MAX_SOCKETS 32
#if 0 /* enable for paranoid debugging purposes */

View file

@ -20,26 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"
#include <sys/types.h>
#include <errno.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <unistd.h>
#if defined(__sun) || defined(sun)
#include <sys/filio.h>
#endif /* __sunos__ */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
static int net_acceptsocket = -1; // socket for fielding new connections
static int net_controlsocket;
static int net_broadcastsocket = 0;

View file

@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"

View file

@ -18,14 +18,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_wins.c
#include "winsock.h"
#include "arch_def.h"
#include "net_sys.h"
#include "quakedef.h"
#include "net_defs.h"
#define MAXHOSTNAMELEN 256
static int net_acceptsocket = -1; // socket for fielding new connections
static int net_controlsocket;
static int net_broadcastsocket = 0;

View file

@ -18,18 +18,18 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_wipx.c
#include "winsock.h"
#include "arch_def.h"
#include "net_sys.h"
#include <wsipx.h>
#include "quakedef.h"
#include "net_defs.h"
#include <wsipx.h>
#include "net_wipx.h"
extern cvar_t hostname;
#define MAXHOSTNAMELEN 256
static int net_acceptsocket = -1; // socket for fielding new connections
static int net_controlsocket;
static struct sockaddr_ipx broadcastaddr;