# Maintainer (arch): Vesa Kaihlavirta <vegai@iki.fi>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>


# parabola changes and rationale:
#  - removed recommendation for non-free openttd-opensfx
#  - depends on individual icu libraries to prevent upgrade breakages and
#    enable Parabola to provide older icu libraries in a separate package to
#    make transition easier for Parabola contributors. See the comments in
#    the icu-*-compat PKGBUILDs for more details.


pkgname=openttd
pkgver=13.4
pkgrel=2
pkgrel+=.parabola1
pkgdesc='Engine for running Transport Tycoon Deluxe'
arch=(x86_64)
arch+=(i686 armv7h)
url='https://www.openttd.org'
license=(GPL)
depends=(fluidsynth fontconfig hicolor-icon-theme)
depends+=('libicui18n.so' 'libicuuc.so')
makedepends=(cmake ninja)
optdepends=('openttd-opengfx: free graphics')
source=("https://cdn.$pkgname.org/$pkgname-releases/$pkgver/$pkgname-$pkgver-source.tar.xz")
b2sums=('0ef635e40fe47185168bd13e4b8ce24a8ff9c4afe3eced6197298986127ee196a6dcb379643bbb1de9bb552e71cda5df5b5b35006ed2b43d6e33e8513b1cd550')


build() {
  # http://site.icu-project.org/download/61#TOC-Migration-Issues
  CXXFLAGS+=' -DU_USING_ICU_NAMESPACE=1'

  cmake \
    -B build \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_BINDIR=bin \
    -D CMAKE_INSTALL_DATADIR=/usr/share \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -G Ninja \
    -S $pkgname-$pkgver
  ninja -C build
}

package() {
  DESTDIR="$pkgdir" ninja -C build install
}
