From 8c2a3a470dcbca103c42e6ef464eca973f04c65b Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Mon, 29 Aug 2005 13:36:14 +0000 Subject: - Also create scores and configuration when installing from a package - Preserve modified scores and configuration across updates - Install using ${INSTALL_xxx}, to ensure proper permissions and ownerships - Pass command-line arguments through the wrapper script - Replace the shell process with the game, to save some memory while playing - Install documentation in ${DOCSDIR}, and respect ${NOPORTDOCS} PR: ports/84738 Submitted by: jylefort - Allow on amd64 --- games/dsnake/Makefile | 25 ++++++++++++++++++------- games/dsnake/files/pkg-deinstall.in | 9 +++++++++ games/dsnake/files/pkg-install.in | 11 +++++++++++ games/dsnake/pkg-plist | 6 +----- 4 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 games/dsnake/files/pkg-deinstall.in create mode 100644 games/dsnake/files/pkg-install.in (limited to 'games/dsnake') diff --git a/games/dsnake/Makefile b/games/dsnake/Makefile index 6c583ec364ec..c95b5cc008ff 100644 --- a/games/dsnake/Makefile +++ b/games/dsnake/Makefile @@ -7,7 +7,7 @@ PORTNAME= dsnake PORTVERSION= 3.0.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= games linux MASTER_SITES= http://bitblaze.com/downloads/ DISTNAME= ${PORTNAME}-linux-${PORTVERSION} @@ -19,21 +19,32 @@ RUN_DEPENDS= ${LINUXBASE}/usr/lib/liballeg.so.4.0:${PORTSDIR}/devel/linux-allegr NO_PACKAGE= Licence forbids any repacking and reselling -ONLY_FOR_ARCHS= i386 +ONLY_FOR_ARCHS= i386 amd64 USE_LINUX= yes USE_X_PREFIX= yes WRKSRC= ${WRKDIR}/DeluxeSnake +SUB_FILES= pkg-install pkg-deinstall +SUB_LIST= CONFIG_FILES="config.dat hiscores.dat stats.dat" + +PORTDOCS= * + do-build: ${BRANDELF} -t Linux ${WRKSRC}/dsnake do-install: - ${MKDIR} ${DATADIR} - (cd ${WRKSRC}; ${TAR} -cf - *) | (cd ${DATADIR}; ${TAR} -xf -) - ${TOUCH} ${DATADIR}/config.dat ${DATADIR}/hiscores.dat ${DATADIR}/stats.dat - ${CHMOD} 0666 ${DATADIR}/config.dat ${DATADIR}/hiscores.dat ${DATADIR}/stats.dat +.for d in data midi + ${MKDIR} ${DATADIR}/${d} + ${INSTALL_DATA} ${WRKSRC}/${d}/* ${DATADIR}/${d} +.endfor + ${INSTALL_PROGRAM} ${WRKSRC}/dsnake ${DATADIR} ${ECHO_CMD} "#!/bin/sh" > ${WRKDIR}/dsnake.sh - ${ECHO_CMD} "cd ${DATADIR} && ./dsnake -win" >> ${WRKDIR}/dsnake.sh + ${ECHO_CMD} "cd ${DATADIR} && exec ./dsnake \"\$$@\"" >> ${WRKDIR}/dsnake.sh ${INSTALL_SCRIPT} ${WRKDIR}/dsnake.sh ${PREFIX}/bin/dsnake +.if !defined(NOPORTDOCS) + ${MKDIR} ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/ReadMe.txt ${DOCSDIR} +.endif + @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL .include diff --git a/games/dsnake/files/pkg-deinstall.in b/games/dsnake/files/pkg-deinstall.in new file mode 100644 index 000000000000..e3f75bf9bfe2 --- /dev/null +++ b/games/dsnake/files/pkg-deinstall.in @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$2" = "DEINSTALL" ]; then + for f in %%CONFIG_FILES%%; do + if [ ! -s %%DATADIR%%/$f ]; then + rm -f %%DATADIR%%/$f + fi + done +fi diff --git a/games/dsnake/files/pkg-install.in b/games/dsnake/files/pkg-install.in new file mode 100644 index 000000000000..501c5ba27b11 --- /dev/null +++ b/games/dsnake/files/pkg-install.in @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$2" = "POST-INSTALL" ]; then + for f in %%CONFIG_FILES%%; do + if [ ! -f %%DATADIR%%/$f ]; then + touch %%DATADIR%%/$f + chown root:wheel %%DATADIR%%/$f + chmod 666 %%DATADIR%%/$f + fi + done +fi diff --git a/games/dsnake/pkg-plist b/games/dsnake/pkg-plist index 2d55da578e85..99063c1b0d24 100644 --- a/games/dsnake/pkg-plist +++ b/games/dsnake/pkg-plist @@ -1,5 +1,4 @@ bin/dsnake -%%DATADIR%%/config.dat %%DATADIR%%/data/fonts.dat %%DATADIR%%/data/logos.dat %%DATADIR%%/data/sfx.dat @@ -7,12 +6,9 @@ bin/dsnake %%DATADIR%%/data/sprites2.dat %%DATADIR%%/data/textures.dat %%DATADIR%%/dsnake -%%DATADIR%%/hiscores.dat %%DATADIR%%/midi/fall.mid %%DATADIR%%/midi/partille.mid %%DATADIR%%/midi/The_Jayomon_Beat.mid -%%DATADIR%%/ReadMe.txt -%%DATADIR%%/stats.dat @dirrm %%DATADIR%%/midi @dirrm %%DATADIR%%/data -@dirrm %%DATADIR%% +@unexec rmdir %D/%%DATADIR%% 2>/dev/null || true -- cgit v1.2.3