aboutsummaryrefslogtreecommitdiff
path: root/games/typespeed
diff options
context:
space:
mode:
authorEmanuel Haupt <ehaupt@FreeBSD.org>2006-06-22 11:28:04 +0000
committerEmanuel Haupt <ehaupt@FreeBSD.org>2006-06-22 11:28:04 +0000
commit9e057f48ece677c59e8f7e76bd05a6174aadfdd6 (patch)
treecdf6b5cd038cb41c3785fc071a630a0407bb526a /games/typespeed
parent65c3541da0def5bcfd349ac307969576daab52e6 (diff)
downloadports-9e057f48ece677c59e8f7e76bd05a6174aadfdd6.tar.gz
ports-9e057f48ece677c59e8f7e76bd05a6174aadfdd6.zip
Notes
Diffstat (limited to 'games/typespeed')
-rw-r--r--games/typespeed/Makefile50
-rw-r--r--games/typespeed/distinfo6
-rw-r--r--games/typespeed/files/patch-Makefile70
-rw-r--r--games/typespeed/files/patch-file.c22
-rw-r--r--games/typespeed/files/pkg-deinstall.in16
-rw-r--r--games/typespeed/files/pkg-install.in24
-rw-r--r--games/typespeed/pkg-deinstall8
-rw-r--r--games/typespeed/pkg-install11
-rw-r--r--games/typespeed/pkg-plist35
9 files changed, 112 insertions, 130 deletions
diff --git a/games/typespeed/Makefile b/games/typespeed/Makefile
index 47abea2ef6f8..6ec13b139865 100644
--- a/games/typespeed/Makefile
+++ b/games/typespeed/Makefile
@@ -6,28 +6,62 @@
#
PORTNAME= typespeed
-PORTVERSION= 0.4.4
-PORTREVISION= 1
+PORTVERSION= 0.5.1
CATEGORIES= games
MASTER_SITES= http://tobias.eyedacor.org/typespeed/ \
http://critical.ch/distfiles/ \
http://energy.critical.ch/distfiles/
-DISTNAME= typespeed-${PORTVERSION}
MAINTAINER= ehaupt@FreeBSD.org
COMMENT= Test your typing speed, and get your fingers\' CPS
-MAN1= typespeed.1
+USE_GETOPT_LONG=yes
+
+SCOREPREFIX?= /var/games
+SCOREDIR= ${SCOREPREFIX}/typespeed
+SCORECAT= dos dut eng fin fra ger ita portuguese prog spanish thai unix
-USE_GETOPT_LONG= yes
+SOURCES= file.c menu.c misc.c network.c typespeed.c
-MAKE_ENV= CPPFLAGS="${CPPFLAGS}" LFLAGS="${LDFLAGS}"
+LDFLAGS+= -L${LOCALBASE}/lib -lncurses
+CFLAGS+= -I${LOCALBASE}/include -D_GNU_SOURCE -DWORDDIR=\"${DATADIR}\" \
+ -DHIGHDIR=\"${SCOREDIR}\" -DHIGHDIR=\"${SCOREDIR}\"
+
+SUB_FILES= pkg-install pkg-deinstall
+SUB_LIST= SCOREDIR="${SCOREDIR}" SCORECAT="${SCORECAT}"
+MAN1= typespeed.1
post-patch:
@${REINPLACE_CMD} -e 's|\(/etc\)|${PREFIX}\1|' \
- ${WRKSRC}/typespeed.h
+ ${WRKSRC}/pathnames.h
+
+post-extract:
+ @${ECHO} ${DATADIR} > ${WRKSRC}/typespeedrc
+
+do-build:
+# build highscore converter
+ ${CC} ${CFLAGS} ${WRKSRC}/convert.c -o ${WRKSRC}/convert
+
+# build typespeed
+.for f in ${SOURCES}
+ ${CC} ${CFLAGS} -c ${WRKSRC}/${f} -o ${WRKSRC}/${f:C/\.c/.o/}
+.endfor
+ ${CC} ${LDFLAGS} ${SOURCES:C/(.*)\.c/${WRKSRC}\/\1.o/} \
+ -o ${WRKSRC}/${PORTNAME}
+
+do-install:
+ ${INSTALL_PROGRAM} -m 2555 ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/convert ${PREFIX}/bin/${PORTNAME}-hs-conv
+ ${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.6 ${MANPREFIX}/man/man1/${MAN1}
+ ${INSTALL_DATA} ${WRKSRC}/typespeedrc ${PREFIX}/etc/typespeedrc.dist
+.if !exists(${PREFIX}/etc/typespeedrc)
+ ${INSTALL_DATA} ${WRKSRC}/typespeedrc ${PREFIX}/etc
+.endif
+ ${MKDIR} ${DATADIR}
+ ${FIND} ${WRKSRC} -name "words.*" -type f \
+ -exec ${INSTALL_DATA} {} ${DATADIR} \;
post-install:
- @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+ @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.include <bsd.port.mk>
diff --git a/games/typespeed/distinfo b/games/typespeed/distinfo
index da27f2451202..9a10631a6981 100644
--- a/games/typespeed/distinfo
+++ b/games/typespeed/distinfo
@@ -1,3 +1,3 @@
-MD5 (typespeed-0.4.4.tar.gz) = 97ca3e3d0323c41ecc4f453f557287ea
-SHA256 (typespeed-0.4.4.tar.gz) = 3c71da6ccb5e88a79e5dbc62132be9d8b0829894819b1330131cddcd124afa60
-SIZE (typespeed-0.4.4.tar.gz) = 38526
+MD5 (typespeed-0.5.1.tar.gz) = a39a4f76c047803c0b3d295d136365f0
+SHA256 (typespeed-0.5.1.tar.gz) = 742d629c38faff730e663703359fda7a5b9636488192485f1a860d5f7d6384b1
+SIZE (typespeed-0.5.1.tar.gz) = 54776
diff --git a/games/typespeed/files/patch-Makefile b/games/typespeed/files/patch-Makefile
deleted file mode 100644
index 6c3e38d17e6b..000000000000
--- a/games/typespeed/files/patch-Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
---- Makefile.orig Thu Aug 22 19:42:50 2002
-+++ Makefile Thu Apr 28 19:36:50 2005
-@@ -2,20 +2,19 @@
- # typespeed makefile
- #
-
--CC = gcc
--CFLAGS = -O -D_GNU_SOURCE -Wall
--LFLAGS = -lncurses
-+CFLAGS += -D_GNU_SOURCE -Wall $(CPPFLAGS)
-+LFLAGS += -lncurses
-
- PROG = typespeed
- SRCS = file.c menu.c misc.c network.c
- OBJS = file.o menu.o misc.o network.o
-
- local_dir = $(HOME)
--install_dir = "/usr/local/bin"
--wordfiles = "/usr/local/lib"
--man_dir = "/usr/local/man/man1/"
-+install_dir = "$(PREFIX)/bin"
-+wordfiles = "$(PREFIX)/lib"
-+man_dir = "$(PREFIX)/man/man1/"
-
--all: clean $(PROG)
-+all: $(PROG)
-
-
- clean:
-@@ -23,31 +22,21 @@
-
-
- $(PROG): $(OBJS)
--
- $(CC) $(CFLAGS) $(OBJS) -o $(PROG) $(PROG).c $(LFLAGS)
-
-
- install: typespeed
--
-- @echo Installing. You need to be root, or have access to install dirs
-- @echo ..and we know that everyone can delete the highscores, but
-- @echo we did not want to put setuid or setgid to typespeed yet,
-- @echo because then we would have to make a user for those..
-- @echo If you like to do it in that way, do it yourself.
-- @echo
-- cp typespeed $(install_dir)
-- chmod 755 $(install_dir)/typespeed
-+ $(BSD_INSTALL_PROGRAM) typespeed $(install_dir)
-+ chgrp games $(install_dir)/typespeed
-+ chmod g+s $(install_dir)/typespeed
- if test ! -d $(wordfiles)/typespeed; then mkdir $(wordfiles)/typespeed; fi
- ./typespeed --makescores
-- cp words.* $(wordfiles)/typespeed
-- cp high.* $(wordfiles)/typespeed
-- chmod 755 $(wordfiles)/typespeed
-- chmod 666 $(wordfiles)/typespeed/high.*
-- chmod 644 $(wordfiles)/typespeed/words.*
-- echo $(wordfiles)/typespeed/ > /etc/typespeedrc
-- cp typespeed.1 $(man_dir)
-- chmod 644 $(man_dir)/typespeed.1
-- @echo done...
-+.for cat in dos dut eng fin portuguese prog spanish unix
-+ $(BSD_INSTALL_DATA) words.$(cat) $(wordfiles)/typespeed
-+ $(BSD_INSTALL_DATA) high.words.$(cat) $(wordfiles)/typespeed/high.words.$(cat).default
-+.endfor
-+ echo $(wordfiles)/typespeed/ > $(PREFIX)/etc/typespeedrc
-+ $(BSD_INSTALL_MAN) typespeed.1 $(man_dir)
-
- uninstall: distclean
-
diff --git a/games/typespeed/files/patch-file.c b/games/typespeed/files/patch-file.c
index 63c53111d0e1..672ab49f0b2c 100644
--- a/games/typespeed/files/patch-file.c
+++ b/games/typespeed/files/patch-file.c
@@ -1,13 +1,11 @@
---- file.c.orig Mon Apr 3 15:44:40 2006
-+++ file.c Mon Apr 3 15:47:21 2006
-@@ -492,8 +492,8 @@
- char tmp[10];
- char *userhome;
+--- file.c.orig Thu Jun 22 12:15:04 2006
++++ file.c Thu Jun 22 12:18:11 2006
+@@ -393,7 +393,7 @@
+ entry[8] = newentry( 0, 0, 0 , 0 , 0, "None");
+ entry[9] = newentry( 0, 0, 0 , 0 , 0, "None");
+
+- n = snprintf(filetys, sizeof(filetys), "%s/high.%s", highdir, sanafile);
++ n = snprintf(filetys, sizeof(filetys), "%s/high.%s.default", highdir, sanafile);
+ if (n < 6 || (size_t)n > sizeof(filetys) - 1)
+ return 1;
-- userhome = malloc(1+strlen(getenv("HOME"))+strlen(LOCALCONF)*sizeof(char));
-- sprintf(userhome,getenv("HOME"));
-+ userhome = malloc((2+strlen(getenv("HOME"))+strlen(LOCALCONF))*sizeof(char));
-+ strcpy(userhome,getenv("HOME"));
- strcat(userhome,"/");
- strcat(userhome,LOCALCONF);
- hakemisto = malloc(1026 * sizeof(char));
diff --git a/games/typespeed/files/pkg-deinstall.in b/games/typespeed/files/pkg-deinstall.in
new file mode 100644
index 000000000000..1b2456a7b144
--- /dev/null
+++ b/games/typespeed/files/pkg-deinstall.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+SCOREDIR="%%SCOREDIR%%"
+SCORECAT="%%SCORECAT%%"
+
+[ "$2" != "DEINSTALL" ] && exit 0
+
+for cat in $SCORECAT; do
+ file="$SCOREDIR/high.words.$cat"
+ cmp -s "$file" "$file.default" && rm -f "$file"
+ rm -f "$file.default"
+done
+
+rmdir "$SCOREDIR" > /dev/null 2>&1 || true
diff --git a/games/typespeed/files/pkg-install.in b/games/typespeed/files/pkg-install.in
new file mode 100644
index 000000000000..1099653d4116
--- /dev/null
+++ b/games/typespeed/files/pkg-install.in
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+SCOREDIR="%%SCOREDIR%%"
+SCORECAT="%%SCORECAT%%"
+
+[ "$2" != "POST-INSTALL" ] && exit 0
+
+if [ ! -d "${SCOREDIR}" ]; then
+ mkdir -p ${SCOREDIR}
+ chown root:games ${SCOREDIR}
+fi
+
+typespeed --makescore
+
+for cat in $SCORECAT; do
+ file="${SCOREDIR}/high.words.$cat"
+ if [ -f "$file" ]; then
+ cmp -s "$file" "$file.default" && install -o root -g games -m 464 "$file.default" "$file"
+ else
+ install -o root -g games -m 464 "$file.default" "$file"
+ fi
+done
diff --git a/games/typespeed/pkg-deinstall b/games/typespeed/pkg-deinstall
deleted file mode 100644
index 2df053a74dc0..000000000000
--- a/games/typespeed/pkg-deinstall
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-[ "$2" != "DEINSTALL" ] && exit 0
-
-for cat in dos dut eng fin portuguese prog spanish unix; do
- file="$PKG_PREFIX/lib/typespeed/high.words.$cat"
- cmp -s "$file" "$file.default" && rm -f "$file"
-done
diff --git a/games/typespeed/pkg-install b/games/typespeed/pkg-install
deleted file mode 100644
index c68c7dc51a65..000000000000
--- a/games/typespeed/pkg-install
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-[ "$2" != "POST-INSTALL" ] && exit 0
-
-# Score files should normally go in /var/games/typespeed, but it would
-# require a lot of modifications to the ugly typespeed source code.
-
-for cat in dos dut eng fin portuguese prog spanish unix; do
- file="$PKG_PREFIX/lib/typespeed/high.words.$cat"
- [ -f "$file" ] || install -o root -g games -m 464 "$file.default" "$file"
-done
diff --git a/games/typespeed/pkg-plist b/games/typespeed/pkg-plist
index 1581444d6fa8..ba15084c9c58 100644
--- a/games/typespeed/pkg-plist
+++ b/games/typespeed/pkg-plist
@@ -1,19 +1,18 @@
bin/typespeed
-etc/typespeedrc
-lib/typespeed/high.words.dos.default
-lib/typespeed/high.words.dut.default
-lib/typespeed/high.words.eng.default
-lib/typespeed/high.words.fin.default
-lib/typespeed/high.words.portuguese.default
-lib/typespeed/high.words.prog.default
-lib/typespeed/high.words.spanish.default
-lib/typespeed/high.words.unix.default
-lib/typespeed/words.dos
-lib/typespeed/words.dut
-lib/typespeed/words.eng
-lib/typespeed/words.fin
-lib/typespeed/words.portuguese
-lib/typespeed/words.prog
-lib/typespeed/words.spanish
-lib/typespeed/words.unix
-@dirrmtry lib/typespeed
+bin/typespeed-hs-conv
+@unexec if cmp -s %D/etc/typespeedrc %D/etc/typespeedrc.dist; then rm -f %D/etc/typespeedrc; fi
+etc/typespeedrc.dist
+@exec [ -f %B/typespeedrc ] || cp %B/%f %B/typespeedrc
+%%DATADIR%%/words.dos
+%%DATADIR%%/words.dut
+%%DATADIR%%/words.eng
+%%DATADIR%%/words.fin
+%%DATADIR%%/words.fra
+%%DATADIR%%/words.ger
+%%DATADIR%%/words.ita
+%%DATADIR%%/words.portuguese
+%%DATADIR%%/words.prog
+%%DATADIR%%/words.spanish
+%%DATADIR%%/words.thai
+%%DATADIR%%/words.unix
+@dirrm %%DATADIR%%