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