summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 9d8e92902a6ce53015ec57a150df90f94b9487a5 (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
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Sven-Hendrik Haase <svenstaro@gmail.com>
# Contributor (Arch): t3ddy  <t3ddy1988 "at" gmail {dot} com>
# Contributor (Arch): Adrián Chaves Fernández (Gallaecio) <adriyetichaves@gmail.com>

# # I maintain this because:
# Arch version lacks additional optimization and hardening flags

pkgname=0ad
pkgver=a23.1
_pkgver=0.0.23b-alpha
pkgrel=8
pkgdesc="Cross-platform, 3D and historically-based real-time strategy game"
arch=('x86_64')
url="https://play0ad.com/"
license=('GPL2' 'CCPL')
depends=('binutils' 'boost-libs' 'curl' 'enet' 'libogg' 'libpng' 'libvorbis'
         'libxml2' 'openal' 'sdl2' 'wxgtk' 'zlib' 'libgl' '0ad-data' 'glu'
         'gloox' 'miniupnpc' 'libminiupnpc.so' 'icu' 'nspr' 'libsodium')
makedepends=('boost' 'cmake' 'mesa' 'zip' 'python2' 'libsm')
source=(https://releases.wildfiregames.com/$pkgname-$_pkgver-unix-build.tar.xz
        zen2-workaround.patch
        missing-includes.patch)
b2sums=('db7d6bf1a2bb084870b914cf974bfdb19812ff6f9391e5bc5213ae215fc670b77bd4508a5432aa3e47bf327bd37d4bb14961ab3332b165b53327c3f01a935ac1'
        'c3569351f855c2e528add0789261bfc4bc41a248af885db65b828027294932dd4ab20ef42f29a86401adaabc3c55809ed2e1c89c268719554444b5f73f56e0d8'
        '0ec294936fbe185fc172d39813b2d11ea2c1958b022155fb43809731378bb6b8294ccb4648432f6a9cc9e615ecda9a414f01a6cce258c7ea49306f4fd6fc49c3')

prepare() {
  cd "$srcdir/$pkgname-$_pkgver/"
  sed -i "s/env python/env python2/g" libraries/source/cxxtest-4.4/bin/cxxtestgen

  patch -Np0 -i "$srcdir"/zen2-workaround.patch
  patch -Np1 -i "$srcdir"/missing-includes.patch
}

build() {
  cd "$srcdir/$pkgname-$_pkgver/build/workspaces"

  unset CPPFLAGS # for le spidermonkey

  # http://site.icu-project.org/download/61#TOC-Migration-Issues
  CXXFLAGS+=' -DU_USING_ICU_NAMESPACE=1'
  
  # -fPIE and -pie break compilation
  export CFLAGS="$CFLAGS -O3 -fstack-protector-all -flto=4 -fPIC"
  export CXXFLAGS="$CXXFLAGS -O3 -fstack-protector-all -flto=4 -fPIC"

  export SDL2_CONFIG="pkg-config sdl2"
  ./update-workspaces.sh \
      --without-pch \
      --bindir=/usr/bin \
      --libdir=/usr/lib/0ad \
      --datadir=/usr/share/0ad/data

  cd "$srcdir/$pkgname-$_pkgver/build/workspaces/gcc"

  verbose=1 make
}

package() {
  install -d "${pkgdir}"/usr/{bin,lib/0ad,share/"${pkgname}"/data}
  cd "$srcdir/$pkgname-$_pkgver"

  install -Dm755 binaries/system/pyrogenesis "${pkgdir}/usr/bin"
  install -Dm755 binaries/system/*.so "${pkgdir}/usr/lib/0ad"

  cp -r binaries/data/l10n/ "${pkgdir}/usr/share/${pkgname}/data/"

  install -Dm755 build/resources/${pkgname}.sh "${pkgdir}/usr/bin/${pkgname}"
  install -Dm644 build/resources/${pkgname}.desktop "${pkgdir}/usr/share/applications/${pkgname}.desktop"
  install -Dm644 build/resources/${pkgname}.png "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
}