# Description:  A single player fantasy game
# URL:  http://www.bay12games.com/dwarves
# Maintainer:  z3bra, dev at z3bra dot org
# Depends on:  cmake gtk-32 glu-32 libsdl-32-sdl_image libsndfile-32 openal sdl_ttf glew-32 gcc nvidia-32 alsa-lib-32 ncurses-32 xorg-libxdamage-32

name=dwarffortress
version=0.40.10
_version=40_10
release=2
source=(
    http://www.bay12games.com/dwarves/df_${_version}_linux.tar.bz2
    dwarffortress
)

build() {

    install -dm755 $PKG/opt/
    cp -r $SRC/df_linux $PKG/opt/$name
    rm -r $PKG/opt/$name/df $PKG/opt/$name/libs/* $PKG/opt/$name/g_src

    find $PKG/opt/$name -type d -exec chmod 755 {} +
    find $PKG/opt/$name -type f -exec chmod 644 {} +

    install -Dm755 $SRC/df_linux/libs/Dwarf_Fortress $PKG/opt/$name/libs/Dwarf_Fortress
    install -Dm755 $SRC/df_linux/libs/libgraphics.so $PKG/opt/$name/libs/libgraphics.so
    install -Dm755 $SRC/dwarffortress $PKG/usr/bin/$name

    # No idea why we need this. Really. This isn't being loaded dynamically, it's not linked and
    # in general there is no indication this is being used. However, it doesn't work without this symlink.
    ln -s /usr/lib32/libpng.so $PKG/opt/$name/libs/libpng.so.3

    # Set name in runscript
    sed -i "s/^name=.*/name=$name/" $PKG/usr/bin/$name

    install -Dm644 $SRC/df_linux/readme.txt $PKG/usr/share/licenses/$name/readme.txt
}
# vim: set ft=sh ts=4 et:
