summaryrefslogtreecommitdiff
path: root/community-testing/freeorion/PKGBUILD
blob: a778d6807f55a1f11953f315b9f43fc6283a9f59 (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
104
105
# $Id: PKGBUILD 73752 2012-07-15 13:18:16Z ibiru $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: guini <sidtrun@googlemail.com>
# Contributor: Forrest Loomis <cybercyst _ at _ gmail dot com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: fana-m <geminin@gmx.net>

pkgname=freeorion
pkgver=0.4
_fixedrevision=4635
pkgrel=6
pkgdesc="Turn-based galactic conquest game inspired by Master of Orion"
arch=('x86_64' 'i686')
url="http://www.freeorion.org/"
license=('GPL')
if [ "$CARCH" == "x86_64" ]
then
  depends=('lib32-nvidia-cg-toolkit')
else
  depends=('nvidia-cg-toolkit')
fi
depends=('bullet' 'freealut' 'libvorbis' 'python2' 'gigi' 'desktop-file-utils')
makedepends=('boost>=1.49.0' 'ogre' 'sdl' 'gigi>=0.8.0-11' 'graphviz' 'libogg'
             'desktop-file-utils' 'setconf' 'clang' 'cmake' 'gendesk' 'subversion')
options=('!strip' '!emptydirs')
install=$pkgname.install
source=("$pkgname.sh"
        "$pkgname.png::https://a.fsdn.com/con/icons/fr/freeorion@sf.net/FO_Icon_256x256.png")
sha256sums=('111532e460aec847ff455ee67dd64f46e2fa5ceba39a0349d25a84b69c646eaf'
            'a6a253eed31b77b00bf4f721f4b1c6bbd95505b9e4b38b736101e551dd12ff5f')

build() {
  cd "$srcdir"
  gendesk -n

  msg2 "Checking out svn revision $_fixedrevision..."
  if [[ -d "$pkgname/.svn" ]]; then
    (cd "$pkgname" && svn up -r "$_fixedrevision")
  else
    svn co \
      https://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/ \
      --config-dir ./ -r "$_fixedrevision" "$pkgname"
  fi

  msg2 "Setting up build directory..."
  rm -rf "$srcdir/$pkgname-build"
  cp -r "$srcdir/$pkgname" "$srcdir/$pkgname-build"
  cd "$srcdir/$pkgname-build"

  msg2 "Generating makefiles..."
  cmake -G "Unix Makefiles"
  
  msg2 "GLU fix..."
  setconf CMakeCache.txt CMAKE_CXX_FLAGS:STRING "'-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -lGL -lGLU '"

  msg2 "Boost fix..."
  sed -i 's:TIME_UTC:TIME_UTC_:' util/MultiplayerCommon.cpp

  msg2 "Compiling..."
  make -j1

  msg2 "OGRE fix..."
  sed -i 's:PluginFolder=.:PluginFolder=/usr/lib/OGRE/:g' \
    "$srcdir/$pkgname-build/ogre_plugins.cfg"
}

package() {
  cd "$srcdir/$pkgname-build"

  msg2 "Packaging documentation..."
  install -Dm644 loki_setup/README.txt \
    "$pkgdir/usr/share/doc/$pkgname/README.txt"

  msg2 "Packaging binaries..."
  install -Dm 755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/freeorion"
  install -Dm 755 freeorion "$pkgdir/usr/bin/freeorion.elf"
  install -Dm 755 freeorionca "$pkgdir/usr/bin/freeorionca"
  install -Dm 755 freeoriond "$pkgdir/usr/bin/freeoriond"

  msg2 "Packaging data..."
  mkdir -p "$pkgdir/usr/share/$pkgname" "$pkgdir/usr/lib/$pkgname"
  cp -r default "$pkgdir/usr/share/$pkgname"
  install -Dm 644 OISInput.cfg "$pkgdir/usr/share/OISInput.cfg"

  msg2 "Packaging license..."
  install -Dm 644 default/COPYING \
    "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  cd "$srcdir"

  msg2 "Packaging icon and shortcut..."
  install -Dm 644 "$pkgname.png" \
    "$pkgdir/usr/share/pixmaps/freeorion.png"
  install -Dm 644 "$pkgname.desktop" \
    "$pkgdir/usr/share/applications/freeorion.desktop"

  msg2 "Packaging OGRE plugins configuration..."
  install -Dm 644 "$srcdir/$pkgname-build/ogre_plugins.cfg" \
    "$pkgdir/usr/share/freeorion/ogre_plugins.cfg"

  msg2 "Cleaning up..."
  find "$pkgdir" -name ".svn" -print0 | xargs -0 rm -rf
}

# vim:set ts=2 sw=2 et: