# Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

require github [ user=arx project=ArxLibertatis tag=${PV/_p/-r} ]
require cmake [ api=2 ] gtk-icon-cache

SUMMARY="Cross-platform port of Arx Fatalis, a first-person role-playing game"
HOMEPAGE="http://arx-libertatis.org/"

LICENCES="GPL-3"
SLOT="0"
PLATFORMS="~amd64 ~x86"

DEPENDENCIES="
    build:
        dev-libs/boost
        virtual/pkg-config
    build+run:
        media-libs/freetype:2
        media-libs/glew
        media-libs/openal
        media-libs/SDL:0[X]
        sys-libs/zlib
    suggestion:
        app-arch/innoextract [[ description = [ For extracting game files
                                                from CD, used by the
                                                arx-install-data tool ] ]]
"

CMAKE_SRC_CONFIGURE_PARAMS=(
    -DBUILD_EDITOR=OFF
    -DCMAKE_INSTALL_DATAROOTDIR="/usr/share"
    -DCMAKE_INSTALL_PREFIX="/usr"
    -DCMAKE_INSTALL_BINDIR="/usr/$(exhost --target)/bin"
    -DICONDIR=/usr/share/icons/hicolor/128x128/apps
    -DINSTALL_SCRIPTS=ON
    -DSET_OPTIMIZATION_FLAGS=OFF
    -DSTRICT_USE=ON
    -DUSE_NATIVE_FS=ON
    -DUSE_OPENAL=ON
    -DUSE_OPENGL=ON
    -DUSE_SDL=ON
    -DBUILD_CRASHREPORTER=OFF
    -DBUILD_TOOLS=ON
    -DUNITY_BUILD=OFF
    -DUSE_STATIC_LIBS=OFF
)

pkg_postinst() {
    elog "This package only installs the game binary."
    elog "You need the demo or full game data. Also see:"
    elog "http://wiki.arx-libertatis.org/Getting_the_game_data"
    elog
    elog "If you have already installed the game or use the STEAM version,"
    elog "run \"/usr/$(exhost --target)/bin/arx-install-data\""

    gtk-icon-cache_pkg_postinst
}