From d5744345d6f32d31882acdc5dc0641d202f7cad6 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 31 Mar 2019 18:13:35 -0400 Subject: add makefile and other package-ready elements This adds open-source-licensed files that will help package builders build this application for distros. --- .gitignore | 1 + LICENSES.txt | 1 + Makefile | 74 ++++++++++++++++++++++++++++++++++++++++++++++ beyond-the-titanic | 39 ++++++++++++++++++++++++ beyond-the-titanic.desktop | 12 ++++++++ ship.svg | 38 ++++++++++++++++++++++++ 6 files changed, 165 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSES.txt create mode 100644 Makefile create mode 100644 beyond-the-titanic create mode 100644 beyond-the-titanic.desktop create mode 100644 ship.svg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/LICENSES.txt b/LICENSES.txt new file mode 100644 index 0000000..91c34fd --- /dev/null +++ b/LICENSES.txt @@ -0,0 +1 @@ +Ship icon licensed as linkware from http://www.iconarchive.com/download/i103129/unclebob/spanish-travel/ship.svg. http://www.iconarchive.com/show/spanish-travel-icons-by-unclebob/ship-icon.html. Please check out the author's site at http://www.malagatravelguide.net. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b6c360 --- /dev/null +++ b/Makefile @@ -0,0 +1,74 @@ +# File: Makefile for Beyond the Titanic +# Location: +# Author: bgstack15 +# Startdate: 2019-03-31 +# Title: Makefile for Beyond the Titanic source package +# Purpose: To use traditional Unix make utility +# History: +# Usage: +# Reference: +# bgscripts Makefile, move-to-next-monitor Makefile +# Improve: +# Document: +# Dependencies: +# Free Pascal compiler: fpc + +APPNAME = beyond-the-titanic +APPVERSION = 0.0.1 +PKGDIR = $(CURDIR) +SRCDIR = $(CURDIR)/src +prefix = /usr +BINDIR = $(DESTDIR)$(prefix)/bin +SHAREDIR = $(DESTDIR)$(prefix)/share +APPDIR = $(SHAREDIR)/$(APPNAME) +APPSDIR = $(SHAREDIR)/applications +DOCDIR = $(SHAREDIR)/doc/$(APPNAME) +LICENSEDIR = $(SHAREDIR)/licenses/$(APPNAME) + +awkbin :=$(shell which awk) +cpbin :=$(shell which cp) +echobin :=$(shell which echo) +findbin :=$(shell which find) +fpcbin :=$(shell which fpc) +grepbin :=$(shell which grep) +installbin :=$(shell which install) +rmbin :=$(shell which rm) +sedbin :=$(shell which sed) +sortbin :=$(shell which sort) +truebin :=$(shell which true) + +all: + ${fpcbin} $(SRCDIR)/BEYOND.PAS + +.PHONY: clean install install_files uninstall list + +list: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | ${awkbin} -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | ${sortbin} | ${grepbin} -E -v -e '^[^[:alnum:]]' -e '^$@$$' + +install: install_files install_docs + +install_files: + ${echobin} Installing files to ${DESTDIR} + ${installbin} -d ${BINDIR} ${APPDIR} ${APPSDIR} + ls -l ${SRCDIR} + for word in $$( ${findbin} ${SRCDIR} ! -type d ! -name '*.*' -print ) ; do ${installbin} -m0644 $${word} ${APPDIR} ; done + ${installbin} -m '0755' ${SRCDIR}/BEYOND ${APPDIR}/ + ${installbin} -m '0755' ${PKGDIR}/${APPNAME} ${BINDIR}/ + ${installbin} -m '0644' ${PKGDIR}/${APPNAME}.desktop ${APPSDIR}/ + +install_docs: + ${echobin} Installing docs to ${DOCDIR} + ${installbin} -d ${DOCDIR} ${LICENSEDIR} + ${cpbin} -pr ${PKGDIR}/History/* ${PKGDIR}/INSTRUCT.TXT ${DOCDIR} + ${installbin} -m '0644' -t ${LICENSEDIR} ${PKGDIR}/*gpl*.txt ${PKGDIR}/LICENSES.txt + +uninstall: + ${echobin} SRCDIR=${SRCDIR} + ${rmbin} -rf ${APPDIR}/* ${DOCDIR}/* ${LICENSEDIR}/* ${APPSDIR}/${APPNAME}.desktop ${BINDIR}/${APPNAME} + + # remove all installed directories that are now blank. + for word in $$( ${findbin} ${DESTDIR} -mindepth 1 -type d -printf '%p\n' | ${awkbin} '{print length, $$0 }' | ${sortbin} -rn | ${awkbin} '{print $$2}' ) ; do ${findbin} $${word} -mindepth 1 1>/dev/null 2>&1 | read 1>/dev/null 2>&1 || { rmdir "$${word}" 2>/dev/null || ${truebin} ; } ; done + +clean: +#${echobin} "target $@ not implemented yet! Gotta say unh." + ${rmbin} -f ${SRCDIR}/BEYOND ${SRCDIR}/BEYOND.o diff --git a/beyond-the-titanic b/beyond-the-titanic new file mode 100644 index 0000000..6a1ce22 --- /dev/null +++ b/beyond-the-titanic @@ -0,0 +1,39 @@ +#!/bin/sh +# File: /usr/bin/beyond-the-titanic +# Author: bgstack15 +# Startdate: 2019-03-31 17:55 +# Title: Beyond the Titanic +# Package; +# Purpose: Runs BEYOND from the correct location +# History: +# Usage: Normally called by /usr/share/applications/beyond-the-titanic.desktop +# Reference: +# https://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash +# Improve: +# Documentation: +# Dependencies: +# file /etc/default/beyond-the-titanic +# tput + +# load variables from defaults file +test -r "/etc/default/beyond-the-titanic" && . /etc/default/beyond-the-titanic 1>/dev/null 2>&1 +test -z "${BEYOND_DIR}" && BEYOND_DIR=/usr/share/beyond-the-titanic + +# warn about screen size if not correct +if test -z "${BEYOND_SILENT}" ; +then + ___cols="$( tput cols 2>/dev/null )" + ___lines="$( tput lines 2>/dev/null )" + if "${___cols}" != "80" || "${___lines}" != "24" ; + then + printf "The game recommends using a terminal size of exactly 80 columns by 24 lines. Set BEYOND_SILENT=1 to suppress this message.\nPress enter to continue. " + read ___foo ; + fi +fi + +# start game +cd "${BEYOND_DIR}" +./BEYOND + +# return terminal text to normal style +tput sgr0 diff --git a/beyond-the-titanic.desktop b/beyond-the-titanic.desktop new file mode 100644 index 0000000..a7f585e --- /dev/null +++ b/beyond-the-titanic.desktop @@ -0,0 +1,12 @@ +#!/usr/bin/xdg-open +[Desktop Entry] +Name=Beyond the Titanic +Exec=/usr/bin/beyond-the-titanic +Type=Application +StartupNotify=true +Path=/usr/share/beyond-the-titanic +Icon=beyond-the-titanic +StartupWMClass=BEYOND +Comment=Text adventure game from 1988 +Terminal=true +Categories=Game;AdventureGame; diff --git a/ship.svg b/ship.svg new file mode 100644 index 0000000..aa9cc00 --- /dev/null +++ b/ship.svg @@ -0,0 +1,38 @@ + + + + + + + + + + -- cgit