summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3734b5cae14a849e549f01feda2c9404221b3861 (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
# Maintainer: Markus Hartung <mail@hartmark.se>

pkgname=openapoc-git
_pkgname=openapoc
pkgver=r3905.3ce2def9
pkgrel=1
pkgdesc='OpenApoc is an open-source re-implementation of the original X-COM: Apocalypse'
arch=('x86_64')
url='https://github.com/OpenApoc/OpenApoc'
license=('GPL-3.0-only')
depends=(libvorbis sdl2 libunwind libglvnd boost-libs glibc gcc-libs bash)
makedepends=(git cmake base-devel)
source=("${pkgname}::git+https://github.com/OpenApoc/OpenApoc.git")
sha256sums=('SKIP')
conflicts=()
provides=(openapoc)

prepare() {
  if [ ! -f ../cd.iso ]; then
    echo "cd.iso from X-Com: Apocalypse needs to be in this folder:"
    echo `realpath "$PWD/.."`
    exit 42
  fi

  cd "${pkgname}"
  git submodule update --init --recursive

  mkdir data > /dev/null 2>&1 || echo -n
  cp ../../cd.iso data
}

pkgver() {
  cd "${pkgname}"
  printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${srcdir}/${pkgname}"
  mkdir build > /dev/null 2>&1 || echo -n
  cd build
  cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  make
}

package() {
 cd "${srcdir}/${pkgname}"

 mkdir -p "$pkgdir/usr/share/$_pkgname"
 cp -dpr --no-preserve=ownership data "$pkgdir/usr/share/$_pkgname/data"
 install -Dm755 build/bin/OpenApoc "$pkgdir/usr/share/$_pkgname/$_pkgname"

 mkdir -p "$pkgdir/usr/bin"
 cat <<EOF > "$pkgdir/usr/bin/$_pkgname"
#!/bin/sh
/usr/share/openapoc/openapoc --Game.Save.Directory "${HOME}/.local/share/openapoc" --Framework.Data /usr/share/openapoc/data --Framework.CD /usr/share/openapoc/data/cd.iso --Game.ModPath /usr/share/openapoc/data/mods
EOF
 chmod +x "$pkgdir/usr/bin/$_pkgname"
}