Skip to content

Add an install script and desktop file.

orbea requested to merge orbea/yarntown:install into master

As suggested in comment !2 (comment 404194095) here in a posix install.sh script.

What this allows:

  • Generating the data.solarus archive and yarntown executable script.
  • Installing the data.solarus archive and yarntown executable script.
  • Installing the docs, icons and desktop file.
  • Uninstalling all of the above.
  • Out of tree "builds".
  • Absolute and relative paths supported.
  • Cleaning the build directory by removing the data.solarus archive and yarntown executable script.
  • No shellcheck warnings. (https://www.shellcheck.net/)

The supported comands:

  • ./install.sh build
  • ./install.sh clean
  • ./install.sh install
  • ./install.sh install-assets
  • ./install.sh uninstall

I did not want to worry about platform detection so I created separate install and install-assets targets. Platforms that do not want the assets should just not use the latter target.

If ./install.sh install is used and the data.solarus archive or yarntown executable script is missing they will be created as needed.

The install, install-assets and uninstall targets can configure the used paths with the following arguments:

  • PREFIX (Default: /usr/local)
  • BINDIR (Default: PREFIX/bin)
  • DOCDIR (Default: PREFIX/share/doc)
  • MANDIR (Default: PREFIX/share/man)
  • DATAROOTDIR (Default: PREFIX/share)
  • DATADIR (Default: DATAROOTDIR)
  • SYSCONFDIR (Default: PREFIX/etc)
  • DESTDIR (Default: Empty variable)

Even though neither MANDIR or SYSCONFDIR will be used by Solarus games I decided to leave them in to make it easier for any unrelated projects to borrow this script if they so desire.

The main line that would need to be updated in the future is VERSION=1.0.6,

This only depends on a working bourne/posix compatible shell (i.e. dash, bash, mksh, yash, zsh, etc.), getconf, coreutils, findutils and infozip. All except for infozip are covered in the posix spec.

https://pubs.opengroup.org/onlinepubs/9699919799/nframe.html

Here is an example usage:

mkdir -p build
(
  cd build
  ../install.sh install \
    PREFIX=/usr \
    BINDIR=games \
    DATADIR=share/games \
    DESTDIR="$PKG"

  ../install.sh install-assets \
    PREFIX=/usr \
    DOCDIR=doc \
    DESTDIR="$PKG"
)

Which installs these files.

usr/
usr/doc/
usr/doc/yarntown-1.0.6/
usr/doc/yarntown-1.0.6/credits.txt
usr/doc/yarntown-1.0.6/readme.md
usr/games/
usr/games/yarntown
usr/share/
usr/share/applications/
usr/share/applications/yarntown.desktop
usr/share/games/
usr/share/games/solarus/
usr/share/games/solarus/yarntown/
usr/share/games/solarus/yarntown/data.solarus
usr/share/icons/
usr/share/icons/hicolor/
usr/share/icons/hicolor/1024x1024/
usr/share/icons/hicolor/1024x1024/apps/
usr/share/icons/hicolor/1024x1024/apps/yarntown.png
usr/share/icons/hicolor/128x128/
usr/share/icons/hicolor/128x128/apps/
usr/share/icons/hicolor/128x128/apps/yarntown.png
usr/share/icons/hicolor/16x16/
usr/share/icons/hicolor/16x16/apps/
usr/share/icons/hicolor/16x16/apps/yarntown.png
usr/share/icons/hicolor/256x256/
usr/share/icons/hicolor/256x256/apps/
usr/share/icons/hicolor/256x256/apps/yarntown.png
usr/share/icons/hicolor/32x32/
usr/share/icons/hicolor/32x32/apps/
usr/share/icons/hicolor/32x32/apps/yarntown.png
usr/share/icons/hicolor/512x512/
usr/share/icons/hicolor/512x512/apps/
usr/share/icons/hicolor/512x512/apps/yarntown.png
usr/share/icons/hicolor/64x64/
usr/share/icons/hicolor/64x64/apps/
usr/share/icons/hicolor/64x64/apps/yarntown.png
usr/share/pixmaps/
usr/share/pixmaps/yarntown.png
Edited by orbea

Merge request reports