# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697 pkgname=castle-combat pkgver=0.8.1 pkgrel=3 pkgdesc="Clone of the old arcade game Rampart. Build castle walls, place cannons inside these walls, and shoot at the walls the enemy(s)." arch=('any') url="http://www.linux-games.com/castle-combat/" license=('GPL2') depends=('python2-setuptools' 'python2-twisted' 'python2-pygame' 'python2-numpy') source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz") sha512sums=('c6350f95b82638a9da9a45cb0c995dcc7bf1fbd2f6e0d5f58347d73f9f3131697328e7e78cf08bb8c50d4f73eb754cc40c3680e76177f9f46f3a353c8768251a') prepare() { # replace /usr/bin/env python with python2 find $pkgname-$pkgver -name '*.py' -type f -exec sed -ri 's:^#!/usr/bin/(env )?python$:&2:' '{}' \; ## depreciated python code fixes find $pkgname-$pkgver -name '*.py' -type f -exec sed -ri 's|Numeric|numpy|' '{}' \; find $pkgname-$pkgver -name '*.py' -type f -exec sed -ri 's|UInt8|int|' '{}' \; ##find $pkgname-$pkgver -name '*.py' -type f -exec sed -ri 's|nonzero|numpy.nonzero|' '{}' \; ## fix data path sed -i 's|data_path = "data"|data_path = "/usr/bin/castle-combat-0.8.1/data"|' $srcdir/$pkgname-$pkgver/src/common.py ## remove non-free font and macosx items sed -i '/font = pygame.font/d' $srcdir/$pkgname-$pkgver/src/common.py sed -i '/small_font = pygame.font.Font/d' $srcdir/$pkgname-$pkgver/src/common.py sed -i '/global font/a font = pygame.font.SysFont("sans", 34)' $srcdir/$pkgname-$pkgver/src/common.py sed -i 's|font = pygame.font.SysFont|\tfont = pygame.font.SysFont|' $srcdir/$pkgname-$pkgver/src/common.py sed -i '/global small_font/a small_font = pygame.font.SysFont("sans", 24)' $srcdir/$pkgname-$pkgver/src/common.py sed -i 's|small_font = pygame.font.SysFont|\t\small_font = pygame.font.SysFont|' $srcdir/$pkgname-$pkgver/src/common.py rm -rf $srcdir/$pkgname-$pkgver/dist $srcdir/$pkgname-$pkgver/src/colourba.ttf $srcdir/$pkgname-$pkgver/src/font_read_me.html } package() { mkdir -p $pkgdir/usr/bin/ cp -r $srcdir/$pkgname-$pkgver/ $pkgdir/usr/bin/ cat <<EOF > $pkgdir/usr/bin/castle-combat #!/bin/bash cd /usr/bin/castle-combat-0.8.1 python2 castle-combat.py EOF chmod 755 $pkgdir/usr/bin/castle-combat }