updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / chocolate-castle / PKGBUILD
blob28624bda62e85d88d4194cd67162b6b17f04c7fd
1 # Maintainer: Loren <smallphrosty  gmail  com>
3 pkgname=chocolate-castle
4 pkgver=1.09_1
5 pkgrel=1
6 pkgdesc="A tricky sliding block puzzle game. You must purchase the game. (The Humble Voxatron Bundle)"
7 url='http://www.lexaloffle.com/choc.php'
8 groups=('humblevoxatronbundle' 'humblebundles')
9 license=('custom: "commercial"')
10 source=(${pkgname}.bmp 
11         ${pkgname}.desktop 
12         ${pkgname}.launcher)
13 md5sums=('ce3b8bd4ab328405c10147e6bfeccc9b'
14          '22498f99411e519c2239a52d28872e61'
15          'a401a711742eb8501a52b793565b74d5')
16 arch=('i686' 'x86_64')
17 [ "${CARCH}" = "x86_64" ] && depends=('lib32-libgl' 'lib32-sdl')
18 [ "${CARCH}" = "i686" ]  && depends=('libgl' 'sdl')
20 _gamepkg="${pkgname}_${pkgver//_/-}_i386.tar.gz"
22 build() {
23    cd ${srcdir}
25    msg "You need a full copy of this game in order to install it"
26    msg "Searching for ${_gamepkg} in dir: $(readlink -f `pwd`/..)"
27    if [[ -f "../${_gamepkg}" ]]; then
28        msg "Found game package, installing..."
29        ln -fs "../${_gamepkg}" .
30    elif [ -n "${_humblevoxatronkey}" ]; then
31            msg "Game package not found, trying to download..."
32            rm -f index.html\?key\=${_humblevoxatronkey}*
33            wget http://www.humblebundle.com/?key=${_humblevoxatronkey}
34            wget $(cat index.html\?key\=${_humblevoxatronkey} | grep "${_gamepkg}" | cut -d "'" -f 10)
35            mv ${_gamepkg}* ${_gamepkg}
36    else
37            msg "Game package not found and download failed."
38            msg "You can add \'export _humblevoxatronkey=<Your key here>\' to \.bashrc if you want automated download ability."
39        error "Please type absolute path to ${_gamepkg} (/home/joe):"
40        read pkgpath
41        if [[ -f "${pkgpath}/${_gamepkg}" ]]; then
42            msg "Found game package, installing..."
43                    ln -fs "${pkgpath}/${_gamepkg}" .
44            else
45                error "Unable to find game package."
46                return 1
47        fi
48    fi
49    install -d $pkgdir/opt/${pkgname}
50    bsdtar -xf $srcdir/${_gamepkg}
51    cp -r $srcdir/choc/* $pkgdir/opt/${pkgname}  
52    rm $pkgdir/opt/$pkgname/libSDL-1.2.so.0
55 package() {
56    cd ${srcdir}
57    # Install Desktop File and Icon
58    install -D -m 644 $srcdir/${pkgname}.bmp \
59       $pkgdir/usr/share/pixmaps/${pkgname}.bmp 
60    install -D -m 644 $srcdir/${pkgname}.desktop \
61       $pkgdir/usr/share/applications/${pkgname}.desktop 
62    # Install Game Launcher
63    install -D -m 755 $srcdir/${pkgname}.launcher \
64       $pkgdir/usr/bin/choc 
66    # Install license
67    install -Dm 644 "${pkgdir}"/opt/${pkgname}/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license