summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: aef98a1cbbd09c55ca45c46f01bb628ec1fdeda8 (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
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Eric BĂ©langer <eric@archlinux.org>

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

pkgname=lincity-ng
pkgver=2.0
pkgrel=10.2
pkgdesc="A city simulation game"
arch=('x86_64')
url="https://sourceforge.net/projects/lincity-ng.berlios/"
license=('GPL' 'custom')
depends=('sdl_mixer' 'sdl_ttf' 'sdl_image' 'physfs' 'libxml2' 'sdl_gfx' 'libgl')
makedepends=('ftjam' 'mesa' 'glu')
# # For some reason this breaks compiling. "error: C++ compiler cannot create executables"
# # But old-fashioned raw injection of -flto=auto via export doesn't.
#options=(lto)
source=(https://sourceforge.net/projects/${pkgname}.berlios/files/${pkgname}-${pkgver}.tar.bz2)
b2sums=('39992e6a2ef78e53eea1b0e347c968f6828089b5267e6d62dac7405ea91b182335431b1718ef9892b649b1437751959deb9fa407dfd899fd1dfca55145d059f2')

build() {
  cd ${pkgname}-${pkgver}

  export CFLAGS="$CFLAGS -O3 -fPIE -flto=auto"
  export CXXFLAGS="$CXXFLAGS -O3 -fPIE -flto=auto"
  export LDFLAGS="$LDFLAGS,-pie"

  # Build fails due to -Werror=format-security
  export CFLAGS="$(echo $CFLAGS | sed 's/-Werror=format-security/-Wno-error=format-security/')"
  export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-Werror=format-security/-Wno-error=format-security/')"
  
  ./configure --prefix=/usr
  jam "${MAKEFLAGS}"
}

package() {
  cd ${pkgname}-${pkgver}

  # For reasons of black magic, this program compiles a second time during this step.
  # FLAGS are set again here to ensure optimization and prevent build failure.
  # Madness.

  export CFLAGS="$CFLAGS -O3 -fPIE -flto=auto"
  export CXXFLAGS="$CXXFLAGS -O3 -fPIE -flto=auto"
  export LDFLAGS="$LDFLAGS,-pie"

  # Build fails due to -Werror=format-security
  export CFLAGS="$(echo $CFLAGS | sed 's/-Werror=format-security/-Wno-error=format-security/')"
  export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-Werror=format-security/-Wno-error=format-security/')"

  jam "${MAKEFLAGS}" -s prefix="${pkgdir}/usr" install

  install -D -m644 COPYING-data.txt "${pkgdir}/usr/share/licenses/${pkgname}/COPYING-data.txt"
  install -D -m644 COPYING-fonts.txt "${pkgdir}/usr/share/licenses/${pkgname}/COPYING-fonts.txt"
}