- remove one unnecessary patch and replace with use of

MAKE_FLAGS/ALL_TARGET
- rename patches
- store the score file in /var/games instead of ${PREFIX}/lib/connect4
- add proper INSTALL/DEINSTALL scripts to setup the score file and to
remind to remove it on deinstallation.
This commit is contained in:
brad 2001-08-11 03:17:12 +00:00
parent 5e6c15667a
commit bf2c4bc9d1
9 changed files with 133 additions and 110 deletions

View File

@ -1,13 +1,13 @@
# $OpenBSD: Makefile,v 1.16 2001/08/05 20:46:50 jsyn Exp $
# $OpenBSD: Makefile,v 1.17 2001/08/11 03:17:12 brad Exp $
COMMENT= "curses version of the classic game"
DISTNAME= connect4
PKGNAME= connect4-3.2
CATEGORIES= games
NEED_VERSION= 1.402
NEED_VERSION= 1.413
MASTER_SITES= ftp://scitsc.wlv.ac.uk/pub/infomagic/usenet/games/volume6/
EXTRACT_SUFX= # empty
EXTRACT_SUFX= # empty
EXTRACT_CASES= connect4) ${_SED_FIX_SHAR} ${FULLDISTDIR}/$$archive | /bin/sh;;
@ -19,17 +19,16 @@ PERMIT_PACKAGE_FTP= "no license"
PERMIT_DISTFILES_CDROM= "no license"
PERMIT_DISTFILES_FTP= "no license"
MAKE_FLAGS= CFLAGS='${CFLAGS} -DSCOREFILE=\"${SCOREFILE}\"'
MAKE_FLAGS= CFLAGS='${CFLAGS} -DSCOREFILE=\"/var/games/connect4.scores\"'
ALL_TARGET= c4
WRKDIST= ${WRKDIR}
SCOREFILE= ${PREFIX}/lib/connect4/scores
MANDIR= ${PREFIX}/man/man
LIBDIR= ${PREFIX}/lib
do-install:
@${INSTALL_DATA_DIR} ${LIBDIR}/connect4
${INSTALL_PROGRAM} ${WRKBUILD}/c4 ${PREFIX}/bin/connect4
${INSTALL_MAN} ${FILESDIR}/connect4.6 ${MANDIR}6/
@chown root.games ${PREFIX}/bin/connect4
@chmod 2755 ${PREFIX}/bin/connect4
${INSTALL_MAN} ${FILESDIR}/connect4.6 ${PREFIX}/man/man6
.include <bsd.port.mk>

View File

@ -1,24 +0,0 @@
*** Makefile.orig Tue Apr 15 21:55:19 1997
--- Makefile Tue Apr 15 21:57:58 1997
***************
*** 1,7 ****
# Makefile for c4
! CFLAGS = -g #-DSCOREFILE=\"/usr/games/lib/c4.scores\"
CURSES = -lcurses -ltermcap
c4 : c4.o screen.o c4.h tables.h types.h
cc $(CFLAGS) -o c4 c4.o screen.o $(CURSES)
--- 1,12 ----
# Makefile for c4
+ # Patched for FreeBSD 2.1.5R by
+ # Joel Sutton <suttonj@interconnect.com.au>
+ # 15th April, 1997
! CFLAGS = -O -g -DSCOREFILE=\"/usr/local/lib/connect4/scores\"
CURSES = -lcurses -ltermcap
+
+ all: c4
c4 : c4.o screen.o c4.h tables.h types.h
cc $(CFLAGS) -o c4 c4.o screen.o $(CURSES)

View File

@ -1,49 +0,0 @@
*** c4.c.orig Tue Apr 15 22:06:03 1997
--- c4.c Tue Apr 15 22:16:29 1997
***************
*** 11,16 ****
--- 11,18 ----
* BITNET: tcjones@WATER.bitnet
* Canadian domain: tcjones@dragon.uwaterloo.ca
*
+ * Patched by Joel Sutton, 15th April 1997
+ * Changed gets calls to fgets. Changed inital prompt slightly.
*/
#include <stdio.h>
***************
*** 219,225 ****
register char *cp;
printf("Would you like to go first? (yes/no) -> ");
! if (!gets(line)){
plot_finish();
fprintf(stderr, "Could not read input line.\n");
goodbye();
--- 221,227 ----
register char *cp;
printf("Would you like to go first? (yes/no) -> ");
! if (!fgets(line,256,stdin)){
plot_finish();
fprintf(stderr, "Could not read input line.\n");
goodbye();
***************
*** 620,627 ****
}
}
! printf("Do you need help (n/y)? -> ");
! if (!gets(line)){
fprintf(stderr, "Could not read input line\n");
goodbye();
}
--- 622,629 ----
}
}
! printf("Do you need help (y/n)? -> ");
! if (!fgets(line,256,stdin)){
fprintf(stderr, "Could not read input line\n");
goodbye();
}

View File

@ -1,23 +0,0 @@
*** screen.c.orig Tue Apr 15 22:06:03 1997
--- screen.c Tue Apr 15 22:16:30 1997
***************
*** 1,3 ****
--- 1,8 ----
+ /*
+ * Patched by Joel Sutton, 15th April 1997
+ * Added endwin to tidy things up as per usenet posted patch.
+ */
+
#include <stdio.h>
#include <curses.h>
#include "c4.h"
***************
*** 116,121 ****
--- 121,127 ----
refresh();
nocrmode();
echo();
+ endwin();
}

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-c4_c,v 1.1 2001/08/11 03:17:12 brad Exp $
--- c4.c.orig Fri Aug 10 22:48:14 2001
+++ c4.c Fri Aug 10 22:48:25 2001
@@ -11,6 +11,8 @@
* BITNET: tcjones@WATER.bitnet
* Canadian domain: tcjones@dragon.uwaterloo.ca
*
+ * Patched by Joel Sutton, 15th April 1997
+ * Changed gets calls to fgets. Changed inital prompt slightly.
*/
#include <stdio.h>
@@ -219,7 +221,7 @@ ask_turn()
register char *cp;
printf("Would you like to go first? (yes/no) -> ");
- if (!gets(line)){
+ if (!fgets(line,256,stdin)){
plot_finish();
fprintf(stderr, "Could not read input line.\n");
goodbye();
@@ -620,8 +622,8 @@ ask_help()
}
}
- printf("Do you need help (n/y)? -> ");
- if (!gets(line)){
+ printf("Do you need help (y/n)? -> ");
+ if (!fgets(line,256,stdin)){
fprintf(stderr, "Could not read input line\n");
goodbye();
}

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-screen_c,v 1.1 2001/08/11 03:17:12 brad Exp $
--- screen.c.orig Fri Aug 10 22:48:15 2001
+++ screen.c Fri Aug 10 22:48:25 2001
@@ -1,3 +1,8 @@
+/*
+ * Patched by Joel Sutton, 15th April 1997
+ * Added endwin to tidy things up as per usenet posted patch.
+ */
+
#include <stdio.h>
#include <curses.h>
#include "c4.h"
@@ -116,6 +121,7 @@ plot_finish()
refresh();
nocrmode();
echo();
+ endwin();
}

View File

@ -0,0 +1,25 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1 2001/08/11 03:17:12 brad Exp $
#
# connect4 de-installation
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/connect4.scores
if [ -f $SCORE_FILE ]; then
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| this step as root:"
echo "|"
echo "| rm -f $SCORE_FILE"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
fi
exit 0

View File

@ -0,0 +1,46 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1 2001/08/11 03:17:12 brad Exp $
#
# Pre/post-installation setup of connect4
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/connect4.scores
# Function: install a blank file to be used as the connect4 score file
#
do_install()
{
touch $SCORE_FILE
chown root.games $SCORE_FILE
chmod 664 $SCORE_FILE
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ ! -f $SCORE_FILE ]; then
do_install $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -1,6 +1,3 @@
@comment $OpenBSD: PLIST,v 1.3 2000/11/02 17:45:39 espie Exp $
@comment $OpenBSD: PLIST,v 1.4 2001/08/11 03:17:12 brad Exp $
bin/connect4
man/man6/connect4.6
@exec mkdir -p %D/lib/connect4
@exec touch %D/lib/connect4/scores && chmod 666 %D/lib/connect4/scores
@unexec echo "To remove this package completely, rm %D/lib/connect4/scores"