From 315843360d33cbc8029e2d6e6a2b767a9dd726d2 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 9 Oct 2016 11:05:21 -0400 Subject: fix castle-combat. Builds but crashes --- pcr/castle-combat/PKGBUILD | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'pcr/castle-combat') diff --git a/pcr/castle-combat/PKGBUILD b/pcr/castle-combat/PKGBUILD index cc15da96b..8ef3d8d14 100644 --- a/pcr/castle-combat/PKGBUILD +++ b/pcr/castle-combat/PKGBUILD @@ -4,21 +4,39 @@ pkgname=castle-combat pkgver=0.8.1 pkgrel=2 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=('x86_64' 'i686') +arch=('any') url="http://www.linux-games.com/castle-combat/" license=('GPL2') -depends=('sdl' 'sdl_mixer' 'sdl_image') +depends=('python2-setuptools' 'python2-twisted' 'python2-pygame' 'python2-numpy') source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz") sha512sums=('c6350f95b82638a9da9a45cb0c995dcc7bf1fbd2f6e0d5f58347d73f9f3131697328e7e78cf08bb8c50d4f73eb754cc40c3680e76177f9f46f3a353c8768251a') -build() { - cd $pkgname-$pkgver - ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --sbindir=/usr/bin - make +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() { - cd $pkgname-$pkgver - ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --sbindir=/usr/bin - make DESTDIR="$pkgdir/" install + mkdir -p $pkgdir/usr/bin/ + cp -r $srcdir/$pkgname-$pkgver/ $pkgdir/usr/bin/ +cat < $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 } -- cgit v1.2.3-2-g168b