# Maintainer: Erich Eckner pkgname=openttd-git pkgver=29069.ceb29cef8 _commit=${pkgver#*.} pkgrel=1 pkgdesc="A FOSS clone of Transport Tycoon Deluxe." arch=('x86_64' 'i686' 'pentium4') url="http://www.openttd.org" license=('GPL2') groups=() depends=( 'fluidsynth' 'fontconfig' 'hicolor-icon-theme' 'icu' 'libpng' 'lzo' 'sdl' 'xz' ) makedepends=('git') checkdepends=( 'openttd-opengfx' ) optdepends=( 'openttd-opengfx: free graphics' 'openttd-opensfx: free soundset' 'openttd-openmsx: free music' ) provides=('openttd') conflicts=('openttd') replaces=() backup=() options=() source=( "${pkgname}::git://github.com/OpenTTD/OpenTTD.git#commit=${_commit}" "signaltunnel.patch" "sloped-stations.patch" "underground.patch" ) sha512sums=('SKIP' '347edcf329e082b82d80504a2e08040706a72d74dbaede87be719e121c46ff3a02d20b8c59bfa99d3925cc1f10a76d51e29d83f5fe4b1d18421d72d5b80ece96' '2f6a2fbd6931330f84611c5256ebdbf003484e83c85aeaea13a298b75159ef0256072b4094a2c8c92a8f5a912e695a738ed3b9ca9b05da2bf9396b19970a55cd' '9aefde1091be171c5d4747a331a9cb56e0b9a9dcc16c5a78545249755a8e1d3b3af2b47fcc4981d96101c8450ed09f0cc775c9079918042cd0afcfd3dfe731ec') pkgver() { printf '%s.%s\n' \ "$(( $(git -C "${srcdir}/${pkgname}" rev-list --count "${_commit}" ^f84ad5f7c) + 28004 ))" \ "$( git -C "${srcdir}/${pkgname}" rev-parse --short=9 "${_commit}" )" } prepare() { cd "${srcdir}/${pkgname}" ISODATE=$( date -d@$( git log -n1 --pretty=format:%ct ) +'%Y%m%d' ) HASH=$(find {src,bin} -type f -exec sha512sum {} \; | sort | sha512sum - | cut -d' ' -f1) SHORTHASH=$(echo ${HASH} | cut -c1-8) printf '%s\t%s\t%s\t%s\t%s\t%s\n' \ "${ISODATE}-ewe-g${SHORTHASH}" \ "${ISODATE}" \ "0" \ "${HASH}" \ "0" \ "0" \ > .ottdrev sed -i ' s,"\$ROOT_DIR/\.git","/dev/does/not/exist", ' findversion.sh for _p in "${srcdir}/"{signaltunnel,sloped-stations,underground}.patch; do >&2 echo "patching ${_p##*/} ..." patch -p1 -i "${_p}" >&2 echo "... ok" done sed -i ' s/readme\.txt/README.md/g ' Makefile.bundle.in } build() { cd "${srcdir}/${pkgname}" ./configure \ --prefix-dir=/usr \ --binary-dir=bin \ --data-dir=share/openttd \ --icon-dir=share/openttd \ --man-dir=share/man \ --personal-dir=.openttd \ --install-dir=$pkgdir make } check() { cd "${srcdir}/${pkgname}" make test || true } package() { cd "${srcdir}/${pkgname}" make DESTDIR=$pkgdir install # Remove unnecessary languages cp $pkgdir/usr/share/openttd/lang/{english,german}.lng $srcdir rm $pkgdir/usr/share/openttd/lang/* install -m 644 $srcdir/{english,german}.lng $pkgdir/usr/share/openttd/lang # Remove junk rm -rf $pkgdir/usr/share/doc rm -rf $pkgdir/usr/share/openttd/scripts }