Skip to content

Commit

Permalink
dwarffortress: update to 50.15.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rutpiv committed Dec 22, 2024
1 parent ed712b2 commit 6356637
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 29 deletions.
50 changes: 36 additions & 14 deletions srcpkgs/dwarffortress/files/dwarffortress
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
#!/bin/sh
## dwarf fortress wrapper written and maintained by
# Robert Stancil <[email protected]>
#
#
# MIT License
#
# Copyright (c) 2019 Robert Stancil <[email protected]>
#
# 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
# Modified by: Rutpiv <[email protected]> in 2024 to adjust symlink
# creation and preserve existing save data by backing up old directories.
#
# 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
# 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,
# 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.
##

Expand Down Expand Up @@ -48,14 +51,33 @@ if [ -z ${XDG_DATA_HOME:-$HOME/.local/share} ]; then
exit
fi

# Check if an existing 'dwarffortress' directory with the old structure is found.
# If found, create a backup of the directory before removing it.
# The backup is stored as a tar.gz archive with a timestamp to prevent overwriting.
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress" ] &&
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/df" ]; then
echo "Existing old 'dwarffortress' directory found. Creating a backup..."

timestamp=$(date +%Y%m%d%H%M%S)
backup_file="${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress_backup_${timestamp}.tar.gz"
tar -czf "$backup_file" -C "${XDG_DATA_HOME:-$HOME/.local/share}" dwarffortress
echo "Backup created at $backup_file"

rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress"
echo "Old 'dwarffortress' directory removed."
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/
for lib in /usr/lib/dwarffortress/libs/*; do
ln -s "$lib" "${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/"
done
ln -s /usr/bin/dwarfort ${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/
fi

${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/df
${XDG_DATA_HOME:-$HOME/.local/share}/dwarffortress/run_df
27 changes: 12 additions & 15 deletions srcpkgs/dwarffortress/template
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
# Template file for 'dwarffortress'
pkgname=dwarffortress
version=0.47.05
revision=2
_urlver=${version#*.}
version=50.15
revision=1
_urlver=${version//./_}
archs="x86_64"
depends="gtk+ SDL SDL_ttf SDL_image virtual?libGL glu"
short_desc="Control a dwarven outpost in a randomly generated world"
maintainer="Robert Stancil <[email protected]>"
maintainer="Rutpiv <[email protected]>"
license="custom: Proprietary"
homepage="http://www.bay12games.com/dwarves/"
distfiles="http://www.bay12games.com/dwarves/df_${_urlver//./_}_linux.tar.bz2"
checksum=ac74a6dbb7d7d9621f430405080322ab50c35f6632352ff2ea923f6dc5affca3
homepage="https://www.bay12games.com/dwarves/"
distfiles="https://www.bay12games.com/dwarves/df_${_urlver}_linux.tar.bz2"
checksum=2a429c5df5e30fb7548d00df2ad5e268a7e889e44df30252631c8dea5881c14e

nostrip_files="Dwarf_Fortress"
nopie="distfiles are precompiled as PIE"
repository=nonfree
noshlibprovides=yes

post_extract() {
rm libs/libstdc++.so.6
rm libs/libgcc_s.so.1
}

do_install() {
vbin ${FILESDIR}/dwarffortress
vbin dwarfort
rm dwarfort
vmkdir /usr/share/dwarffortress
vmkdir /usr/lib/dwarffortress/libs
vcopy "libs/*" /usr/lib/dwarffortress/libs
rm -r libs
vcopy "*" /usr/share/dwarffortress/
vcopy lib* /usr/lib/dwarffortress/libs
rm lib*
vcopy * /usr/share/dwarffortress/
vlicense "readme.txt" dwarffortress.txt
}

0 comments on commit 6356637

Please sign in to comment.