aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2005-08-29 21:36:14 +0800
committerpav <pav@FreeBSD.org>2005-08-29 21:36:14 +0800
commitbf2a4415f1bc2184b6a27b3b6a1b1b6135b0b21b (patch)
tree8ac38915588e628dcd2ab6de5e5a6e093e86cf75
parent46821acb593b61198da741f6bc89050628949795 (diff)
downloadfreebsd-ports-gnome-bf2a4415f1bc2184b6a27b3b6a1b1b6135b0b21b.tar.gz
freebsd-ports-gnome-bf2a4415f1bc2184b6a27b3b6a1b1b6135b0b21b.tar.zst
freebsd-ports-gnome-bf2a4415f1bc2184b6a27b3b6a1b1b6135b0b21b.zip
- 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
-rw-r--r--games/dsnake/Makefile25
-rw-r--r--games/dsnake/files/pkg-deinstall.in9
-rw-r--r--games/dsnake/files/pkg-install.in11
-rw-r--r--games/dsnake/pkg-plist6
4 files changed, 39 insertions, 12 deletions
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 <bsd.port.mk>
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