summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 0b94364f24941457156e268ee0e366964dbe8303 (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
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Sven-Hendrik Haase <svenstaro@archlinux.org>
# 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
# Arch version does not honour $MAKEFLAGS

pkgname=0ad
pkgver=a26
_pkgver=0.0.26-alpha
pkgrel=4
pkgdesc="Cross-platform, 3D and historically-based real-time strategy game"
arch=('x86_64')
url="https://play0ad.com/"
license=('GPL2' 'CCPL')
depends=('0ad-data' 'binutils' 'boost-libs' 'curl' 'enet' 'libogg' 'libpng' 'libvorbis'
         'libxml2' 'openal' 'sdl2' 'wxwidgets-gtk3' 'zlib' 'libgl' 'glu' 'fmt'
         'gloox' 'miniupnpc' 'libminiupnpc.so' 'icu' 'nspr' 'libsodium' 'which')
makedepends=('boost' 'cmake' 'mesa' 'zip' 'libsm' 'rust' 'python' 'clang')
options=('!lto') # breaks spidermonkey linking (https://bugs.gentoo.org/746947)
source=("https://releases.wildfiregames.com/$pkgname-$_pkgver-unix-build.tar.xz")
sha512sums=('aaf647d5d8454c244015d2a198beeaaebc571a5bc96446f3acff8dbd05f9843029c500bf4162651a5e1fcdb42bd5fb5b4f5c512c78372479fbd8565dd093f272')
b2sums=('ddd589840b0dacee2377ff4e5624f69646b92da4217015d788c6abec097578e44aee6641b6a6945d15f50d8e50673a1d44587c2faf02278d981a0ed30c950214')

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

  # rust is prone to OOM, use 1 thread per 2GB ram
  #export MAKEFLAGS="-j32"

  # Disable hardcoded extra threads on update-workspaces stage
  sed -i 's/JOBS=${JOBS:="-j2"}/#JOBS=${JOBS:="-j2"}/' update-workspaces.sh

  # Set threads on update-workspaces stage to $MAKEFLAGS
  export JOBS=${JOBS:="$MAKEFLAGS"}

  # -fPIE and -pie break compilation
  # -flto=auto and -flto=1 break compilation since a24.b
  export CFLAGS="$CFLAGS -O3 -fstack-protector-all -fPIC"
  export CXXFLAGS="$CXXFLAGS -O3 -fstack-protector-all -fPIC"

  ./update-workspaces.sh \
      --without-pch \
      --bindir=/usr/bin \
      --libdir=/usr/lib/0ad \
      --datadir=/usr/share/0ad/data

  cd gcc

  VERBOSE=1 make
}

package() {
  cd "$pkgname-$_pkgver"
  install -d "${pkgdir}"/usr/{bin,lib/0ad,share/"${pkgname}"/data}
  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"
}