summaryrefslogtreecommitdiff
path: root/community/freeorion/PKGBUILD
blob: a130e59b31c2fd69824e87a2a8b7e44268990017 (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
106
107
108
109
# $Id: PKGBUILD 95910 2013-08-18 16:26:52Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Elmo Todurov <todurov@gmail.com>
# Contributor: guini <sidtrun@googlemail.com>
# Contributor: Forrest Loomis <cybercyst@gmail.com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: fana-m <geminin@gmx.net>

pkgname=freeorion
pkgver=0.4.3
pkgrel=2
_svnrev=6344
_pyversion=2.7
pkgdesc='Turn-based galactic conquest game inspired by Master of Orion'
arch=('x86_64' 'i686')
url='http://www.freeorion.org/'
license=('GPL2')
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' 'libgl')
makedepends=('boost' 'ogre=1.8.1' 'sdl' 'gigi>0.8.0-18' 'graphviz' 'mesa-libgl'
             'desktop-file-utils' 'setconf' 'cmake' 'gendesk' 'subversion' 'libogg'
             'addinclude')
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"
        'cmake_python.patch'
        "$pkgname::svn+https://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/#revision=6344")
sha256sums=('25b574af5397226373e24510ce59de94c5df5b31d94562fc0de387fd70731707'
            'a6a253eed31b77b00bf4f721f4b1c6bbd95505b9e4b38b736101e551dd12ff5f'
            '3dbe8df9c3a4a0d6451f42727ebf9bcb21fed41a08d1181d1cf77ef4ab5ee81a'
            'SKIP')

prepare() {
  cd "$pkgname"

  # CMake/Python fix...
  patch -N -p1 -i "$srcdir/cmake_python.patch"

  # Generate desktop shortcut
  gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"

  addinclude -n GG/GG/adobe/once.hpp '#include <stdint.h>'
  addinclude -n GG/GG/adobe/closed_hash.hpp '#include <stdint.h>'
}

build() {
  cd "$pkgname"

  # Generating makefiles
  cmake \
    -DPYTHON_INCLUDE_DIR:PATH="/usr/include/python$_pyversion" \
    -DPYTHON_LIBRARY:FILEPATH="/usr/lib/libpython$_pyversion.so" \
    -G "Unix Makefiles"
  
  # GLU fix
  if [ "$CARCH" == "x86_64" ]
  then
    setconf CMakeCache.txt CMAKE_CXX_FLAGS:STRING \
      "'-march=native -mtune=generic -O2 -fno-var-tracking -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -lGL -lGLU -rpath=/usr/lib '"
  fi

  # Compiling
  make -j1

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

package() {
  cd "$pkgname"

  # Binaries
  install -Dm755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/freeorion"
  install -Dm755 freeorion "$pkgdir/usr/bin/freeorion.elf"
  install -Dm755 freeorionca "$pkgdir/usr/bin/freeorionca"
  install -Dm755 freeoriond "$pkgdir/usr/bin/freeoriond"

  # Data
  install -d "$pkgdir/usr/share/$pkgname"
  install -d "$pkgdir/usr/lib/$pkgname"
  cp -r default "$pkgdir/usr/share/$pkgname"
  install -Dm644 OISInput.cfg "$pkgdir/usr/share/$pkgname/OISInput.cfg"

  # Desktop shortcut and icon
  install -Dm644 "$pkgname.desktop" \
    "$pkgdir/usr/share/applications/freeorion.desktop"
  install -Dm644 "$srcdir/$pkgname.png" \
    "$pkgdir/usr/share/pixmaps/freeorion.png"

  # OGRE plugin configuration
  install -Dm644 "$srcdir/$pkgname/ogre_plugins.cfg" \
    "$pkgdir/usr/share/freeorion/ogre_plugins.cfg"

  # Documentation
  install -Dm644 loki_setup/README.txt \
    "$pkgdir/usr/share/doc/$pkgname/README.txt"

  # Cleanup
  find "$pkgdir" -name ".svn" -print0 | xargs -0 rm -rf
}

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