ports/179582: games/xpat2: Fix build on -current
KATO Tsuguru
tkato432 at yahoo.com
Sat Jun 15 18:10:01 UTC 2013
>Number: 179582
>Category: ports
>Synopsis: games/xpat2: Fix build on -current
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Jun 15 18:10:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: KATO Tsuguru
>Release: FreeBSD 8.4-RELEASE i386
>Organization:
>Environment:
>Description:
- Fix build on -current
- Add DESKTOP_ENTRIES
New file:
files/patch-Imakefile
files/patch-X-gfx1.c
files/patch-X-widget.c
files/patch-Xaw-main.c
files/patch-Xpat.tmpl
files/patch-layout.c
files/patch-loadsave.c
files/patch-xpat.h
files/patch-xpat2.man
Remove file:
files/patch-aa
files/patch-ab
>How-To-Repeat:
>Fix:
diff -urN /usr/ports/games/xpat2/Makefile games/xpat2/Makefile
--- /usr/ports/games/xpat2/Makefile 2012-11-08 07:23:02.000000000 +0900
+++ games/xpat2/Makefile 2013-06-16 00:00:00.000000000 +0900
@@ -1,30 +1,32 @@
-# New ports collection makefile for: xpat2
-# Date created: 5 March 1997
-# Whom: Matthew Hunt <mph at pobox.com>
-#
+# Created by: Matthew Hunt <mph at pobox.com>
# $FreeBSD: head/games/xpat2/Makefile 300896 2012-07-14 13:54:48Z beat $
-#
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 at FreeBSD.org
-COMMENT= An X11 solitaire game with 14 variations
+COMMENT= X11 solitaire game with 14 variations
+
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}/src
-USE_IMAKE= yes
USE_XORG= xaw
+USE_IMAKE= yes
+
+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
diff -urN /usr/ports/games/xpat2/files/patch-Imakefile games/xpat2/files/patch-Imakefile
--- /usr/ports/games/xpat2/files/patch-Imakefile 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-Imakefile 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-X-gfx1.c games/xpat2/files/patch-X-gfx1.c
--- /usr/ports/games/xpat2/files/patch-X-gfx1.c 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-X-gfx1.c 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-X-widget.c games/xpat2/files/patch-X-widget.c
--- /usr/ports/games/xpat2/files/patch-X-widget.c 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-X-widget.c 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-Xaw-main.c games/xpat2/files/patch-Xaw-main.c
--- /usr/ports/games/xpat2/files/patch-Xaw-main.c 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-Xaw-main.c 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-Xpat.tmpl games/xpat2/files/patch-Xpat.tmpl
--- /usr/ports/games/xpat2/files/patch-Xpat.tmpl 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-Xpat.tmpl 2013-06-16 00:00:00.000000000 +0900
@@ -0,0 +1,49 @@
+--- Xpat.tmpl.orig
++++ Xpat.tmpl
+@@ -40,9 +40,9 @@
+
+ XCOMM 1. Specify User Interface (_exactly_ one of the interfaces below)
+ #undef useXlib /* similar to xpat version 1.x, not all features */
+-#undef useXaw /* the classic Athena based interface for xpat2 */
++#define useXaw /* the classic Athena based interface for xpat2 */
+ #undef useXview /* Xview / OpenLook interface */
+-#define useXQt /* Qt widgets, playable, but NOT YET FINISHED */
++#undef useXQt /* Qt widgets, playable, but NOT YET FINISHED */
+ /* advice on Qt improvements from experienced
+ programmers welcome at Michael.Bischoff at gmx.net */
+ #undef useXm1 /* Motif based interface (first variant) */
+@@ -57,7 +57,7 @@
+
+ XCOMM 4. Specify, if you want sound (must copy the appropriate sound module).
+ XCOMM Doesn't harm if you don't have a sound card.
+-#define USE_SOUND
++#undef USE_SOUND
+ XCOMM SOUNDOBJ must be one module of X-sound_*.o.
+ XCOMM Ignored if USE_SOUND is OFF.
+ XCOMM Note: The default is to copy an .au-file to /dev/audio,
+@@ -74,7 +74,7 @@
+ XCOMM 4.) Specify, if you want sound (must copy the appropriate sound module)
+ XCOMM SOUNDOBJ should be one module of X-sound_*.o if USE_SOUND is on, else empty
+ XCOMM Note: for X-sound_SUN.o, /dev/audio must have 666 permissions */
+-#define USE_SOUND /* doesn't harm if you don't have a sound card */
++#undef USE_SOUND /* doesn't harm if you don't have a sound card */
+ XCOMM the default is to copy an .au-file to /dev/audio
+ SOUNDOBJ = X-sound_SUN.o
+
+@@ -161,13 +161,14 @@
+ XCOMM #########################################################################
+
+ XCOMM Root directory of xpat2 installation
+-XPATROOT = /usr/games/lib/xpat
++XPATROOT = $(PREFIX)/lib/xpat
+ XCOMM XPATROOT = /usr/local/lib/xpat
+ XCOMM XPATROOT = /opt/XPat2
+
+ XPATLIBDIR = $(XPATROOT)
+ APPDEFSDIR = $(LIBDIR)
+-XPATMANDIR = $(XPATROOT)/man/man6
++XPATMANDIR = $(PREFIX)/man/man6
++MANSUFFIX = 6
+
+ XCOMM This is the name of the log-file, where solved games are stored:
+ SCOREFILE = /var/games/xpat.log
diff -urN /usr/ports/games/xpat2/files/patch-aa games/xpat2/files/patch-aa
--- /usr/ports/games/xpat2/files/patch-aa 2012-11-08 07:23:02.000000000 +0900
+++ games/xpat2/files/patch-aa 1970-01-01 09:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-ab games/xpat2/files/patch-ab
--- /usr/ports/games/xpat2/files/patch-ab 2012-11-08 07:23:02.000000000 +0900
+++ games/xpat2/files/patch-ab 1970-01-01 09:00:00.000000000 +0900
@@ -1,48 +0,0 @@
---- Xpat.tmpl.orig Sun Nov 5 12:03:10 2000
-+++ Xpat.tmpl Sun Jul 28 17:38:32 2002
-@@ -40,9 +40,9 @@
-
- XCOMM 1. Specify User Interface (_exactly_ one of the interfaces below)
- #undef useXlib /* similar to xpat version 1.x, not all features */
--#undef useXaw /* the classic Athena based interface for xpat2 */
-+#define useXaw /* the classic Athena based interface for xpat2 */
- #undef useXview /* Xview / OpenLook interface */
--#define useXQt /* Qt widgets, playable, but NOT YET FINISHED */
-+#undef useXQt /* Qt widgets, playable, but NOT YET FINISHED */
- /* advice on Qt improvements from experienced
- programmers welcome at Michael.Bischoff at gmx.net */
- #undef useXm1 /* Motif based interface (first variant) */
-@@ -57,7 +57,7 @@
-
- XCOMM 4. Specify, if you want sound (must copy the appropriate sound module).
- XCOMM Doesn't harm if you don't have a sound card.
--#define USE_SOUND
-+#undef USE_SOUND
- XCOMM SOUNDOBJ must be one module of X-sound_*.o.
- XCOMM Ignored if USE_SOUND is OFF.
- XCOMM Note: The default is to copy an .au-file to /dev/audio,
-@@ -74,7 +74,7 @@
- XCOMM 4.) Specify, if you want sound (must copy the appropriate sound module)
- XCOMM SOUNDOBJ should be one module of X-sound_*.o if USE_SOUND is on, else empty
- XCOMM Note: for X-sound_SUN.o, /dev/audio must have 666 permissions */
--#define USE_SOUND /* doesn't harm if you don't have a sound card */
-+#undef USE_SOUND /* doesn't harm if you don't have a sound card */
- XCOMM the default is to copy an .au-file to /dev/audio
- SOUNDOBJ = X-sound_SUN.o
-
-@@ -161,13 +161,14 @@
- XCOMM #########################################################################
-
- XCOMM Root directory of xpat2 installation
--XPATROOT = /usr/games/lib/xpat
-+XPATROOT = $(PREFIX)/lib/xpat
- XCOMM XPATROOT = /usr/local/lib/xpat
- XCOMM XPATROOT = /opt/XPat2
-
- XPATLIBDIR = $(XPATROOT)
- APPDEFSDIR = $(LIBDIR)
- XPATMANDIR = $(XPATROOT)/man/man6
-+MANSUFFIX = 6
-
- XCOMM This is the name of the log-file, where solved games are stored:
- SCOREFILE = /var/games/xpat.log
diff -urN /usr/ports/games/xpat2/files/patch-layout.c games/xpat2/files/patch-layout.c
--- /usr/ports/games/xpat2/files/patch-layout.c 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-layout.c 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-loadsave.c games/xpat2/files/patch-loadsave.c
--- /usr/ports/games/xpat2/files/patch-loadsave.c 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-loadsave.c 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-xpat.h games/xpat2/files/patch-xpat.h
--- /usr/ports/games/xpat2/files/patch-xpat.h 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-xpat.h 2013-06-16 00:00:00.000000000 +0900
@@ -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 -urN /usr/ports/games/xpat2/files/patch-xpat2.man games/xpat2/files/patch-xpat2.man
--- /usr/ports/games/xpat2/files/patch-xpat2.man 1970-01-01 09:00:00.000000000 +0900
+++ games/xpat2/files/patch-xpat2.man 2013-06-16 00:00:00.000000000 +0900
@@ -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 at 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 -urN /usr/ports/games/xpat2/pkg-plist games/xpat2/pkg-plist
--- /usr/ports/games/xpat2/pkg-plist 2012-11-08 07:23:02.000000000 +0900
+++ games/xpat2/pkg-plist 2013-06-16 00:00:00.000000000 +0900
@@ -176,5 +176,4 @@
@dirrm lib/xpat/italian
@dirrm lib/xpat/russian
@dirrm lib/xpat
- at cwd /
-var/games/xpat.log
+ at unexec if [ ! -s /var/games/xpat.log ]; then rm -f /var/games/xpat.log; fi
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list