summaryrefslogtreecommitdiff
path: root/games/maelstrom-sdl
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2011-05-06 05:28:39 +0000
committerdholland <dholland@pkgsrc.org>2011-05-06 05:28:39 +0000
commit30a5570d8ef84d06235eb5805e5f25ff0b28cc21 (patch)
tree028b8a3ed18cc47b62cbde21e6ce6ef96ef1f5e0 /games/maelstrom-sdl
parent8330e559ec8ee5a181951b512eae147266793888 (diff)
downloadpkgsrc-30a5570d8ef84d06235eb5805e5f25ff0b28cc21.tar.gz
Put the scorefile in ${VARBASE}/games instead of under ${PREFIX}/share.
It is still mode 666, which is wrong (XXX), but this way: - the package will actually install again; - the score file is not overwritten every time you recompile/reinstall. There's also an .if 0 block in the makefile that can be turned on to install the game setgid so the score file can be mode 664. I'm not comfortable turning this on without doing at least a basic audit, and I don't have energy for that at the moment; but it's there and it works if anyone feels inclined to make that tradeoff locally. An alternative approach would be to write and install a setgid scorefile helper program, but that's not really any improvement over making the scores world writeable PKGREVISION -> 8.
Diffstat (limited to 'games/maelstrom-sdl')
-rw-r--r--games/maelstrom-sdl/Makefile24
-rw-r--r--games/maelstrom-sdl/distinfo8
-rw-r--r--games/maelstrom-sdl/patches/patch-aa14
-rw-r--r--games/maelstrom-sdl/patches/patch-ab14
-rw-r--r--games/maelstrom-sdl/patches/patch-main.cpp26
-rw-r--r--games/maelstrom-sdl/patches/patch-scores.cpp95
6 files changed, 170 insertions, 11 deletions
diff --git a/games/maelstrom-sdl/Makefile b/games/maelstrom-sdl/Makefile
index fcdf36e4bec..dc80903c185 100644
--- a/games/maelstrom-sdl/Makefile
+++ b/games/maelstrom-sdl/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.19 2010/03/23 16:02:39 joerg Exp $
+# $NetBSD: Makefile,v 1.20 2011/05/06 05:28:39 dholland Exp $
#
DISTNAME= Maelstrom-3.0.5
PKGNAME= maelstrom-sdl-3.0.5
-PKGREVISION= 7
+PKGREVISION= 8
CATEGORIES= games x11
MASTER_SITES= http://www.devolution.com/~slouken/Maelstrom/src/
@@ -17,9 +17,29 @@ CONFLICTS= maelstrom-x11-[0-9]* maelstrom-[0-9]*
GNU_CONFIGURE= YES
USE_LANGUAGES= c c++
+USE_GAMESGROUP= yes
MAKE_ENV+= CP=${CP:Q}
+.if 0
+# setgid
+CFLAGS+= -DMAELSTROM_SETGID
+SPECIAL_PERMS+= ${PREFIX}/bin/Maelstrom ${SETGID_GAMES_PERMS}
+SCOREFILE_PERMS= ${GAMEDATA_PERMS}
+.else
+# not setgid, world-writeable score file (XXX)
+SCOREFILE_PERMS= games games 666
+.endif
+BUILD_DEFS+= SCOREFILE_PERMS
+
+# Put scorefile in VARBASE.
+SCOREDIR= ${VARBASE}/games
+SCOREFILE= ${SCOREDIR}/Maelstrom-Scores
+ORIGSCOREFILE= ${PREFIX}/share/Maelstrom/Maelstrom-Scores
+REQD_FILES_PERMS+= ${ORIGSCOREFILE} ${SCOREFILE} ${SCOREFILE_PERMS}
+CFLAGS+= -DMAELSTROM_SCOREDIR=\"${SCOREDIR:Q}\"
+BUILD_DEFS+= VARBASE SCOREFILE
+
post-install:
${RM} ${DESTDIR}${PREFIX}/share/doc/Maelstrom/Docs/Makefile \
${DESTDIR}${PREFIX}/share/doc/Maelstrom/Docs/Makefile.in \
diff --git a/games/maelstrom-sdl/distinfo b/games/maelstrom-sdl/distinfo
index a62a88cd34e..7dfc82e3fc8 100644
--- a/games/maelstrom-sdl/distinfo
+++ b/games/maelstrom-sdl/distinfo
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.7 2010/03/23 16:02:39 joerg Exp $
+$NetBSD: distinfo,v 1.8 2011/05/06 05:28:39 dholland Exp $
SHA1 (Maelstrom-3.0.5.tar.gz) = 3731cc0ea73138539c7b12bf0b297d68be96cbab
RMD160 (Maelstrom-3.0.5.tar.gz) = 1c0dbf3d588025ce18fced4733e638670e0c5de0
Size (Maelstrom-3.0.5.tar.gz) = 977191 bytes
-SHA1 (patch-aa) = d886cc680968b6ee22abbbf78775928d7318862c
-SHA1 (patch-ab) = 54abac77b1d6afe82bf8bfb3a4288d32091039dc
+SHA1 (patch-aa) = bf4b22c11e89517b2c71ef962924a29b88f99deb
+SHA1 (patch-ab) = a1579e308284aee80ccc9c0f69c2c105761191cd
SHA1 (patch-ac) = 3c2b09dab9a40b2499fd8d1ddb744084b049c4a8
SHA1 (patch-ad) = 2d72ac28eb44cd00f8007be305bedb9f5d41e448
SHA1 (patch-ae) = a256a45e5ac3c4d82cb3333a49e31ecf0ed318b2
@@ -12,3 +12,5 @@ SHA1 (patch-af) = 8e289ee79c6fed20de4edde1d4cfa8df65cab854
SHA1 (patch-ag) = 038060e5173abb369a8667aac9fa756f04044f82
SHA1 (patch-ah) = 9232b9ad502934c59c8a8e57b2bf8d1a02c501b1
SHA1 (patch-ai) = 3571848e190da2ca20479b447ffee48a1fdfb65c
+SHA1 (patch-main.cpp) = ff86772919d3e0ea584db487c81e2bb70828cd31
+SHA1 (patch-scores.cpp) = b8198f73b4754ffb992e86cfc89f7de63a673b0e
diff --git a/games/maelstrom-sdl/patches/patch-aa b/games/maelstrom-sdl/patches/patch-aa
index d52e7c5b48f..4d25d64216c 100644
--- a/games/maelstrom-sdl/patches/patch-aa
+++ b/games/maelstrom-sdl/patches/patch-aa
@@ -1,8 +1,13 @@
-$NetBSD: patch-aa,v 1.3 2010/03/23 16:02:39 joerg Exp $
+$NetBSD: patch-aa,v 1.4 2011/05/06 05:28:39 dholland Exp $
+
+DESTDIR support.
+Install the docs.
+Use $(CP).
+Don't install default scores file mode 666.
--- Makefile.am.orig 2001-07-23 03:45:05.000000000 +0000
+++ Makefile.am
-@@ -65,11 +65,12 @@ DIST_SUBDIRS = $(SUBDIRS) Images Docs
+@@ -65,21 +65,22 @@ DIST_SUBDIRS = $(SUBDIRS) Images Docs
# Special install rule for the game
install:
@@ -17,7 +22,10 @@ $NetBSD: patch-aa,v 1.3 2010/03/23 16:02:39 joerg Exp $
Maelstrom_Fonts \
Maelstrom_Sounds \
Maelstrom_Sprites \
-@@ -79,7 +80,7 @@ install_gamedata:
+ Maelstrom-Scores \
+ icon.bmp icon.xpm $(target)/
+- chmod 666 $(target)/Maelstrom-Scores
++ chmod 644 $(target)/Maelstrom-Scores
install_gamedocs:
sh mkinstalldirs $(target)/
diff --git a/games/maelstrom-sdl/patches/patch-ab b/games/maelstrom-sdl/patches/patch-ab
index d82b7f350a8..b5e7eb9f702 100644
--- a/games/maelstrom-sdl/patches/patch-ab
+++ b/games/maelstrom-sdl/patches/patch-ab
@@ -1,8 +1,13 @@
-$NetBSD: patch-ab,v 1.3 2010/03/23 16:02:39 joerg Exp $
+$NetBSD: patch-ab,v 1.4 2011/05/06 05:28:39 dholland Exp $
+
+DESTDIR support.
+Install the docs.
+Use $(CP).
+Don't install default scores file mode 666.
--- Makefile.in.orig 2001-07-23 03:56:05.000000000 +0000
+++ Makefile.in
-@@ -432,11 +432,12 @@ maintainer-clean-generic clean mostlycle
+@@ -432,21 +432,22 @@ maintainer-clean-generic clean mostlycle
# Special install rule for the game
install:
@@ -17,7 +22,10 @@ $NetBSD: patch-ab,v 1.3 2010/03/23 16:02:39 joerg Exp $
Maelstrom_Fonts \
Maelstrom_Sounds \
Maelstrom_Sprites \
-@@ -446,7 +447,7 @@ install_gamedata:
+ Maelstrom-Scores \
+ icon.bmp icon.xpm $(target)/
+- chmod 666 $(target)/Maelstrom-Scores
++ chmod 644 $(target)/Maelstrom-Scores
install_gamedocs:
sh mkinstalldirs $(target)/
diff --git a/games/maelstrom-sdl/patches/patch-main.cpp b/games/maelstrom-sdl/patches/patch-main.cpp
new file mode 100644
index 00000000000..37512aa1544
--- /dev/null
+++ b/games/maelstrom-sdl/patches/patch-main.cpp
@@ -0,0 +1,26 @@
+$NetBSD: patch-main.cpp,v 1.1 2011/05/06 05:28:39 dholland Exp $
+
+Support running setgid instead of installing the scores file mode 666.
+
+--- main.cpp~ 2000-09-24 17:55:56.000000000 +0000
++++ main.cpp
+@@ -163,10 +163,19 @@ void PrintUsage(void)
+ exit(1);
+ }
+
++#ifdef MAELSTROM_SETGID
++gid_t gamesgid;
++#endif
++
+ /* ----------------------------------------------------------------- */
+ /* -- Blitter main program */
+ int main(int argc, char *argv[])
+ {
++#ifdef MAELSTROM_SETGID
++ gamesgid = getegid();
++ setegid(getgid());
++#endif
++
+ /* Command line flags */
+ int doprinthigh = 0;
+ int speedtest = 0;
diff --git a/games/maelstrom-sdl/patches/patch-scores.cpp b/games/maelstrom-sdl/patches/patch-scores.cpp
new file mode 100644
index 00000000000..4ec22481f90
--- /dev/null
+++ b/games/maelstrom-sdl/patches/patch-scores.cpp
@@ -0,0 +1,95 @@
+$NetBSD: patch-scores.cpp,v 1.1 2011/05/06 05:28:39 dholland Exp $
+
+Support running setgid instead of installing the scores file mode 666.
+Put the scores file in VARBASE instead of /usr/pkg/share.
+
+--- scores.cpp~ 2000-09-24 17:55:39.000000000 +0000
++++ scores.cpp
+@@ -18,8 +18,13 @@
+ #define MAELSTROM_SCORES "Maelstrom-Scores"
+ #define NUM_SCORES 10 // Do not change this!
+
++#ifndef MAELSTROM_SETGID
+ /* Everyone can write to scores file if defined to 0 */
+ #define SCORES_PERMMASK 0
++#else
++#define SCORES_PERMMASK 022
++extern gid_t gamesgid;
++#endif
+
+ #define CLR_DIALOG_WIDTH 281
+ #define CLR_DIALOG_HEIGHT 111
+@@ -29,10 +34,19 @@ Scores hScores[NUM_SCORES];
+
+ void LoadScores(void)
+ {
++#ifndef MAELSTROM_SCOREDIR
+ LibPath path;
++#endif
++ const char *pathstr;
+ SDL_RWops *scores_src;
+ int i;
+
++#ifndef MAELSTROM_SCOREDIR
++ pathstr = path.Path(MAELSTROM_SCORES);
++#else
++ pathstr = MAELSTROM_SCOREDIR "/" MAELSTROM_SCORES;
++#endif
++
+ /* Try to load network scores, if we can */
+ if ( gNetScores ) {
+ if ( NetLoadScores() == 0 )
+@@ -44,7 +58,7 @@ void LoadScores(void)
+ }
+ memset(&hScores, 0, sizeof(hScores));
+
+- scores_src = SDL_RWFromFile(path.Path(MAELSTROM_SCORES), "rb");
++ scores_src = SDL_RWFromFile(pathstr, "rb");
+ if ( scores_src != NULL ) {
+ for ( i=0; i<NUM_SCORES; ++i ) {
+ SDL_RWread(scores_src, hScores[i].name,
+@@ -58,7 +72,10 @@ void LoadScores(void)
+
+ void SaveScores(void)
+ {
++#ifndef MAELSTROM_SCOREDIR
+ LibPath path;
++#endif
++ const char *pathstr;
+ SDL_RWops *scores_src;
+ int i;
+ #ifdef unix
+@@ -69,10 +86,22 @@ void SaveScores(void)
+ if ( gNetScores )
+ return;
+
++#ifndef MAELSTROM_SCOREDIR
++ pathstr = path.Path(MAELSTROM_SCORES);
++#else
++ pathstr = MAELSTROM_SCOREDIR "/" MAELSTROM_SCORES;
++#endif
++
+ #ifdef unix
+ omask=umask(SCORES_PERMMASK);
+ #endif
+- scores_src = SDL_RWFromFile(path.Path(MAELSTROM_SCORES), "wb");
++#ifdef MAELSTROM_SETGID
++ setegid(gamesgid);
++#endif
++ scores_src = SDL_RWFromFile(pathstr, "wb");
++#ifdef MAELSTROM_SETGID
++ setegid(getgid());
++#endif
+ if ( scores_src != NULL ) {
+ for ( i=0; i<NUM_SCORES; ++i ) {
+ SDL_RWwrite(scores_src, hScores[i].name,
+@@ -82,8 +111,7 @@ void SaveScores(void)
+ }
+ SDL_RWclose(scores_src);
+ } else {
+- error("Warning: Couldn't save scores to %s\n",
+- path.Path(MAELSTROM_SCORES));
++ error("Warning: Couldn't save scores to %s\n", pathstr);
+ }
+ #ifdef unix
+ umask(omask);