updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / openttd-bin / PKGBUILD
blob66f070a952c6c44cd35e941b8f04e1e2fe44ae52
1 # Contributor: T-T
3 if [ -f ./pkgvrs ]; then
4         pkgvrs=$(cat ./pkgvrs)
5 else
6         until [[ "$pkgvrs" =~ ^[0-9]+(\.[0-9]+)*(-(RC|beta)[0-9]+)?$ ]]; do
7                 echo -n '       1.0.5'
8                 echo -n '       1.1.0'
9                 echo -n '       1.1.1'
10                 echo -n '       1.1.2'
11                 echo -n '       1.1.3'
12                 echo '  1.1.4'
13                 echo -n 'Choose version: '
14                 read pkgvrs
15         done
16         if [[ "$pkgvrs" =~ ^(1\.1\.4|1\.1\.3|1\.1\.2|1\.1\.1|1\.1\.0|1\.0\.5)$ ]]; then
17                 :
18         else
19                 echo -n 'Unverified version, type md5sum: '
20                 read md5
21         fi
23 if test -f ./pkgvrs; then rm pkgvrs; else echo "$pkgvrs" > pkgvrs; fi
25 pkgname=openttd-bin
26 pkgver='1.1.4'
27 if test "$pkgvrs"; then pkgver=$(echo "$pkgvrs" | sed 's/-\|:/_/g'); fi
28 pkgrel=0
29 pkgdesc="OpenTTD is an Open Source clone of Transport Tycoon Deluxe"
30 arch=('i686' 'x86_64')
31 url="http://www.openttd.org"
32 license=('GPL')
33 depends=(libpng sdl fontconfig icu)
34 makedepends=()
35 conflicts=('openttd')
36 optdepends=('openttd-opengfx: free graphics' 'openttd-opensfx: free soundset' 'openttd-openmsx: free musicset')
37 if [ "$pkgvrs" == '1.1.4' ]; then
38         if [ "${CARCH}" = 'x86_64' ] ; then
39                 _arch='amd64'
40                 _md5_tar='070340fa7d4d5ebfb47fd806cde5489a'
41         else
42                 _arch="i686"
43                 _md5_tar='a7feb7a1c1f7187abc8c17365194f36a'
44         fi
45 elif [ "$pkgvrs" == '1.1.3' ]; then
46         if [ "${CARCH}" = 'x86_64' ] ; then
47                 _arch='amd64'
48                 _md5_tar='605da3675d3f56ce7bcaac7cc6ec093e'
49         else
50                 _arch="i686"
51                 _md5_tar='4cd9fcb9ad88a66dfb96b22f23b75b13'
52         fi
53 elif [ "$pkgvrs" == '1.1.2' ]; then
54         if [ "${CARCH}" = 'x86_64' ] ; then
55                 _arch='amd64'
56                 _md5_tar='f19cd685f6043be7654792537e42f903'
57         else
58                 _arch="i686"
59                 _md5_tar='dc1d92453e25e3ab1699fc587124aad7'
60         fi
61 elif [ "$pkgvrs" == '1.1.1' ]; then
62         if [ "${CARCH}" = 'x86_64' ] ; then
63                 _arch='amd64'
64                 _md5_tar='16dd695eaeff5db52a9e8a395e59387a'
65         else
66                 _arch="i686"
67                 _md5_tar='005b1a31086546c418295f4ebfacde10'
68         fi
69 elif [ "$pkgvrs" == '1.1.0' ]; then
70         if [ "${CARCH}" = 'x86_64' ] ; then
71                 _arch='amd64'
72                 _md5_tar='f8645cb8fc7650ac7f71659c69f65fe0'
73         else
74                 _arch="i686"
75                 _md5_tar='0d1c3b56f7421ca1a264a23cb354a7e9'
76         fi
77 elif [ "$pkgvrs" == '1.0.5' ]; then
78         if [ "${CARCH}" = 'x86_64' ] ; then
79                 _arch='amd64'
80                 _md5_tar='9f9068b8b35f70f9c534fa22ac6eac2a'
81         else
82                 _arch="i686"
83                 _md5_tar='397d35173d5f70f40591940378723200'
84         fi
85 else
86         if [ "${CARCH}" = 'x86_64' ] ; then
87                 _arch='amd64'
88                 _md5_tar="$md5"
89         else
90                 _arch="i686"
91                 _md5_tar="$md5"
92         fi
95 source=(http://binaries.openttd.org/releases/${pkgvrs}/openttd-${pkgvrs}-linux-generic-${_arch}.tar.xz)
96 md5sums=(${_md5_tar})
98 build() {
99         cd ${srcdir}/openttd-${pkgvrs}-linux-generic-${_arch}
101         mkdir -p ${pkgdir}/usr/share/applications/
102         mv media/openttd.desktop ${pkgdir}/usr/share/applications/
104         mkdir -p ${pkgdir}/usr/share/doc/openttd/
105         mv docs/* ${pkgdir}/usr/share/doc/openttd/
107         mkdir -p ${pkgdir}/usr/share/man/man6/
108         mv man/openttd.6.gz ${pkgdir}/usr/share/man/man6/
110         mkdir -p ${pkgdir}/usr/share/pixmaps/
111         mv media/openttd.32.xpm ${pkgdir}/usr/share/pixmaps/
113         for isize in 16 32 48 64 128 256 ; do
114                 mkdir -p ${pkgdir}/usr/share/icons/hicolor/${isize}x${isize}/apps/
115                 mv media/openttd.${isize}.png ${pkgdir}/usr/share/icons/hicolor/${isize}x${isize}/apps/openttd.png
116         done
118         mkdir -p ${pkgdir}/usr/share/openttd
119         for d in openttd ai data gm lang scripts ; do
120                 mv $d ${pkgdir}/usr/share/openttd/
121         done
123         mkdir -p ${pkgdir}/usr/bin/
124         echo -e '#/bin/sh\ncd /usr/share/openttd && ./openttd $@' > ${pkgdir}/usr/bin/openttd
125         
126         chmod +xr ${pkgdir}/usr/bin/openttd
127         cd ${pkgdir}/usr/share/openttd
128         chmod +x `dir`
129         chmod +r `find`