1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

- Update to 0.5.1

- Install highscores in /var/games/typespeed
This commit is contained in:
Emanuel Haupt 2006-06-22 11:28:04 +00:00
parent 65c3541da0
commit 9e057f48ec
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=166027
9 changed files with 113 additions and 131 deletions

View File

@ -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
USE_GETOPT_LONG=yes
SCOREPREFIX?= /var/games
SCOREDIR= ${SCOREPREFIX}/typespeed
SCORECAT= dos dut eng fin fra ger ita portuguese prog spanish thai unix
SOURCES= file.c menu.c misc.c network.c typespeed.c
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
USE_GETOPT_LONG= yes
MAKE_ENV= CPPFLAGS="${CPPFLAGS}" LFLAGS="${LDFLAGS}"
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>

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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%%