From d335e5562c3b2d405a1b7c1b116a0f2333cd9389 Mon Sep 17 00:00:00 2001 From: orbea Date: Fri, 28 Aug 2020 09:45:43 -0700 Subject: [PATCH 1/4] Add a desktop file. --- yarntown.desktop | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 yarntown.desktop diff --git a/yarntown.desktop b/yarntown.desktop new file mode 100644 index 0000000..c2827d6 --- /dev/null +++ b/yarntown.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Yarntown +GenericName=Yarntown game for the Solarus engine +Comment=Yarntown (2D hommage to Bloodborne) +Exec=yarntown +Terminal=false +Type=Application +Icon=yarntown +Categories=Game;AdventureGame; -- GitLab From 959930c05781c13971945a81698a55e341771f06 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 29 Aug 2020 13:47:39 -0700 Subject: [PATCH 2/4] Add a .gitignore. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b37f35a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.solarus +yarntown -- GitLab From ee5635b327b883486051d92be381a5202f0774ac Mon Sep 17 00:00:00 2001 From: orbea Date: Tue, 1 Sep 2020 07:00:47 -0700 Subject: [PATCH 3/4] Add the quest version to quest.dat. --- data/quest.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/quest.dat b/data/quest.dat index f97b633..bf7ff4c 100644 --- a/data/quest.dat +++ b/data/quest.dat @@ -6,7 +6,7 @@ quest{ long_description = [[ ]], author = "Max Mraz", - quest_version = "", + quest_version = "1.0.6", release_date = "", website = "", normal_quest_size = "416x240", -- GitLab From 9bf2149bd137d14940ca451b1976f26f15b650d3 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 29 Aug 2020 11:24:27 -0700 Subject: [PATCH 4/4] Add a install.sh posix script. --- INSTALL | 68 ++++++++++++++++ install.sh | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 293 insertions(+) create mode 100644 INSTALL create mode 100755 install.sh diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..cc12b3d --- /dev/null +++ b/INSTALL @@ -0,0 +1,68 @@ +install.sh is a POSIX sh script known to work with the following shells: + + ash + dash + bash + ksh + loksh + mksh + pdksh + posh (0.14.1 or newer) + oksh + yash + zsh + +install.sh accepts the following arguments as targets: + +build - Generates the solarus.data archive and the executable script. +clean - Removes the solarus.data archive and the executable script. +install - Installs the solarus.data archive and executable script. +install-assets - Installs the docs, icons and desktop file. +uninstall - Uninstalls all installed files. + +The build, clean and install targets can customize the name of the data +archive. + + DATANAME - Name of the solarus data archive (data.solarus) + +Additionally the following arguments can be passed to the install +and uninstall targets to configure the install paths. + + PREFIX - Install path prefix (/usr/local) + BINDIR - Binary install directory (PREFIX/bin) + DOCDIR - Documentation install directory (PREFIX/share/doc) + MANDIR - Manpage install directory (PREFIX/share/man) + DATADIR - Read-only data install directory (DATAROOTDIR) + DATAROOTDIR - Read-only data root install directory (PREFIX/share) + SYSCONFDIR - Read-only data install directory (PREFIX/etc) + +The configurable install directories can be either absolute or relative +paths. If they are set as relative paths the value of PREFIX will be +prepended to the install directory. For example if MANDIR is set to +'man' man pages will be installed to '/usr/local/man/' instead of +'/usr/local/share/man/'. + +By design install.sh will not use any set environment variables and all +configuration must be passed explicitly as arguments. + +EXAMPLES + + ./install.sh install PREFIX=/usr DESTDIR=/tmp + + Installs to '/tmp/usr/'. + + ./install.sh uninstall PREFIX=/usr DESTDIR=/tmp + + Uninstalls from '/tmp/usr/'. + + ./install.sh install DOCDIR=/usr/local/doc + + Installs documentation to '/usr/local/doc/$PRGNAM-$VERSION'. + + ./install.sh install MANDIR=man + + Installs man pages to '$PREFIX/man/man1/'. + + ./install.sh install SYSCONFDIR=/etc + + Installs read-only data to '/etc/'. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..9cc10da --- /dev/null +++ b/install.sh @@ -0,0 +1,225 @@ +#!/bin/sh +# Install script for yarntown. + +# Copyright 2017-2020 orbea +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# IFS is +IFS=' +' +\unset -f command printf unalias : 2>/dev/null +\unalias -a 2>/dev/null +PATH="$(command -p getconf PATH):$PATH" +LC_ALL=C; export LC_ALL + +set -euf + +die () { + ret="$1"; shift + case "$ret" in + : ) printf %s\\n "$@" >&2; return 0 ;; + 0 ) printf %s\\n "$@" ;; + * ) printf %s\\n "$@" >&2 ;; + esac + exit "$ret" +} + +case "${1:-}" in + install-assets ) INSTALL=4 ;; + clean ) INSTALL=3 ;; + build ) INSTALL=2 ;; + install ) INSTALL=1 ;; + uninstall ) INSTALL=0 ;; + '' ) die 1 'No install target.' ;; + * ) die 1 "No rule to install target '$1'." ;; +esac + +cmd () { + print= + for command do + case "$command" in + -- ) : ;; + */* ) print="${print} '$command'" ;; + * ) print="${print} $command" ;; + esac + done + printf " %s\\n" "$print" + command -p "$@" +} + +is_absolute () { case "$1" in /*) return 0 ;; *) return 1 ;; esac; } + +PREFIX=; BINDIR=; DATADIR=; DATANAME=; DATAROOTDIR=; DOCDIR=; MANDIR= +SYSCONFDIR=; DESTDIR= + +CWD="$(pwd)" + +if [ "$0" != "${0%/*}" ]; then + SOURCE_DIR="$(cd -- "${0%/*}/" && pwd -P)" +else + SOURCE_DIR="$(pwd -P)" +fi + +quest_version="$(grep quest_version "$SOURCE_DIR"/data/quest.dat)" +quest_version="${quest_version%\"*}" + +PRGNAM=yarntown +VERSION="${quest_version#*\"}" + +shift + +install_args= + +while [ $# -gt 0 ]; do + arg="$1"; shift + case "${arg%%=*}" in + DATANAME|DESTDIR|PREFIX ) + eval "${arg%%=*}=\"\${arg#*=}\"" + ;; + BINDIR|DATADIR|DATAROOTDIR|DOCDIR|MANDIR|SYSCONFDIR ) + install_args=1 + eval "${arg%%=*}=\"\${arg#*=}\"" + ;; + * ) + die : "WARNING: Variable '${arg%%=*}' was not used by $PRGNAM." + ;; + esac +done + +PREFIX="${PREFIX:-/usr/local}" +BINDIR="${BINDIR:-${PREFIX}/bin}" +DOCDIR="${DOCDIR:-${PREFIX}/share/doc}/$PRGNAM-$VERSION" +MANDIR="${MANDIR:-${PREFIX}/share/man}" +DATANAME="${DATANAME:-data.solarus}" +DATAROOTDIR="${DATAROOTDIR:-${PREFIX}/share}" +DATADIR="${DATADIR:-${DATAROOTDIR}}/solarus/$PRGNAM" +SYSCONFDIR="${SYSCONFDIR:-${PREFIX}/etc}" +DESTDIR="${DESTDIR:-}" + +is_absolute "$PREFIX" || PREFIX="$CWD/$PREFIX" + +if [ -n "$install_args" ]; then + for i in \$BINDIR \$DATADIR \$DATAROOTDIR \$DOCDIR \$MANDIR \$SYSCONFDIR; do + eval "dest=\"$i\"" + is_absolute "${dest:?}" || eval "${i#*$}=\"\${PREFIX}/$i\"" + done +fi + +#################### +### Project Code ### +#################### + +build_bin () { + command -p rm -f -- "$CWD/$PRGNAM" + printf 'Generating %s script...\n' "$PRGNAM" + printf '#!/bin/sh\nsolarus-run %s "$@"\n' "$DATADIR" > "$CWD/$PRGNAM" +} + +build_data () { + command -p rm -f -- "$CWD/$DATANAME" + printf 'Generating %s...\n' "$DATANAME" + ( + cd -- "${SOURCE_DIR}"/data/ + command -p find . -type f \( \ + -name '*.spc' -o \ + -name '*.ogg' -o \ + -name '*.it' -o \ + -name '*.png' -o \ + -name '*.dat' -o \ + -name '*.lua' -o \ + -name '*.ttf' -o \ + -name '*.ttc' -o \ + -name '*.fon' -o \ + -name '*.glsl' \ + \) -exec zip -9 -q "$CWD/$DATANAME" {} + + ) +} + +icon_sizes='16 32 64 128 256 512 1024' + +case $INSTALL in + # install-assets + 4 ) + printf 'Installing assets...\n' + cmd mkdir -p -- "${DESTDIR}${DATAROOTDIR}/applications" + cmd mkdir -p -- "${DESTDIR}${DATAROOTDIR}/pixmaps" + cmd mkdir -p -- "${DESTDIR}${DOCDIR}" + cmd rm -f -- "${DESTDIR}${DOCDIR}/credits.txt" + cmd cp -- "${SOURCE_DIR}/credits.txt" "${DESTDIR}${DOCDIR}" + cmd rm -f -- "${DESTDIR}${DOCDIR}/readme.md" + cmd cp -- "${SOURCE_DIR}/readme.md" "${DESTDIR}${DOCDIR}" + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/applications/$PRGNAM.desktop" + cmd cp -- "${SOURCE_DIR}/$PRGNAM.desktop" \ + "${DESTDIR}${DATAROOTDIR}/applications" + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png" + cmd cp -- "${SOURCE_DIR}/data/logos/logo.png" \ + "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png" + + eval "set -- $icon_sizes" + for icon do + icon_dir="${DESTDIR}${DATAROOTDIR}/icons/hicolor/${icon}x${icon}/apps" + cmd mkdir -p -- "$icon_dir" + cmd rm -f -- "$icon_dir/$PRGNAM.png" + cmd cp -- "${SOURCE_DIR}/medias/icon/icon_$icon.png" \ + "$icon_dir/$PRGNAM.png" + done + ;; + # clean + 3 ) + printf 'Removing %s...\n' "$DATANAME" + cmd rm -f -- "$CWD/$DATANAME" + cmd rm -f -- "$CWD/$PRGNAM" + ;; + # build + 2 ) + build_data + build_bin + ;; + # install + 1 ) + [ -f "$CWD/$DATANAME" ] || build_data + [ -f "$CWD/$PRGNAM" ] || build_bin + printf 'Installing...\n' + cmd mkdir -p -- "${DESTDIR}${BINDIR}" + cmd mkdir -p -- "${DESTDIR}${DATADIR}" + cmd rm -f -- "${DESTDIR}${BINDIR}/$PRGNAM" + cmd cp -- "$CWD/$PRGNAM" "${DESTDIR}${BINDIR}" + cmd rm -f -- "${DESTDIR}${DATADIR}/$DATANAME" + cmd cp -- "$CWD/$DATANAME" "${DESTDIR}${DATADIR}" + cmd chmod 0755 -- "${DESTDIR}${BINDIR}/$PRGNAM" + ;; + # uninstall + 0 ) + printf 'Uninstalling...\n' + cmd rm -rf -- "${DESTDIR}${DOCDIR}" + cmd rm -rf -- "${DESTDIR}${DATADIR}" + cmd rm -f -- "${DESTDIR}${BINDIR}/$PRGNAM" + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/applications/$PRGNAM.desktop" + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png" + + eval "set -- $icon_sizes" + for icon do + icon_dir="${DESTDIR}${DATAROOTDIR}/icons/hicolor/${icon}x${icon}/apps" + cmd rm -f -- "$icon_dir/$PRGNAM.png" + done + ;; +esac + +exit 0 -- GitLab