aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--games/xpat2/Makefile35
-rw-r--r--games/xpat2/files/patch-Imakefile24
-rw-r--r--games/xpat2/files/patch-X-gfx1.c30
-rw-r--r--games/xpat2/files/patch-X-widget.c14
-rw-r--r--games/xpat2/files/patch-Xaw-main.c20
-rw-r--r--games/xpat2/files/patch-Xpat.tmpl (renamed from games/xpat2/files/patch-ab)7
-rw-r--r--games/xpat2/files/patch-aa11
-rw-r--r--games/xpat2/files/patch-layout.c38
-rw-r--r--games/xpat2/files/patch-loadsave.c22
-rw-r--r--games/xpat2/files/patch-xpat.h11
-rw-r--r--games/xpat2/files/patch-xpat2.man54
-rw-r--r--games/xpat2/pkg-plist3
12 files changed, 242 insertions, 27 deletions
diff --git a/games/xpat2/Makefile b/games/xpat2/Makefile
index af33669f5ad3..c09855ead3c4 100644
--- a/games/xpat2/Makefile
+++ b/games/xpat2/Makefile
@@ -3,27 +3,40 @@
PORTNAME= xpat2
PORTVERSION= 1.07
-PORTREVISION= 2
+DISTVERSIONSUFFIX= -src
+PORTREVISION= 3
CATEGORIES= games
-MASTER_SITES= ${MASTER_SITE_SUNSITE}
-MASTER_SITE_SUBDIR= games/solitaires
-DISTNAME= ${PORTNAME}-${PORTVERSION}-src
-WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}/src
+MASTER_SITES= SUNSITE/games/solitaires
MAINTAINER= ports@FreeBSD.org
COMMENT= X11 solitaire game with 14 variations
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}/src
+
USES= imake
USE_XORG= xaw
+
+CFLAGS+= -D_POSIX_SOURCE -DNO_CUSERID -D_POSIX_SAVED_IDS
+
MAN6= xpat2.6
-MANCOMPRESSED= no
+
+DESKTOP_ENTRIES="XPat2" "" "" "${PORTNAME}" "" ""
+
+post-patch:
+ @${REINPLACE_CMD} -e \
+ 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/xpat2.man
post-install:
- ${MV} ${PREFIX}/lib/xpat/man/man6/xpat2.6x ${PREFIX}/man/man6/xpat2.6
- ${RMDIR} ${PREFIX}/lib/xpat/man/man6 ${PREFIX}/lib/xpat/man
- ${TOUCH} /var/games/xpat.log
- ${CHOWN} root:games /var/games/xpat.log $(PREFIX)/bin/xpat2
- ${CHMOD} 2555 $(PREFIX)/bin/xpat2
+ ${CHOWN} root:games ${PREFIX}/bin/xpat2
+ ${CHMOD} 2555 ${PREFIX}/bin/xpat2
+.if !exists(/var/games/xpat.log)
+.if !exists(/var/games)
+ ${MKDIR} /var/games
+ ${CHMOD} 775 /var/games
+.endif
+ ${ECHO_CMD} -n > /var/games/xpat.log
+ ${CHOWN} root:games /var/games/xpat.log
${CHMOD} 664 /var/games/xpat.log
+.endif
.include <bsd.port.mk>
diff --git a/games/xpat2/files/patch-Imakefile b/games/xpat2/files/patch-Imakefile
new file mode 100644
index 000000000000..31bb2ba0eb5b
--- /dev/null
+++ b/games/xpat2/files/patch-Imakefile
@@ -0,0 +1,24 @@
+--- Imakefile.orig
++++ Imakefile
+@@ -220,8 +220,8 @@
+ chmod 755 $(XPATLIBDIR)/$$f; \
+ done
+ mkdirhier $(XPATMANDIR)
+- cp xpat2.man $(XPATMANDIR)/xpat2.6x
+- chmod 644 $(XPATMANDIR)/xpat2.6x
++ cp xpat2.man $(XPATMANDIR)/xpat2.6
++ chmod 644 $(XPATMANDIR)/xpat2.6
+
+ ComplexProgramTarget($(MYPROG))
+ InstallAppDefaults(XPat)
+@@ -251,8 +251,8 @@
+ done
+ cp xpat2 $(LXPATBINDIR)
+ chmod 755 $(LXPATBINDIR)/xpat2
+- cp xpat2.man $(LXPATMANDIR)/xpat2.6x
+- chmod 644 $(LXPATMANDIR)/xpat2.6x
++ cp xpat2.man $(LXPATMANDIR)/xpat2.6
++ chmod 644 $(LXPATMANDIR)/xpat2.6
+
+
+ XCOMM Dependecies for the Qt interface:
diff --git a/games/xpat2/files/patch-X-gfx1.c b/games/xpat2/files/patch-X-gfx1.c
new file mode 100644
index 000000000000..3383bec9d004
--- /dev/null
+++ b/games/xpat2/files/patch-X-gfx1.c
@@ -0,0 +1,30 @@
+--- X-gfx1.c.orig
++++ X-gfx1.c
+@@ -442,7 +442,7 @@
+ /* build internal cardset */
+ CARD_WIDTH = -1;
+ if (xpm) {
+- char s[200];
++ char s[MAXXPMDIRLEN + 15];
+ FILE *fp;
+ sprintf(s, "%s/Cards.conf", xpmdir);
+ if ((fp = fopen(s, "r"))) {
+@@ -956,7 +956,8 @@
+ cardpicts[57] = 0; /* Joker is loaded on request */
+ for (i = 0; i <= 56; ++i) {
+ if (xpmdir && (i < 52 || i >= 56)) {
+- char s[200];
++ char s[MAXXPMDIRLEN + strlen(US_rank_name[RANK(i)]) +
++ strlen(US_suit_name[SUIT(i)]) + 20];
+ if (i == CARDBACK) {
+ strcpy(s, xpmdir);
+ strcat(s, "/Cardback.xpm");
+@@ -988,7 +989,7 @@
+ if (!cardpicts[c]) {
+ /* must load or draw joker */
+ if (xpmdir) {
+- char s[200];
++ char s[MAXXPMDIRLEN + 15];
+ sprintf(s, "%s/Joker.xpm", xpmdir);
+ (void)read_pixmap(s, &cardpicts[c]);
+ }
diff --git a/games/xpat2/files/patch-X-widget.c b/games/xpat2/files/patch-X-widget.c
new file mode 100644
index 000000000000..bd7e53e7abcd
--- /dev/null
+++ b/games/xpat2/files/patch-X-widget.c
@@ -0,0 +1,14 @@
+--- X-widget.c.orig
++++ X-widget.c
+@@ -248,6 +248,11 @@
+ exit(EXIT_FAILURE);
+ }
+
++ if (p->xpmdir && strlen(p->xpmdir) >= MAXXPMDIRLEN) {
++ fprintf(stderr, "directory too long\n");
++ exit(1);
++ }
++
+ read_message_file(p->messagefile ? p->messagefile : "messages");
+ read_keyboard_file(p->keyboardfile ? p->keyboardfile : "keys");
+
diff --git a/games/xpat2/files/patch-Xaw-main.c b/games/xpat2/files/patch-Xaw-main.c
new file mode 100644
index 000000000000..a1a43d046d47
--- /dev/null
+++ b/games/xpat2/files/patch-Xaw-main.c
@@ -0,0 +1,20 @@
+--- Xaw-main.c.orig
++++ Xaw-main.c
+@@ -323,6 +323,7 @@
+ Widget buttonpanel;
+ Widget gamebutton, gamemenu, rulesbutton, rulesmenu;
+ int i;
++ Arg args[1];
+ struct button {
+ const char *name; void (*func)(void);
+ } *bp;
+@@ -403,6 +404,9 @@
+ /* OK. Now do the pop-up shells */
+ popup = XtCreatePopupShell("prompt", transientShellWidgetClass, toplevel, NULL, 0);
+ dialog = XtCreateManagedWidget("dialog", dialogWidgetClass, popup, NULL, 0);
++ /* cludge to be improved when I know more Xaw -- AW */
++ XtSetArg(args[0], XtNlabel, (strlen(TXT_NEW_CONFIRM)>strlen(TXT_QUIT_CONFIRM))?TXT_NEW_CONFIRM:TXT_QUIT_CONFIRM);
++ XtSetValues(dialog, args, 1);
+ XawDialogAddButton(dialog, "ok", Ok, (XtPointer)dialog);
+ XawDialogAddButton(dialog, "cancel", Cancel, (XtPointer)dialog);
+
diff --git a/games/xpat2/files/patch-ab b/games/xpat2/files/patch-Xpat.tmpl
index 4005e1251fa2..17164f9dacb3 100644
--- a/games/xpat2/files/patch-ab
+++ b/games/xpat2/files/patch-Xpat.tmpl
@@ -1,5 +1,5 @@
---- Xpat.tmpl.orig Sun Nov 5 12:03:10 2000
-+++ Xpat.tmpl Sun Jul 28 17:38:32 2002
+--- Xpat.tmpl.orig
++++ Xpat.tmpl
@@ -40,9 +40,9 @@
XCOMM 1. Specify User Interface (_exactly_ one of the interfaces below)
@@ -41,7 +41,8 @@
XPATLIBDIR = $(XPATROOT)
APPDEFSDIR = $(LIBDIR)
- XPATMANDIR = $(XPATROOT)/man/man6
+-XPATMANDIR = $(XPATROOT)/man/man6
++XPATMANDIR = $(PREFIX)/man/man6
+MANSUFFIX = 6
XCOMM This is the name of the log-file, where solved games are stored:
diff --git a/games/xpat2/files/patch-aa b/games/xpat2/files/patch-aa
deleted file mode 100644
index 140563f865b7..000000000000
--- a/games/xpat2/files/patch-aa
+++ /dev/null
@@ -1,11 +0,0 @@
---- Imakefile.orig Mon Mar 12 12:22:10 2001
-+++ Imakefile Mon Mar 12 12:22:25 2001
-@@ -188,7 +188,7 @@
- r_Calculatio.o r_Michaels.o r_Royal.o r_Canfield.o \
- r_mdCanfield.o r_Bakers.o r_Oonsoo.o r_BlueMoon.o
-
--OBJS = $(STDOBJS) $(XOBJS) $(KIT_OBJS)
-+OBJS = $(STDOBJS) $(XOBJS) $(KIT_OBJS) -lcompat
-
-
- MYPROG = xpat2
diff --git a/games/xpat2/files/patch-layout.c b/games/xpat2/files/patch-layout.c
new file mode 100644
index 000000000000..74751114ca3c
--- /dev/null
+++ b/games/xpat2/files/patch-layout.c
@@ -0,0 +1,38 @@
+--- layout.c.orig
++++ layout.c
+@@ -332,17 +332,9 @@
+ }
+ } else {
+ /* enough space for the slots! */
+- int currentx = geo.dx;
+-/* printf("generating high layout for %d,%d\n", geo.w, geo.h); */
+- if (rem_x >= (rules.numslots + 1) * (geo.cw + geo.dx) &&
+- !(rules.variant & NODEAL)) {
+- /* there is space for the deck, and we can use one! */
+- geo.pg[game.numpiles-1].x = geo.dx;
+- geo.pg[game.numpiles-1].y = geo.dy + geo.ch + geo.dy;
+- currentx += geo.cw + geo.dx;
+- new_layout_type = GEN_BIG_LAYOUT_WITH_DECK;
+- geo.preferred_width += geo.dx + geo.cw;
+- }
++ int currentx = geo.dx + rules.numdecks * (geo.cw + geo.dx);
++ new_layout_type = GEN_BIG_LAYOUT_WITH_DECK;
++ geo.preferred_width += rules.numdecks * (geo.dx + geo.cw);
+ for (i = 0; i < rules.numslots; ++i) {
+ /* create slot of full window height */
+ p->x = currentx;
+@@ -351,6 +343,14 @@
+ currentx += geo.cw + geo.dx;
+ ++p;
+ }
++ /* finally, position the decks */
++ for (i = 0; i < rules.numdecks; ++i) {
++ p[0].x = i * (geo.dx + geo.cw);
++ p[1].x = p[0].x;
++ p[0].y = geo.dy + 2 * (geo.ch + geo.dy);
++ p[1].y = geo.dy + geo.ch + geo.dy;
++ p += 2;
++ }
+ /* redo pos. of stacks */
+ p = geo.pg;
+ for (i = 0; i < rules.numstacks; ++i) {
diff --git a/games/xpat2/files/patch-loadsave.c b/games/xpat2/files/patch-loadsave.c
new file mode 100644
index 000000000000..86a039d0ef67
--- /dev/null
+++ b/games/xpat2/files/patch-loadsave.c
@@ -0,0 +1,22 @@
+--- loadsave.c.orig
++++ loadsave.c
+@@ -42,13 +42,18 @@
+ #ifdef _POSIX_SAVED_IDS
+ static int uid_state = -1; /* -1 = unknown, 1 = real, 0 = effective */
+ static uid_t real_uid, effective_uid;
++ static gid_t real_gid, effective_gid;
+ if (uid_state < 0) {
+ real_uid = getuid();
++ real_gid = getgid();
+ effective_uid = geteuid();
++ effective_gid = getegid();
+ uid_state = 0;
+ }
+- if (to_real != uid_state && real_uid != effective_uid) {
++ if (to_real != uid_state && (real_uid != effective_uid || real_gid !=
++ effective_gid)) {
+ setuid(to_real ? real_uid : effective_uid);
++ setgid(to_real ? real_gid : effective_gid);
+ uid_state = to_real;
+ }
+ #endif
diff --git a/games/xpat2/files/patch-xpat.h b/games/xpat2/files/patch-xpat.h
new file mode 100644
index 000000000000..6639f64c0294
--- /dev/null
+++ b/games/xpat2/files/patch-xpat.h
@@ -0,0 +1,11 @@
+--- xpat.h.orig
++++ xpat.h
+@@ -51,6 +51,8 @@
+ #define EXIT_FAILURE (-1)
+ #endif
+
++#define MAXXPMDIRLEN 100 /* pathname length including trailing zero */
++
+ #ifndef max
+ #define max(a, b) ((a) > (b) ? (a) : (b))
+ #define min(a, b) ((a) < (b) ? (a) : (b))
diff --git a/games/xpat2/files/patch-xpat2.man b/games/xpat2/files/patch-xpat2.man
new file mode 100644
index 000000000000..f3ae70191b4f
--- /dev/null
+++ b/games/xpat2/files/patch-xpat2.man
@@ -0,0 +1,54 @@
+--- xpat2.man.orig
++++ xpat2.man
+@@ -136,7 +136,7 @@
+ nice cardbacks.
+
+ If the directory name \fIxpmdir\fP does not start with a dot or a slash,
+-it is interpreted as a subdirectory of \fB/usr/games/lib/xpat\fP.
++it is interpreted as a subdirectory of \fB%%PREFIX%%/lib/xpat\fP.
+ .TP 4
+ .B \-xpmcls \fIxpmcls\fP
+ (Resource: \fBTableau.xpmcls\fP)
+@@ -193,22 +193,19 @@
+ a format supported by your X-server (pcf, snf, ...)
+
+ .SH FILES
+-(Directories may differ on your system, especially the library subdirectory
+- may be \fB/usr/games/lib/xpat\fP instead of \fB/usr/lib/games/xpat\fP.)
+
+- \fB/usr/games/xpat2\fP
+- \fB/var/lib/games/xpat2/xpat.log\fP
+- \fB/usr/doc/copyright/xpat2\fP
+- \fB/usr/lib/games/xpat/small.cards\fP
+- \fB/usr/lib/games/xpat/french.cards\fP
+- \fB/usr/lib/games/xpat/audio/success.au\fP
+- \fB/usr/lib/games/xpat/audio/giveup.au\fP
+- \fB/usr/lib/games/xpat/audio/goodbye.au\fP
+- \fB/usr/lib/games/xpat/audio/cannotsave.au\fP
+- \fB/usr/lib/games/xpat/help.*\fP
+- \fB/usr/lib/games/xpat/hlp*\fP
++ \fB%%PREFIX%%/bin/xpat2\fP
++ \fB/var/games/xpat.log\fP
++ \fB%%PREFIX%%/lib/xpat/small.cards\fP
++ \fB%%PREFIX%%/lib/xpat/french.cards\fP
++ \fB%%PREFIX%%/lib/xpat/audio/success.au\fP
++ \fB%%PREFIX%%/lib/xpat/audio/giveup.au\fP
++ \fB%%PREFIX%%/lib/xpat/audio/goodbye.au\fP
++ \fB%%PREFIX%%/lib/xpat/audio/cannotsave.au\fP
++ \fB%%PREFIX%%/lib/xpat/help.*\fP
++ \fB%%PREFIX%%/lib/xpat/hlp*\fP
+
+-and a number of subdirs of \fB/usr/lib/games/xpat\fP, containing sets of colour
++and a number of subdirs of \fB%%PREFIX%%/lib/xpat\fP, containing sets of colour
+ cards.
+
+ .SH DIAGNOSTICS
+@@ -238,7 +235,7 @@
+ Please mail bug reports to \fBMichael.Bischoff@gmx.net\fP.
+ Fixes are especially welcome.
+ .SH SEE ALSO
+-\fBxpat(6x)\fP, \fBspider(1)\fP, \fBxsol(1)\fP
++\fBxpat(6)\fP, \fBspider(1)\fP, \fBxsol(1)\fP
+
+ .SH AUTHORS
+ Heiko Eissfeldt and Michael Bischoff
diff --git a/games/xpat2/pkg-plist b/games/xpat2/pkg-plist
index 0933b3b7b4e7..0c7a56dc004a 100644
--- a/games/xpat2/pkg-plist
+++ b/games/xpat2/pkg-plist
@@ -176,5 +176,4 @@ lib/xpat/it_IT
@dirrm lib/xpat/italian
@dirrm lib/xpat/russian
@dirrm lib/xpat
-@cwd /
-var/games/xpat.log
+@unexec if [ ! -s /var/games/xpat.log ]; then rm -f /var/games/xpat.log; fi