summaryrefslogtreecommitdiffstats
path: root/0ad-svn/PKGBUILD
blob: 9036f74cb2134c8927dec9f9d7abd3f8dca18beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Jakob "flocke" Nixdorf <flocke@user-helfen-usern.de>

pkgname=0ad-svn
pkgver=7093
pkgrel=1
pkgdesc="Cross-platform, 3D and historically-based real-time strategy game"
arch=('i686' 'x86_64')
url="http://wildfiregames.com/0ad"
license=('GPL2' 'CCPL')
depends=('binutils' 'boost' 'crypto++' 'devil' 'enet' 'gamin' 'libogg' 'libpng' 'libvorbis' 'libxml2' 'mesa' 'nspr' 'nasm' 'openal' 'sdl' 'valgrind' 'wxgtk' 'zlib')
makedepends=('gcc' 'subversion')
source=(http://ftp.mozilla.org/pub/mozilla.org/js/js-1.60.tar.gz \
	0ad.sh)

md5sums=('bd8f021e43a8fbbec55ac2cd3d483243'
	 'e44fcdb23628a6a2b6232a8171c38d13')

_svntrunk="http://svn.wildfiregames.com/public/ps/trunk"
_svnmod="trunk"

build() {
 msg "Building SpiderMonkey 1.6..."
  cd ${srcdir}/js/src
  [ "$CARCH" = "x86_64" ] && sed -i -e "s:lib64:lib:g" config.mk
  JS_THREADSAFE=1 INCLUDES=-I/usr/include/nspr OTHER_LIBS=-L/usr/lib  make -j1 -f Makefile.ref || return 1
    make -j1 -f Makefile.ref export || return 1
  cd ../../dist/Linux_All_DBG.OBJ

  if [ -d ${srcdir}/spidermonkey ]; then
   rm -rf ${srcdir}/spidermonkey
  fi

  install -d ${srcdir}/spidermonkey/lib || return 1
  cp lib/* ${srcdir}/spidermonkey/lib || return 1

  install -d ${srcdir}/spidermonkey/include/js || return 1
  cp include/* ${srcdir}/spidermonkey/include/js || return 1

 msg "Starting SVN checkout..."
  cd ${srcdir}
  if [ -d $_svnmod/.svn ]; then
    (cd $_svnmod && svn up -r $pkgver)
  else
    svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
  fi
 msg "SVN checkout done or server timeout"

 msg "Starting make..."
  if [ -d ${srcdir}/$_svnmod-build ]; then
   rm -r $_svnmod-build
  fi
  cp -r $_svnmod $_svnmod-build
  cd $_svnmod-build

 msg "Building FCollada..." 
  cd ${srcdir}/$_svnmod-build/libraries/fcollada/src || return 1
  make || return 1

 msg "Building Premake..."
  cd ${srcdir}/$_svnmod-build/build/premake/src || return 1
  make || return 1
  cp bin/premake .. || return 1

 msg "Updating Workspaces..."
  cd ${srcdir}/$_svnmod-build/build/workspaces
  ./update-workspaces.sh || return 1

 msg "Building 0 AD..."
  cd ${srcdir}/$_svnmod-build/build/workspaces/gcc || return 1
  LDFLAGS="-L${srcdir}/spidermonkey/lib -ljs" CFLAGS="-I${srcdir}/spidermonkey/include" make || return 1

 msg "Installing binaries..."
  install -d ${pkgdir}/opt/0ad || return 1
  cp -r ${srcdir}/$_svnmod-build/binaries/* ${pkgdir}/opt/0ad || return 1
  install -d ${pkgdir}/opt/0ad/system/spidermonkey || return 1
  cp -r ${srcdir}/spidermonkey/lib/* ${pkgdir}/opt/0ad/system/spidermonkey/ || return 1

 msg "Removing SVN stuff..."
  cd ${pkgdir}/opt/0ad || return 1
  find -name ".svn" -type d -print0 | xargs -0 rm -rf || return 1

 msg "Removing sucky windows stuff..."
  cd ${pkgdir}/opt/0ad/system || return 1
  rm *.exe
  rm *.dll
  rm *.bat
  rm Microsoft.VC*
  rm *.sys
  rm *.pdb
  rm -rf ape
  rm -rf textureconv
  rm ../data/createzip.bat

 msg "Fixing file permissions..."
  cd ${pkgdir}/opt/0ad/data || return 1
  chown -R root:games ${pkgdir}/opt/0ad || return 1
  chmod -R 664 ${pkgdir}/opt/0ad/data/cache || return 1
  chmod -R 664 ${pkgdir}/opt/0ad/logs || return 1

 msg "Installing run script..."
  install -D -m755 ${srcdir}/0ad.sh ${pkgdir}/usr/bin/0ad || return 1
}