summaryrefslogtreecommitdiff
path: root/games/xtris
diff options
context:
space:
mode:
authorhubertf <hubertf@pkgsrc.org>2002-01-25 17:47:18 +0000
committerhubertf <hubertf@pkgsrc.org>2002-01-25 17:47:18 +0000
commited7386ce5e72f730d2b34e13059f52aa44d5f5e6 (patch)
tree5a3da1dbedb71f549178c4a9d12d503c95c76b8d /games/xtris
parent66d285b2dc5d254fbf83a857b42326a6904cf962 (diff)
downloadpkgsrc-ed7386ce5e72f730d2b34e13059f52aa44d5f5e6.tar.gz
Add xtris-1.15:
xtris is a version of an classical popular game, for any number of players, for the X Window system. xtris is a true client/server game (as opposed to a centralized game managing multiple displays), which makes it particularily responsive and bandwith-effective. Submitted by Oliver Paulzen <opp@muffin.org> in private mail.
Diffstat (limited to 'games/xtris')
-rw-r--r--games/xtris/DESCR6
-rw-r--r--games/xtris/Makefile33
-rw-r--r--games/xtris/PLIST7
-rw-r--r--games/xtris/distinfo9
-rw-r--r--games/xtris/patches/patch-aa57
-rw-r--r--games/xtris/patches/patch-ae203
6 files changed, 315 insertions, 0 deletions
diff --git a/games/xtris/DESCR b/games/xtris/DESCR
new file mode 100644
index 00000000000..0c95df0ecee
--- /dev/null
+++ b/games/xtris/DESCR
@@ -0,0 +1,6 @@
+xtris is a version of an classical popular game, for any number of
+players, for the X Window system.
+
+xtris is a true client/server game (as opposed to a centralized game
+managing multiple displays), which makes it particularily responsive and
+bandwith-effective.
diff --git a/games/xtris/Makefile b/games/xtris/Makefile
new file mode 100644
index 00000000000..e4c7ed1206b
--- /dev/null
+++ b/games/xtris/Makefile
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1.1.1 2002/01/25 17:47:18 hubertf Exp $
+#
+
+DISTNAME= xtris-1.15
+CATEGORIES= games x11
+MASTER_SITES= http://www.iagora.com/~espel/xtris/
+
+MAINTAINER= opp@MuFFiN.Org
+HOMEPAGE= http://www.iagora.com/~espel/xtris/
+COMMENT= Multi-player version of a popular game for the X Window system
+
+WRKSRC= ${WRKDIR}/xtris
+USE_X11= yes
+USE_X11BASE= yes
+
+BUILD_DEFS+= USE_INET6
+
+# to get USE_INET6
+.include "../../mk/bsd.prefs.mk"
+
+.if defined(USE_INET6) && ${USE_INET6} == YES
+CFLAGS+= -DINET6
+.endif
+
+do-install:
+ ${INSTALL} -o bin -g games -m 2755 ${WRKSRC}/xtris ${PREFIX}/bin/xtris
+ ${INSTALL} -o bin -g games -m 2755 ${WRKSRC}/xtbot ${PREFIX}/bin/xtbot
+ ${INSTALL} -o bin -g games -m 2755 ${WRKSRC}/xtserv ${PREFIX}/bin/xtserv
+ ${INSTALL_MAN} ${WRKSRC}/xtris.6 ${PREFIX}/man/man6/xtris.6
+ ${INSTALL_MAN} ${WRKSRC}/xtbot.6 ${PREFIX}/man/man6/xtbot.6
+ ${INSTALL_MAN} ${WRKSRC}/xtserv.6 ${PREFIX}/man/man6/xtserv.6
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/games/xtris/PLIST b/games/xtris/PLIST
new file mode 100644
index 00000000000..c0f510aef58
--- /dev/null
+++ b/games/xtris/PLIST
@@ -0,0 +1,7 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2002/01/25 17:47:18 hubertf Exp $
+bin/xtris
+bin/xtserv
+bin/xtbot
+man/man6/xtris.6
+man/man6/xtserv.6
+man/man6/xtbot.6
diff --git a/games/xtris/distinfo b/games/xtris/distinfo
new file mode 100644
index 00000000000..badcc00e9ee
--- /dev/null
+++ b/games/xtris/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2002/01/25 17:47:18 hubertf Exp $
+
+SHA1 (xtris-1.15.tar.gz) = 157eb642ada6d72290acf3d4d2638ec04f8de878
+Size (xtris-1.15.tar.gz) = 52130 bytes
+SHA1 (patch-aa) = 2e243e8df26d6c5403df385f031eb3873eed8d23
+SHA1 (patch-ab) = 80c184220576c61236a5b50facaf27693013d38f
+SHA1 (patch-ac) = 4f2e5c94b22032da6bee13ce451fe98a78982c61
+SHA1 (patch-ad) = 7047fe19e0e951624f258981015875e054aa14d3
+SHA1 (patch-ae) = 5de5c829f41efa85c866fa46615d84a2ba065c2a
diff --git a/games/xtris/patches/patch-aa b/games/xtris/patches/patch-aa
new file mode 100644
index 00000000000..35673c58a4b
--- /dev/null
+++ b/games/xtris/patches/patch-aa
@@ -0,0 +1,57 @@
+$NetBSD: patch-aa,v 1.1.1.1 2002/01/25 17:47:18 hubertf Exp $
+
+--- Makefile.orig Fri Jan 25 13:42:54 2002
++++ Makefile
+@@ -8,23 +8,27 @@
+ ###################
+
+ # change this to your favorite ANSI C compiler
+-CC = gcc
++CC? = gcc
+
+ # change this to the directory where you want the xtris binaries installed
+-BINDIR = /usr/local/bin
++BINDIR = ${PREFIX}/bin
+
+ # change this to the directory where you want the xtris manpages installed
+-MANDIR = /usr/local/man
++MANDIR = ${PREFIX}/man
+
+ # change according to taste and local custom...
+-CFLAGS = -O3 -D__USE_FIXED_PROTOTYPES__
++CFLAGS += -D__USE_FIXED_PROTOTYPES__ $(IPV6_CFLAGS)
+
+ # on Solaris and similar systems, you'll need to uncomment this:
+-# EXTRALIBS = -lnsl -lsocket
+-
+-# specify X11 libdir if your system needs it
+-# XLIBDIR = -L/usr/X11/lib
++EXTRALIBS = $(IPV6_LDFLAGS) #-lnsl -lsocket
+
++# specify X11 cflags and libdir if your system needs it
++XCFLAGS = -I${PREFIX}/include -Wl,-R${PREFIX}/lib
++XLIBDIR = -L${PREFIX}/lib
++
++# IPv6 Settings
++IPV6_CFLAGS = #-DINET6 #-I/usr/inet6/include
++IPV6_LDFLAGS = #-L/usr/local/v6/lib -linet6
+
+ ###########################################################################
+ ## You shouldn't need to change anything past this. ##
+@@ -35,7 +39,7 @@
+ all: xtris xtserv xtbot
+
+ xtris: xtris.c
+- $(CC) $(CFLAGS) -DXTRISPATH="\"$(BINDIR)\"" xtris.c -o xtris $(XLIBDIR) $(XLIBS) $(EXTRALIBS)
++ $(CC) $(CFLAGS) $(XCFLAGS) -DXTRISPATH="\"$(BINDIR)\"" xtris.c -o xtris $(XLIBDIR) $(XLIBS) $(EXTRALIBS)
+
+ xtserv: xtserv.c
+ $(CC) $(CFLAGS) xtserv.c -o xtserv $(EXTRALIBS)
+@@ -60,6 +64,6 @@
+ rm -f xtris.tar.gz
+ mv -f Makefile Makefile.local
+ cp Makefile.dist Makefile
+- cd .. ; tar cf xtris/xtris.tar xtris/Makefile xtris/Makefile.dist xtris/README xtris/ChangeLog xtris/COPYING xtris/PROTOCOL xtris/xtris.lsm xtris/xtris.c xtris/xtserv.c xtris/xtbot.c xtris/xtbot.h xtris/decide.c xtris/decide.h xtris/xtris.6 xtris/xtserv.6 xtris/xtbot.6 ; gzip -9 xtris/xtris.tar
++ cd .. ; tar cf xtris/xtris.tar xtris/Makefile xtris/Makefile.dist xtris/README xtris/README.v6 xtris/ChangeLog xtris/COPYING xtris/PROTOCOL xtris/xtris.lsm xtris/xtris.c xtris/xtserv.c xtris/xtbot.c xtris/xtbot.h xtris/decide.c xtris/decide.h xtris/xtris.6 xtris/xtserv.6 xtris/xtbot.6 ; gzip -9 xtris/xtris.tar
+ mv -f Makefile.local Makefile
+
diff --git a/games/xtris/patches/patch-ae b/games/xtris/patches/patch-ae
new file mode 100644
index 00000000000..74a46c873e5
--- /dev/null
+++ b/games/xtris/patches/patch-ae
@@ -0,0 +1,203 @@
+$NetBSD: patch-ae,v 1.1.1.1 2002/01/25 17:47:18 hubertf Exp $
+
+--- xtserv.c.orig Wed Apr 9 20:01:58 1997
++++ xtserv.c
+@@ -95,7 +95,13 @@
+ #define NEXT(u) ((u)->next ? (u)->next : user0)
+
+ int port = DEFAULTPORT;
++#ifdef INET6
++# define MAX_LISTEN_SOCKS 16
++struct sockaddr_storage saddr;
++#else
+ struct sockaddr_in saddr;
++#endif
++int saddr_len;
+ int lfd;
+ unsigned char realbuf[512], *buf = realbuf + 4;
+
+@@ -235,6 +241,9 @@
+ void new_connect(int fd) {
+ struct user *u, *v;
+ unsigned char nxn;
++#ifdef INET6
++ char ipaddr_buf[INET6_ADDRSTRLEN];
++#endif
+
+ u = malloc(sizeof (struct user));
+ if (!u)
+@@ -263,8 +272,20 @@
+ v = v->next;
+ }
+ u->number = nxn;
++#ifdef INET6
++ if (verbose){
++ ipaddr_buf[0] = '\0';
++ getnameinfo((struct sockaddr *)&saddr, saddr_len,
++ ipaddr_buf, sizeof(ipaddr_buf),
++ NULL, 0, NI_NUMERICHOST);
++ ipaddr_buf[sizeof(ipaddr_buf)-1] = '\0';
++ printf("client %d connecting from %s\n",
++ nxn, ((ipaddr_buf[0] != '\0') ? ipaddr_buf : "(unknown)"));
++ }
++#else
+ if (verbose)
+ printf("client %d connecting from %s\n", nxn, inet_ntoa(saddr.sin_addr));
++#endif
+ clients++;
+ buf[1] = OP_YOUARE;
+ buf[0] = u->number;
+@@ -280,6 +301,15 @@
+ char *opt;
+ struct protoent *tcpproto;
+ struct timeval tv;
++#ifdef INET6
++ struct addrinfo hints, *res0, *res;
++ char serv_buf[NI_MAXSERV];
++ int socklistListen[MAX_LISTEN_SOCKS];
++ int countSock, maxSock;
++ char str_buff[512];
++ int j, sel, gai;
++ int sockListen;
++#endif
+
+ #ifndef NeXT
+ struct sigaction sact;
+@@ -343,6 +373,46 @@
+ } else fatal("Unrecognized option, try -h for help");
+ }
+
++#ifdef INET6
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = PF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_flags = AI_PASSIVE;
++ snprintf(serv_buf, sizeof(serv_buf), "%d", port);
++ serv_buf[sizeof(serv_buf)-1] = '\0';
++ gai = getaddrinfo(NULL, serv_buf, &hints, &res0);
++ if (gai){
++ snprintf(str_buff, sizeof(str_buff)-1,
++ "getaddrinfo(): %s", gai_strerror(gai));
++ str_buff[sizeof(str_buff)-1] = '\0';
++ fatal(str_buff);
++ }
++ countSock = 0;
++ maxSock = -1;
++ for (res=res0; res && (countSock < MAX_LISTEN_SOCKS); res=res->ai_next){
++ sockListen = socket(res->ai_family, res->ai_socktype, 0);
++ if(sockListen < 0) continue;
++ on = 1;
++ setsockopt(sockListen, SOL_SOCKET, SO_REUSEADDR,
++ (char *)&on, sizeof(int));
++ if (bind(sockListen, res->ai_addr, res->ai_addrlen) < 0){
++ close(sockListen);
++ continue;
++ }
++ if (listen(sockListen, 5) < 0){
++ close(sockListen);
++ continue;
++ }
++ socklistListen[countSock++] = sockListen;
++ if (maxSock < sockListen) maxSock = sockListen;
++ }
++ if (!countSock){
++ snprintf(str_buff, sizeof(str_buff), "socket(),bind(),listen(): %d", countSock);
++ str_buff[sizeof(str_buff)-1] = '\0';
++ fatal(str_buff);
++ }
++ freeaddrinfo(res0);
++#else
+ lfd = socket(PF_INET, SOCK_STREAM, 0);
+ saddr.sin_family = AF_INET;
+ saddr.sin_addr.s_addr = htonl(INADDR_ANY);
+@@ -357,13 +427,26 @@
+ syserr("bind");
+
+ listen(lfd, 5);
++#endif
+
+ if (is_daemon) {
+ /* become a daemon, breaking all ties with the controlling terminal */
+ verbose = 0;
+ for (i=0; i<255; i++) {
++#ifdef INET6
++ lfd = -1;
++ for (j=0; j<countSock; j++){
++ if (i == socklistListen[j]){
++ lfd = socklistListen[j];
++ break;
++ }
++ }
++ if (lfd < 0)
++ close(i);
++#else
+ if (i != lfd)
+ close(i);
++#endif
+ }
+ if (fork())
+ exit(0);
+@@ -395,7 +478,11 @@
+ flushuser(u);
+
+ FD_ZERO(&fds);
++#ifdef INET6
++ mfd = -1;
++#else
+ mfd = lfd;
++#endif
+ u = user0;
+ while (u) {
+ FD_SET(u->fd, &fds);
+@@ -403,7 +490,15 @@
+ mfd = u->fd;
+ u = u->next;
+ }
++#ifdef INET6
++ for (i=0; i<countSock; i++){
++ FD_SET(socklistListen[i], &fds);
++ if (socklistListen[i] > mfd)
++ mfd = socklistListen[i];
++ }
++#else
+ FD_SET(lfd, &fds);
++#endif
+ tv.tv_sec = 0;
+ tv.tv_usec = 500000;
+ if ((sl = select(mfd + 1, &fds, NULL, NULL, &tv)) < 0)
+@@ -425,11 +520,15 @@
+ if (sl == 0)
+ continue;
+
+- if (FD_ISSET(lfd, &fds)) {
+- int newfd, slen;
++#ifdef INET6
++ for (i=0; i<countSock; i++){
++ lfd = socklistListen[i];
++#endif
++ if (FD_ISSET(lfd, &fds)) {
++ int newfd;
+
+- slen = sizeof(saddr);
+- newfd = accept(lfd, (struct sockaddr *)&saddr, &slen);
++ saddr_len = sizeof(saddr);
++ newfd = accept(lfd, (struct sockaddr *)&saddr, &saddr_len);
+ if (newfd < 0) {
+ if (errno != EINTR)
+ syserr("accept");
+@@ -440,8 +539,15 @@
+ }
+ new_connect(newfd);
+ }
++#ifdef INET6
++ break;
++#else
+ continue;
++#endif
++ }
++#ifdef INET6
+ }
++#endif
+
+ u = user0;
+ do {