From: Oliver Schmidhauser Date: Thu, 27 Jul 2017 14:50:10 +0000 (+0200) Subject: Add moria package X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/commitdiff_plain/a793fe641e4a3085523c3e5be5136917f34d37b7 Add moria package As requested in #533 (fixes #533). --- diff --git a/packages/moria/build.sh b/packages/moria/build.sh new file mode 100644 index 00000000..cf351409 --- /dev/null +++ b/packages/moria/build.sh @@ -0,0 +1,24 @@ +TERMUX_PKG_HOMEPAGE=http://remarque.org/~grabiner/moria.html +TERMUX_PKG_DESCRIPTION="http://remarque.org/~grabiner/moria.html" +TERMUX_PKG_VERSION=5.6 +TERMUX_PKG_MAINTAINER="Oliver Schmidhauser @Neo-Oli" +# This seems to be a pretty good mirror +TERMUX_PKG_SRCURL=https://github.com/HunterZ/umoria/archive/${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=1ee52ec001539945139b2960e8441f490d2b7f5fe6dce5a070686a178515d182 +TERMUX_PKG_FOLDERNAME=umoria-$TERMUX_PKG_VERSION +TERMUX_PKG_DEPENDS="ncurses" +TERMUX_PKG_BUILD_IN_SRC=yes + +termux_step_pre_configure() { + ln -s $TERMUX_PKG_SRCDIR/source/* $TERMUX_PKG_SRCDIR/ + ln -s $TERMUX_PKG_SRCDIR/unix/* $TERMUX_PKG_SRCDIR/ + mkdir -p $TERMUX_PREFIX/share/man/man6/ + cp $TERMUX_PKG_SRCDIR/doc/moria.man $TERMUX_PREFIX/share/man/man6/moria.6 +} +termux_step_create_debscripts () { + # Create scores file in a debscript, so an update to the package wouldn't erease any scores + echo "mkdir -p $TERMUX_PREFIX/var/games/moria/" > postinst + echo "touch $TERMUX_PREFIX/var/games/moria/scores" >> postinst + chmod 0755 postinst + +} diff --git a/packages/moria/source-config.h.patch b/packages/moria/source-config.h.patch new file mode 100644 index 00000000..e7a2889c --- /dev/null +++ b/packages/moria/source-config.h.patch @@ -0,0 +1,45 @@ +diff --git a/source/config.h b/source/config.h +index bd64c8f..b0b7911 100644 +--- a/source/config.h ++++ b/source/config.h +@@ -41,7 +41,7 @@ some of the system defines set up here. + + /* If compiling on Debian (also works on other versions of Linux), + define this. */ +-#define DEBIAN_LINUX ++//#define DEBIAN_LINUX + + /* If you are compiling on an ultrix/4.2BSD/Dynix/etc. version of UNIX, + define this. It is not needed for SUNs. */ +@@ -221,20 +221,20 @@ some of the system defines set up here. + + #else + +-#if 0 ++#if 1 + /* Debian standards for file location */ + /* This must be unix; change file names as appropriate. */ + #define MORIA_SAV ".moria-save" +-#define MORIA_HOU "/etc/moria-hours" +-#define MORIA_MOR "/usr/lib/games/moria/news" +-#define MORIA_GPL "/usr/lib/games/moria/COPYING" +-#define MORIA_TOP "/var/games/moria/scores" +-#define MORIA_HELP "/usr/lib/games/moria/roglcmds.hlp" +-#define MORIA_ORIG_HELP "/usr/lib/games/moria/origcmds.hlp" +-#define MORIA_WIZ_HELP "/usr/lib/games/moria/rwizcmds.hlp" +-#define MORIA_OWIZ_HELP "/usr/lib/games/moria/owizcmds.hlp" +-#define MORIA_WELCOME "/usr/lib/games/moria/welcome.hlp" +-#define MORIA_VER "/usr/lib/games/moria/version.hlp" ++#define MORIA_HOU "@TERMUX_PREFIX@/etc/moria-hours" ++#define MORIA_MOR "@TERMUX_PREFIX@/lib/games/moria/news" ++#define MORIA_GPL "@TERMUX_PREFIX@lib/games/moria/COPYING" ++#define MORIA_TOP "@TERMUX_PREFIX@/var/games/moria/scores" ++#define MORIA_HELP "@TERMUX_PREFIX@/lib/games/moria/roglcmds.hlp" ++#define MORIA_ORIG_HELP "@TERMUX_PREFIX@/lib/games/moria/origcmds.hlp" ++#define MORIA_WIZ_HELP "@TERMUX_PREFIX@/lib/games/moria/rwizcmds.hlp" ++#define MORIA_OWIZ_HELP "@TERMUX_PREFIX@/lib/games/moria/owizcmds.hlp" ++#define MORIA_WELCOME "@TERMUX_PREFIX@/lib/games/moria/welcome.hlp" ++#define MORIA_VER "@TERMUX_PREFIX@/lib/games/moria/version.hlp" + + #else + diff --git a/packages/moria/source-death.c.patch b/packages/moria/source-death.c.patch new file mode 100644 index 00000000..ee2d9f0b --- /dev/null +++ b/packages/moria/source-death.c.patch @@ -0,0 +1,16 @@ +diff --git a/source/death.c b/source/death.c +index 87102eb..e5c951b 100644 +--- a/source/death.c ++++ b/source/death.c +@@ -214,9 +214,9 @@ int f, l; + sbuf.st_ino); + #else + #ifdef __linux__ +- (void) sprintf (lockname, "/tmp/moria.%ld", sbuf.st_ino); ++ (void) sprintf (lockname, "@TERMUX_PREFIX@/tmp/moria.%ld", sbuf.st_ino); + #else +- (void) sprintf (lockname, "/tmp/moria.%d", sbuf.st_ino); ++ (void) sprintf (lockname, "@TERMUX_PREFIX@/tmp/moria.%d", sbuf.st_ino); + #endif + #endif + if (l & LOCK_UN) diff --git a/packages/moria/source-signals.c.patch b/packages/moria/source-signals.c.patch new file mode 100644 index 00000000..41b351d8 --- /dev/null +++ b/packages/moria/source-signals.c.patch @@ -0,0 +1,22 @@ +diff --git a/source/signals.c b/source/signals.c +index 0deddde..4124b2e 100644 +--- a/source/signals.c ++++ b/source/signals.c +@@ -136,7 +136,7 @@ int sig; + { + if(++signal_count > 10) /* Be safe. We will die if persistent enough. */ + (void) MSIGNAL(sig, SIG_DFL); +- return; ++ return 0; + } + error_sig = sig; + +@@ -167,7 +167,7 @@ int sig; + if (wait_for_more) + put_buffer(" -more-", MSG_LINE, 0); + put_qio(); +- return; /* OK. We don't quit. */ ++ return 0; /* OK. We don't quit. */ + } + (void) strcpy(died_from, "Interrupting"); + } diff --git a/packages/moria/unix-Makefile.patch b/packages/moria/unix-Makefile.patch new file mode 100644 index 00000000..abfa1c23 --- /dev/null +++ b/packages/moria/unix-Makefile.patch @@ -0,0 +1,85 @@ +diff --git a/unix/Makefile b/unix/Makefile +index e65338f..e169edf 100644 +--- a/unix/Makefile ++++ b/unix/Makefile +@@ -1,5 +1,5 @@ + # Edited for Debian GNU/Linux. +-DESTDIR = ++DESTDIR = @TERMUX_PREFIX@ + + # DEBIAN NOTE: This file diverges significantly from the original Makefile + # for obvious reasons. The original Makefile is Makefile.unix and should +@@ -16,9 +16,9 @@ DESTDIR = + # Edited for Debian GNU/Linux: LIBVARDIR is where the score file is kept + # OWNER is who you want the game to be chown to. + # GROUP is who you wnat the game to be chgrp to. +-BINDIR = $(DESTDIR)/usr/games ++BINDIR = $(DESTDIR)/bin + ETCDIR = $(DESTDIR)/etc +-LIBSTATICDIR = $(DESTDIR)/usr/lib/games/moria ++LIBSTATICDIR = $(DESTDIR)/lib/games/moria + LIBVARDIR = $(DESTDIR)/var/games/moria + OWNER = root + GROUP = games +@@ -26,7 +26,7 @@ GROUP = games + # For testing and debugging the program, it is best to use this line. + # CFLAGS = -g + # For playing the game, you may want to use this line +-CFLAGS = -O2 ++CFLAGS += -O2 + + # Debian GNU/Linux addition + ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) +@@ -36,7 +36,7 @@ endif + # For BSD Systems + # CURSES = -lcurses -ltermcap + # For SYS V Systems +-CURSES = -lcurses ++CURSES = -lncurses + # For XENIX, some XENIX systems may need -ltinfo + # CURSES = -ltcap -ltermcap -lx + +@@ -44,9 +44,9 @@ CURSES = -lcurses + # config.h if you use this. + #LFLAGS = -lbsd + # Normal systems don't require anything here. +-LFLAGS = ++LFLAGS ?= + +-CC = cc ++CC ?= cc + + SRCS = main.c misc1.c misc2.c misc3.c misc4.c store1.c files.c io.c \ + create.c desc.c generate.c sets.c dungeon.c creature.c death.c \ +@@ -66,7 +66,7 @@ LIBSTATICFILES = news origcmds.hlp owizcmds.hlp roglcmds.hlp rwizcmds.hlp \ + version.hlp welcome.hlp + + moria : $(OBJS) +- $(CC) -o moria $(CFLAGS) $(OBJS) $(CURSES) $(LFLAGS) ++ $(CC) -o moria $(CFLAGS) $(LDFLAGS) $(OBJS) $(CURSES) $(LFLAGS) + + lintout : $(SRCS) + lint $(SRCS) $(CURSES) > lintout +@@ -80,21 +80,16 @@ TAGS : $(SRCS) + # you must define BINDIR and LIBDIR before installing + # assumes that BINDIR and LIBDIR exist + install: +- chmod 755 $(BINDIR) + cp moria $(BINDIR) +- chown $(OWNER) $(BINDIR)/moria +- chgrp $(GROUP) $(BINDIR)/moria + chmod 2755 $(BINDIR)/moria ++ mkdir -p $(LIBSTATICDIR) + chmod 755 $(LIBSTATICDIR) + # No longer chmod 755 $(LIBVARDIR) + (cd files; cp $(LIBSTATICFILES) $(LIBSTATICDIR)) +- (cd $(LIBSTATICDIR); chmod 444 $(LIBSTATICFILES)) + # No longer (cd $(LIBVARDIR); touch scores; chmod 664 scores) + # No longer (cd $(LIBVARDIR); chown $(OWNER) . scores; chgrp $(GROUP) . scores) + (cd files; cp hours $(ETCDIR)/moria-hours) + chmod 644 $(ETCDIR)/moria-hours +- (cd $(LIBSTATICDIR); chown $(OWNER) $(LIBSTATICFILES)) +- (cd $(LIBSTATICDIR); chgrp $(GROUP) $(LIBSTATICFILES)) + # If you are short on disk space, or aren't interested in debugging moria. + # This is handled by dh_strip, so let's not override its' decision. + # strip $(BINDIR)/moria diff --git a/packages/moria/unix-unix.c.patch b/packages/moria/unix-unix.c.patch new file mode 100644 index 00000000..7ad92302 --- /dev/null +++ b/packages/moria/unix-unix.c.patch @@ -0,0 +1,24 @@ +diff --git a/unix/unix.c b/unix/unix.c +index 81d543c..af4a672 100644 +--- a/unix/unix.c ++++ b/unix/unix.c +@@ -271,19 +271,6 @@ char *p; + } + #endif + +-#ifndef DEBIAN_LINUX +-#ifdef USG +-unsigned short getuid(); +-#else +-#ifndef SECURE +-#ifdef BSD4_3 +-uid_t getuid(); +-#else /* other BSD versions */ +-int getuid(); +-#endif +-#endif +-#endif +-#endif + + /* Find a default user name from the system. */ + void user_name(buf)