From 046654680962704eed54aaac5f08a6afe57f92e7 Mon Sep 17 00:00:00 2001 From: Robert Stancil Date: Fri, 29 Mar 2019 01:23:30 +0800 Subject: [PATCH] New Package: dwarffortress-0.4.12 closes #10798 Co-authored-by: maxice8 --- srcpkgs/dwarffortress/files/dwarffortress | 61 +++++++++++++++++++++++ srcpkgs/dwarffortress/template | 31 ++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 srcpkgs/dwarffortress/files/dwarffortress create mode 100644 srcpkgs/dwarffortress/template diff --git a/srcpkgs/dwarffortress/files/dwarffortress b/srcpkgs/dwarffortress/files/dwarffortress new file mode 100644 index 00000000000..e40fc75e3ce --- /dev/null +++ b/srcpkgs/dwarffortress/files/dwarffortress @@ -0,0 +1,61 @@ +#!/bin/sh +## dwarf fortress wrapper written and maintained by +# Robert Stancil +# +# MIT License +# +# Copyright (c) 2019 Robert Stancil +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +## + +usage() { + printf "Usage:\n %s [-f]\noptions:\n -f\tforce/recreate user's game data directory. " "${0}" +} + +while getopts 'f' c +do + case $c in + f) _FORCE=yes ;; + *) usage ;; + esac +done + +if [ $(id -u) -eq 0 ]; then + echo "Error, can't be run as root" >&2 + usage + exit +fi + +if [ -z ${XDG_DATA_HOME:-$HOME/.local/share} ]; then + echo "homedir unset" + usage + exit +fi + +if [ ! -d ${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress ]; then + _FORCE=yes +fi +if [ $_FORCE ] +then + rm -rf ${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress + cp /usr/share/dwarffortress ${XDG_DATA_HOME:-$HOME/.local/share} -r + ln -s /usr/lib/dwarffortress/libs ${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/ +fi + +${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/df diff --git a/srcpkgs/dwarffortress/template b/srcpkgs/dwarffortress/template new file mode 100644 index 00000000000..96b7de7b10d --- /dev/null +++ b/srcpkgs/dwarffortress/template @@ -0,0 +1,31 @@ +# Template file for 'dwarffortress' +pkgname=dwarffortress +version=0.44.12 +revision=1 +_urlver=${version#*.} +archs="x86_64" +create_wrksrc=yes +depends="gtk+ SDL SDL_ttf SDL_image libGL glu" +short_desc="Control a dwarven outpost in a randomly generated world" +maintainer="Robert Stancil " +license="custom: Proprietary" +homepage="http://www.bay12games.com/dwarves/" +distfiles="http://www.bay12games.com/dwarves/df_${_urlver//./_}_linux.tar.bz2" +checksum=5a2d15730d21b41a68da09ce3c3b70c3e2a6fd15b95c6cbfb68578ed2d2db979 + +nopie="distfiles are precompiled as PIE" +repository=nonfree +restricted=yes + +do_patch() { + vsed -i df_linux/df -e "s;./libs/Dwarf_Fortress;LD_PRELOAD=/usr/lib/libstdc++.so.6 ./libs/Dwarf_Fortress;" +} + +do_install() { + vbin ${FILESDIR}/dwarffortress + vmkdir /usr/share/dwarffortress + vmkdir /usr/lib/dwarffortress/libs + vcopy "df_linux/libs/*" /usr/lib/dwarffortress/libs + rm -r df_linux/libs + vcopy "df_linux/*" /usr/share/dwarffortress/ +}