summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b3212a6a4b71586664c9d26bd03f79bf2a1e27bf (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
pkgname=openblack-git
pkgver=r1012.b2a2147
pkgrel=1
pkgdesc="Open source reimplementation of the game Black & White (2001)."
arch=('x86_64')
url="https://github.com/openblack/openblack"
license=('GPL3' 'MIT')

depends=('fmt' 'spdlog' 'entt' 'sdl2' 'glm')
makedepends=('git' 'cmake')
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}")

# TODO: After bgfx merges all openblack PRs,
# Package and use bgfx instead of building it
source=('git://github.com/openblack/openblack.git'
        'git://github.com/openblack/bgfx.cmake.git'
        'git://github.com/bkaradzic/bx.git'
        'git://github.com/bkaradzic/bimg.git'
        'git://github.com/openblack/bgfx.git')
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

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

prepare() {
  cd "${srcdir}/bgfx.cmake"
  git config --file=.gitmodules submodule.bx.url "${srcdir}"/bx
  git config --file=.gitmodules submodule.bimg.url "${srcdir}"/bimg
  git config --file=.gitmodules submodule.bgfx.url "${srcdir}"/bgfx
  git submodule sync
  git submodule update --init
}

build() {
  msg Building bgfx
  cd "${srcdir}/bgfx.cmake"
  cmake -DBGFX_BUILD_EXAMPLES=OFF \
        -DCMAKE_INSTALL_PREFIX=install \
        -DBGFX_CUSTOM_TARGETS=OFF \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
  cmake --build .
  cmake --install .

  msg Building openblack
  cd "${srcdir}/${pkgname%-git}"
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -Dbgfx_DIR="${srcdir}/bgfx.cmake/install/lib/cmake/bgfx" \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
  cmake --build .
}

package() {
  cd "${srcdir}/${pkgname%-git}"
  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et: