summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 98e067d3f9d3811ad8114da3f07e23b4bcfe5f57 (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
# 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

pkgname=0ad
pkgver=a25.b
_pkgver=0.0.25b-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=('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')
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"
        "glibc-2.35.patch"
        "python-3.10.patch")
sha512sums=('e8069897b97b381099ab5ec5868d27e96c699105b3307054d1bc7bf9236a537f02625ba9034892d91f3e951b4f95c9ce5fb75ed0a7c14b8a294882482fd9c1b4'
            'e56fa4a3a43f7510dde50d5fd0ccda2f935d9ad2aac44d9af9e89109c655b605f8ef582e1188be3dc1d42b7feef0caefa0ec514776696603c237f054fd6778c9'
            '42df5eb7c4a99b31365b7f15c5bcd76c978339f2837eb8bc6ec371979429d0f0a6e31e870f6851aa40fc4859cb3e82f74821a01d04b82b486342db0fa60bf55e')
b2sums=('674d69d625137709a186f9273607dc353fc99aea68ef3f2ea5031dbe2f684176910d757c3f03c7fbdac475d30708be448b71f5020d27a65c346bf147223bcb9d'
        'e7d372e68b450f98631239ab0bb0c9eafdedb48f8a788037ce60851f28258a962a31a22afe80968bc1d706017acf7e9b25821fbe282db889ef534670b6954c89'
        '6b6853eacbeadfe7e95382c97572c60b1838d5f4b0b925c2bb977be76db6a0a2ac97376089a42fca6a7956319b69c56ec0d2fb59a1114002d708486582de346d')

prepare() {
  cd $pkgname-$_pkgver
  patch -Np1 -i ../glibc-2.35.patch # https://code.wildfiregames.com/rP26536
  patch -Np1 -i ../python-3.10.patch # Fix spidermonkey build with Python 3.10
}

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"
}