diff --git a/recipes-games/maelstrom/maelstrom/0001-Use-pkg-config-to-find-sdl.patch b/recipes-games/maelstrom/maelstrom/0001-Use-pkg-config-to-find-sdl.patch new file mode 100644 index 0000000..d016027 --- /dev/null +++ b/recipes-games/maelstrom/maelstrom/0001-Use-pkg-config-to-find-sdl.patch @@ -0,0 +1,34 @@ +From 6276f1388819e6f03e61133494e7c9d35c785e17 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Fri, 8 Feb 2019 19:11:19 +0100 +Subject: [PATCH] Use pkg-config to find sdl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Andreas Müller +--- + configure.in | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/configure.in b/configure.in +index 0170f4b..a6f76ac 100644 +--- a/configure.in ++++ b/configure.in +@@ -47,10 +47,7 @@ AC_SUBST(INETLIB) + + dnl Check for SDL + SDL_VERSION=1.2.0 +-AM_PATH_SDL($SDL_VERSION, +- :, +- AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) +-) ++PKG_CHECK_MODULES([SDL], [sdl >= $SDL_VERSION], [HAVE_SDL=yes], [AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])]) + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + +-- +2.20.1 + diff --git a/recipes-games/maelstrom/maelstrom/0002-buttonlist.h-Fix-build-with-recent-gcc-s.patch b/recipes-games/maelstrom/maelstrom/0002-buttonlist.h-Fix-build-with-recent-gcc-s.patch new file mode 100644 index 0000000..eb3471b --- /dev/null +++ b/recipes-games/maelstrom/maelstrom/0002-buttonlist.h-Fix-build-with-recent-gcc-s.patch @@ -0,0 +1,87 @@ +From 7d79950348bda1ad4c1282d3316bc25838047569 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Fri, 8 Feb 2019 19:25:04 +0100 +Subject: [PATCH] buttonlist.h: Fix build with recent gcc's +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Stolen from [1] + +[1] https://src.fedoraproject.org/cgit/rpms/Maelstrom.git/plain/Maelstrom-3.0.6-gcc34.patch + +Upstream-Status: Pending + +Signed-off-by: Andreas Müller +--- + buttonlist.h | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/buttonlist.h b/buttonlist.h +index 7bb37b3..39427f5 100644 +--- a/buttonlist.h ++++ b/buttonlist.h +@@ -6,7 +6,17 @@ + + class ButtonList { + ++ + public: ++ typedef struct button { ++ /* Sensitive area */ ++ Uint16 x1, y1; ++ Uint16 x2, y2; ++ void (*callback)(void); ++ struct button *next; ++ } button; ++ button button_list; ++ + ButtonList() { + button_list.next = NULL; + } +@@ -16,7 +26,7 @@ public: + + void Add_Button(Uint16 x, Uint16 y, Uint16 width, Uint16 height, + void (*callback)(void)) { +- struct button *belem; ++ button *belem; + + for ( belem=&button_list; belem->next; belem=belem->next ); + belem->next = new button; +@@ -30,7 +40,7 @@ public: + } + + void Activate_Button(Uint16 x, Uint16 y) { +- struct button *belem; ++ button *belem; + + for ( belem=button_list.next; belem; belem=belem->next ) { + if ( (x >= belem->x1) && (x <= belem->x2) && +@@ -42,7 +52,7 @@ public: + } + + void Delete_Buttons(void) { +- struct button *belem, *btemp; ++ button *belem, *btemp; + + for ( belem=button_list.next; belem; ) { + btemp = belem; +@@ -51,14 +61,5 @@ public: + }; + button_list.next = NULL; + } +- +-private: +- typedef struct button { +- /* Sensitive area */ +- Uint16 x1, y1; +- Uint16 x2, y2; +- void (*callback)(void); +- struct button *next; +- } button; +- button button_list; ++ + }; +-- +2.20.1 + diff --git a/recipes-games/maelstrom/maelstrom/0003-Fix-install-dir.patch b/recipes-games/maelstrom/maelstrom/0003-Fix-install-dir.patch new file mode 100644 index 0000000..808da00 --- /dev/null +++ b/recipes-games/maelstrom/maelstrom/0003-Fix-install-dir.patch @@ -0,0 +1,44 @@ +From b051343fcac17227369bc4c7e0b0b00811500e24 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Tue, 12 Feb 2019 15:06:01 +0100 +Subject: [PATCH] Fix install dir +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Configuration] + +Signed-off-by: Andreas Müller +--- + Makefile.am | 2 +- + configure.in | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 4a9e949..a3194fc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -65,7 +65,7 @@ DIST_SUBDIRS = $(SUBDIRS) Images Docs + + # Special install rule for the game + install: +- make install_gamedata target=@GAME_INSTALLDIR@ ++ make install_gamedata target=$(DESTDIR)@GAME_INSTALLDIR@ + + install_gamedata: + sh mkinstalldirs $(target)/ +diff --git a/configure.in b/configure.in +index a6f76ac..e158dd2 100644 +--- a/configure.in ++++ b/configure.in +@@ -105,6 +105,7 @@ case "$target" in + GAME_INSTALLDIR="\$(prefix)/games/$PACKAGE" + ;; + esac ++GAME_INSTALLDIR="\$(datadir)/$PACKAGE" + AC_SUBST(GAME_INSTALLDIR) + CFLAGS="$CFLAGS -DLIBDIR=\\\"$GAME_INSTALLDIR\\\"" + +-- +2.20.1 + diff --git a/recipes-games/maelstrom/maelstrom/0004-Maelstrom-3.0.6-setgid.patch b/recipes-games/maelstrom/maelstrom/0004-Maelstrom-3.0.6-setgid.patch new file mode 100644 index 0000000..9d533b1 --- /dev/null +++ b/recipes-games/maelstrom/maelstrom/0004-Maelstrom-3.0.6-setgid.patch @@ -0,0 +1,201 @@ +From 94ac23023f12b540fb36d2a96a424387cf35339c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Wed, 13 Feb 2019 15:59:36 +0100 +Subject: [PATCH] Rework score file handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Stolen from [1] + +Upstream-Status: Pending + +[1] https://src.fedoraproject.org/cgit/rpms/Maelstrom.git/tree/Maelstrom-3.0.6-setgid.patch + +Signed-off-by: Andreas Müller +--- + main.cpp | 8 +++++ + scores.cpp | 87 ++++++++++++++++++++++++++++++++++-------------------- + scores.h | 1 + + 3 files changed, 64 insertions(+), 32 deletions(-) + +diff --git a/main.cpp b/main.cpp +index 7728c0b..851cf01 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -170,12 +170,20 @@ int main(int argc, char *argv[]) + /* Command line flags */ + int doprinthigh = 0; + int speedtest = 0; ++ gid_t gid; + Uint32 video_flags = SDL_SWSURFACE; + + /* Normal variables */ + SDL_Event event; + LibPath::SetExePath(argv[0]); + ++ GetScoreFile(); ++ gid = getgid(); ++ if (setresgid(-1,gid,gid) != 0) { ++ error("Could not drop privleges. -- Exiting.\n"); ++ exit(1); ++ } ++ + #ifndef __WIN95__ + /* The first thing we do is calculate our checksum */ + (void) checksum(); +diff --git a/scores.cpp b/scores.cpp +index 1633e8f..c8b53b5 100644 +--- a/scores.cpp ++++ b/scores.cpp +@@ -4,6 +4,8 @@ + */ + + #ifdef unix ++#include ++#include + #include + #include + #endif +@@ -15,11 +17,11 @@ + #include "load.h" + #include "dialog.h" + +-#define MAELSTROM_SCORES "Maelstrom-Scores" ++#define MAELSTROM_SCORES "/var/lib/games/Maelstrom-Scores" + #define NUM_SCORES 10 // Do not change this! + + /* Everyone can write to scores file if defined to 0 */ +-#define SCORES_PERMMASK 0 ++#define SCORES_PERMMASK 002 + + #define CLR_DIALOG_WIDTH 281 + #define CLR_DIALOG_HEIGHT 111 +@@ -27,10 +29,31 @@ + Bool gNetScores = 0; + Scores hScores[NUM_SCORES]; + ++int gScoreFile = -1; ++ ++void GetScoreFile(void) ++{ ++#ifdef unix ++ int omask; ++#endif ++ int f; ++ ++#ifdef unix ++ omask=umask(SCORES_PERMMASK); ++#endif ++ f = open(MAELSTROM_SCORES,O_RDWR|O_CREAT); ++ if (f == -1) ++ f = open(MAELSTROM_SCORES,O_RDONLY); ++ if (f == -1) ++ error("Couldn't open score file %s.\n",MAELSTROM_SCORES); ++ gScoreFile = f; ++#ifdef unix ++ umask(omask); ++#endif ++} ++ + void LoadScores(void) + { +- LibPath path; +- SDL_RWops *scores_src; + int i; + + /* Try to load network scores, if we can */ +@@ -44,50 +67,50 @@ void LoadScores(void) + } + memset(&hScores, 0, sizeof(hScores)); + +- scores_src = SDL_RWFromFile(path.Path(MAELSTROM_SCORES), "rb"); +- if ( scores_src != NULL ) { ++ if (gScoreFile != -1) { ++ lseek(gScoreFile,0,SEEK_SET); + for ( i=0; i