summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 1ec22513d9793ca3f33500c050e3b273a620a4ae (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
78
79
80
81
82
83
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Kyle Keen <keenerd@gmail.com>

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

pkgbase=cataclysm-dda
pkgname=(cataclysm-dda cataclysm-dda-tiles)
pkgname=cataclysm-dda
pkgver=0.D
pkgrel=1
pkgdesc="A post-apocalyptic roguelike."
#url="http://cataclysmrl.blogspot.com/"
#url="http://www.cataclysm.glyphgryph.com/"
#url="http://en.cataclysmdda.com/"
url="https://cataclysmdda.org/"
arch=('x86_64')
license=("CCPL:by-sa")
depends=('ncurses' 'lua' 'hicolor-icon-theme' 'gettext')
makedepends=('sdl2_image' 'sdl2_ttf' 'sdl2_mixer' 'freetype2' 'astyle')
source=("$pkgname-$pkgver.tar.gz::https://github.com/CleverRaven/Cataclysm-DDA/archive/$pkgver.tar.gz")
sha256sums=('6cc97b3e1e466b8585e8433a6d6010931e9a073f6ec060113161b38052d82882')

# official docs say to use lua51
# but makefile supports lua52?
# lua53 works, but git HEAD detects/uses lua51?

prepare() {
  cd "Cataclysm-DDA-$pkgver"
  sed -i 's/-Werror//' Makefile
  sed -i 's/ncursesw5-config/ncursesw6-config/' Makefile
  #sed -i 's|"\(l.*h\)"|"lua5.1/\1"|' src/catalua.{h,cpp}
  sed -i 's/shell git/shell false/' Makefile
}

build() {
  cd "Cataclysm-DDA-$pkgver"

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

  # tests "ifdef TILES" so "TILES=0" will enable tiles!
  # DYNAMIC_LINKING appears to be a windows flag?
  make PREFIX=/usr RELEASE=1 USE_XDG_DIR=1 BACKTRACE=0 ZLEVELS=1 LUA=1
  make PREFIX=/usr RELEASE=1 USE_XDG_DIR=1 BACKTRACE=0 ZLEVELS=1 LUA=1 TILES=1 SOUND=1
  #LUA_BINARY="/usr/bin/lua5.1"
}

package_cataclysm-dda() {
  cd "Cataclysm-DDA-$pkgver"

  make DESTDIR="$pkgdir" PREFIX="/usr" RELEASE=1 ZLEVELS=1 USE_HOME_DIR=1 LUA=1 install

  # Docs
  install -d "$pkgdir/usr/share/doc/cataclysm-dda"
  cp -r doc/* "$pkgdir/usr/share/doc/cataclysm-dda"
  # undo symlink
  rm "$pkgdir/usr/share/doc/cataclysm-dda/JSON_LOADING_ORDER.md"
  cp 'data/json/LOADING_ORDER.md' "$pkgdir/usr/share/doc/cataclysm-dda/JSON_LOADING_ORDER.md"

  # License
  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_cataclysm-dda-tiles() {
  pkgdesc="A graphical post-apocalyptic roguelike."
  depends=('cataclysm-dda' 'sdl2_image' 'sdl2_ttf' 'freetype2' 'sdl2_mixer')
  cd "Cataclysm-DDA-$pkgver"

  make DESTDIR="$pkgdir" PREFIX="/usr" RELEASE=1 ZLEVELS=1 LUA=1 TILES=1 SOUND=1 install

  # Icon
  install -D 'data/osx/AppIcon.iconset/icon_128x128.png' "$pkgdir/usr/share/icons/hicolor/128x128/apps/cataclysm-dda.png"

  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  # hack: remove overlapping files
  cd "$pkgdir/../cataclysm-dda"
  find . -type f -exec rm -f "$pkgdir"/{} \;
  cd "$pkgdir"
  find . -type d -empty -delete
}