# Maintainer: jc_gargma # Maintainer (AUR): George Rawlinson # Contributor (AUR): Max Zhao # Contributor (AUR): Leonard König # # I maintain this because: # Arch version lacks additional optimization and hardening flags # Arch version uses git # Arch version forces compilation with all threads # Arch version forces msse3, and single thread flto # Arch version compiles a second time during package() with incorrect FLAGS pkgname=endless-sky pkgver=0.10.4 pkgrel=1 pkgdesc='A sandbox-style space exploration and combat game' arch=('x86_64' 'i686' 'aarch64') url='https://endless-sky.github.io/' license=( 'GPL3' 'custom:CC-BY-3.0' 'custom:CC-BY-4.0' 'custom:CC-BY-NC-3.0' 'custom:CC-BY-SA-3.0' 'custom:CC-BY-SA-4.0' 'custom:public-domain' ) options=('lto') depends=( 'glibc' 'gcc-libs' 'openal' 'libpng' 'glew' 'hicolor-icon-theme' 'libjpeg-turbo' 'sdl2' 'libmad' 'util-linux-libs' 'libglvnd' ) makedepends=('scons') optdepends=( 'endless-sky-high-dpi: high resolution graphics assets' ) source=("$pkgname-$pkgver.tar.gz::https://github.com/endless-sky/endless-sky/archive/v${pkgver}.tar.gz") b2sums=('2a0a82c87d86150ddf5b371371de1a3fc642893af0e2506f83417abd9f846fbe2b9d0418c911fbaa94367cf5303ca52150cec1e5ac5d02bbca991b8a766fb647') prepare() { cd "$pkgname-$pkgver" # binary is installed to /usr/games instead of /usr/bin sed -i 's:games", sky:bin", sky:' SConstruct # Stop forcing msse3, O3, and single thread flto sed \ -e 's|||' \ -e 's|||' \ -e 's|||' \ -i EndlessSky.cbp sed \ -e 's|||' \ -e 's|||' \ -e 's|||' \ -i EndlessSkyLib.cbp sed \ -e 's|||' \ -e 's|||' \ -e 's|||' \ -i EndlessSkyTests.cbp sed \ -e 's|, "-O3", "-flto"||' \ -e 's|env.Append(LINKFLAGS = ["-O3", "-flto"])||' \ -i SConstruct } build() { cd "$pkgname-$pkgver" export CFLAGS="$CFLAGS -O3 -fPIE" export CXXFLAGS="$CXXFLAGS -O3 -fPIE" export LDFLAGS="$LDFLAGS,-pie" # Fix scons to honor thread count in MAKEFLAGS scons "${MAKEFLAGS}" } package() { cd "$pkgname-$pkgver" # For reasons of black magic, adding these flags again prevents a second compilation during this step. # This halves compilation time. # Also prevents this second compilation from being used in the resulting package with incorrect FLAGS. # Madness. export CFLAGS="$CFLAGS -O3 -fPIE" export CXXFLAGS="$CXXFLAGS -O3 -fPIE" export LDFLAGS="$LDFLAGS,-pie" scons \ DESTDIR="$pkgdir" \ PREFIX=/usr \ install # license install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" copyright }