From 22b2b9098d94f7341cb3f1dcfaa411bd8e693dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 12 Feb 2019 19:52:29 +0100 Subject: [PATCH] maelstrom: initial add 3.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Heavily inspired by [1] [1] https://src.fedoraproject.org/cgit/rpms/Maelstrom.git/tree/ Signed-off-by: Andreas Müller --- .../0001-Use-pkg-config-to-find-sdl.patch | 34 +++ ...onlist.h-Fix-build-with-recent-gcc-s.patch | 87 ++++++++ .../maelstrom/0003-Fix-install-dir.patch | 44 ++++ .../0004-Maelstrom-3.0.6-setgid.patch | 201 ++++++++++++++++++ .../maelstrom/maelstrom/Maelstrom.desktop | 9 + .../maelstrom/maelstrom/maelstrom.png | Bin 0 -> 1290 bytes recipes-games/maelstrom/maelstrom_3.0.6.bb | 43 ++++ 7 files changed, 418 insertions(+) create mode 100644 recipes-games/maelstrom/maelstrom/0001-Use-pkg-config-to-find-sdl.patch create mode 100644 recipes-games/maelstrom/maelstrom/0002-buttonlist.h-Fix-build-with-recent-gcc-s.patch create mode 100644 recipes-games/maelstrom/maelstrom/0003-Fix-install-dir.patch create mode 100644 recipes-games/maelstrom/maelstrom/0004-Maelstrom-3.0.6-setgid.patch create mode 100644 recipes-games/maelstrom/maelstrom/Maelstrom.desktop create mode 100644 recipes-games/maelstrom/maelstrom/maelstrom.png create mode 100644 recipes-games/maelstrom/maelstrom_3.0.6.bb 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; irKP1YT3RtVIT#QSDN<5P2PQV19rQd(L$F)^H+oH0sD7$G4_Qc^J~DMD*&l$4YyLPB$dghEP6DIp<@ zjEsbYgj#!hIcsYW7#LbwS~*HeF=JzEdwWt+Qc7!UAs84jLP7ut2z!KtN=iyXV`G$z zj6y;}jD&<3IXM^@7%5s>T61$LIXO9FV-OG!AyQIvdwU2eDOyrey}i9TLP7`#2y1h5 zQc6m-wY5rPV}yHq;JUST000BANkllu#@wR2hqX_6g- z^T1+{ z2r;;zV5mC!=%-5|0wSD_K$Pre>vAB;o4yYq!t*@?5&G!)#b&qEMXmzpA^v`LI0@2+ zG!IC`J^klH{@w3rTSCGZ!MkmIyniU^>3x8fGHMm5tVk8!DYT*jM@;lxU=R+XhWV6| zq$))SKwQm&kc;!*bW9p_N{VrX=l%N;PBMEw7E)mvZD;m(|9NMHx7MMLY15cNWm(AOPTKZJNH)(u8YODqh{m~; ziK0&586|1j?V3r9AgLe3f7iAdpd>XZo_E03)CDwCH8|3C<|;M;W`o0bFE8FQ>m)H8 zGhze2)MOBNl88v6CRu(w>A&a!I zUq1jE)-JAC#CL0Vd9hPAA6e{czdEe_aPx#07*qoM6N<$f+p-N Az5oCK literal 0 HcmV?d00001 diff --git a/recipes-games/maelstrom/maelstrom_3.0.6.bb b/recipes-games/maelstrom/maelstrom_3.0.6.bb new file mode 100644 index 0000000..4f2dbc1 --- /dev/null +++ b/recipes-games/maelstrom/maelstrom_3.0.6.bb @@ -0,0 +1,43 @@ +SUMMARY = "Maelstrom is a GPL'd port of the shareware game for the Macintosh" +LICENSE = "GPLv2 & CC-BY-3.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=0642955deaee2fa53c36bc592dc1ef25" +HOMEPAGE = "https://www.libsdl.org/projects/Maelstrom/" + +inherit autotools-brokensep pkgconfig gettext gtk-icon-cache + +DEPENDS += " \ + libsdl-net \ +" + +SRC_URI = " \ + https://www.libsdl.org/projects/Maelstrom/src/Maelstrom-${PV}.tar.gz \ + file://0001-Use-pkg-config-to-find-sdl.patch \ + file://0002-buttonlist.h-Fix-build-with-recent-gcc-s.patch \ + file://0003-Fix-install-dir.patch \ + file://0004-Maelstrom-3.0.6-setgid.patch \ + file://maelstrom.png \ + file://Maelstrom.desktop \ +" +SRC_URI[md5sum] = "96aa6359538a6bd60b4198a792de578b" +SRC_URI[sha256sum] = "e7983c2c7376cdcca1944db1706d92aedd529638cf13358c88a60df982ba7b46" + +S = "${WORKDIR}/Maelstrom-${PV}" + +do_configure_prepend() { + touch ${S}/NEWS ${S}/AUTHORS ${S}/ChangeLog +} + +do_install() { + oe_runmake DESTDIR=${D} install install-am + + install -d ${D}/${datadir}/applications + install -m 644 ${WORKDIR}/Maelstrom.desktop ${D}/${datadir}/applications + + install -d ${D}/${datadir}/icons/hicolor/48x48/apps + install -m 644 ${WORKDIR}/maelstrom.png ${D}/${datadir}/icons/hicolor/48x48/apps + + install -d ${D}/${localstatedir}/lib/games + mv ${D}${datadir}/Maelstrom/*Scores ${D}/${localstatedir}/lib/games +} + +FILES_${PN} += "${datadir}/Maelstrom"