Bug 179582 - games/xpat2: Fix build on -current
Summary: games/xpat2: Fix build on -current
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Martin Wilke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-15 19:10 UTC by tkato432
Modified: 2013-07-18 09:30 UTC (History)
0 users

See Also:


Attachments
file.diff (15.93 KB, patch)
2013-06-15 19:10 UTC, tkato432
no flags Details | Diff
games_xpat2.diff (16.19 KB, patch)
2013-06-17 18:55 UTC, tkato432
no flags Details | Diff
games_xpat2.diff (15.96 KB, patch)
2013-06-29 19:00 UTC, tkato432
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tkato432 2013-06-15 19:10:01 UTC
- 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
Comment 1 Edwin Groothuis freebsd_committer 2013-06-15 19:10:32 UTC
Responsible Changed
From-To: freebsd-ports-bugs->miwi

miwi@ wants this submitter's PRs (via the GNATS Auto Assign Tool)
Comment 2 Martin Wilke freebsd_committer 2013-06-17 16:03:23 UTC
State Changed
From-To: open->feedback

fail to build 
http://po.miwibox.org:1288/bulk/latest-per-pkg/xpat2/1.07_3/
Comment 3 tkato432 2013-06-17 18:55:03 UTC
Here is the corrected patch.
Comment 4 Martin Wilke freebsd_committer 2013-06-27 07:55:28 UTC
State Changed
From-To: feedback->open

Submitter has fixed.
Comment 5 Martin Wilke freebsd_committer 2013-06-27 07:56:11 UTC
State Changed
From-To: open->feedback

still fails on freebsd 8.4 
http://po.miwibox.org:1288/bulk/latest-per-pkg/xpat2/1.07_3/
Comment 6 tkato432 2013-06-29 19:00:00 UTC
Remake of the patch against current tree.
Comment 7 Martin Wilke freebsd_committer 2013-07-18 09:25:17 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 8 dfilter service freebsd_committer 2013-07-18 09:25:28 UTC
Author: miwi
Date: Thu Jul 18 08:25:11 2013
New Revision: 323209
URL: http://svnweb.freebsd.org/changeset/ports/323209

Log:
  - unbreak on current
  
  PR:		179582

Added:
  head/games/xpat2/files/patch-Imakefile   (contents, props changed)
  head/games/xpat2/files/patch-X-gfx1.c   (contents, props changed)
  head/games/xpat2/files/patch-X-widget.c   (contents, props changed)
  head/games/xpat2/files/patch-Xaw-main.c   (contents, props changed)
  head/games/xpat2/files/patch-Xpat.tmpl   (contents, props changed)
  head/games/xpat2/files/patch-layout.c   (contents, props changed)
  head/games/xpat2/files/patch-loadsave.c   (contents, props changed)
  head/games/xpat2/files/patch-xpat.h   (contents, props changed)
  head/games/xpat2/files/patch-xpat2.man   (contents, props changed)
Deleted:
  head/games/xpat2/files/patch-aa
  head/games/xpat2/files/patch-ab
Modified:
  head/games/xpat2/Makefile   (contents, props changed)
  head/games/xpat2/pkg-plist   (contents, props changed)

Modified: head/games/xpat2/Makefile
==============================================================================
--- head/games/xpat2/Makefile	Thu Jul 18 08:24:08 2013	(r323208)
+++ head/games/xpat2/Makefile	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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>

Added: head/games/xpat2/files/patch-Imakefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-Imakefile	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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:

Added: head/games/xpat2/files/patch-X-gfx1.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-X-gfx1.c	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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]);
+ 			}

Added: head/games/xpat2/files/patch-X-widget.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-X-widget.c	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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");
+ 

Added: head/games/xpat2/files/patch-Xaw-main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-Xaw-main.c	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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);
+ 

Added: head/games/xpat2/files/patch-Xpat.tmpl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-Xpat.tmpl	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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@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

Added: head/games/xpat2/files/patch-layout.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-layout.c	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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) {

Added: head/games/xpat2/files/patch-loadsave.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-loadsave.c	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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

Added: head/games/xpat2/files/patch-xpat.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-xpat.h	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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))

Added: head/games/xpat2/files/patch-xpat2.man
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpat2/files/patch-xpat2.man	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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

Modified: head/games/xpat2/pkg-plist
==============================================================================
--- head/games/xpat2/pkg-plist	Thu Jul 18 08:24:08 2013	(r323208)
+++ head/games/xpat2/pkg-plist	Thu Jul 18 08:25:11 2013	(r323209)
@@ -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
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"