summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 624fd4573a38e0336998f1ebf495422d911e754b (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
# Maintainer : bwrsandman
# Co-Maintainer: Lone_Wolf <lone_wolf@klaas-de-kat.nl>
# thanks to txtsd <aur.archlinux@ihavea.quest> for contributing some parts of the PKGBUILD code

pkgname=openmw-git
pkgver=0.48.0.r5496.g8471cfb576
pkgrel=1
pkgdesc="An open-source engine reimplementation for the role-playing game Morrowind."
arch=('i686' 'x86_64' 'aarch64')
url="http://www.openmw.org"
license=(' 	GPL-3.0-or-later' 'MIT' 'custom')
# openmw doesn't work with ffmpeg 7 , only reliable solution for now is to use ffmpeg4.4 instead
# see https://gitlab.com/OpenMW/openmw/-/issues/8035 and https://gitlab.com/OpenMW/openmw/-/issues/7182
depends=('openal' 'openscenegraph-openmw-git' 'mygui-openmw' 'bullet-dp' 'qt6-base' 'qt6-svg' 'ffmpeg4.4' 'sdl2' 'unshield' 'libxt' 'boost-libs' 'luajit' 'recastnavigation-openmw' 'yaml-cpp' 'sqlite')
makedepends=('git' 'cmake' 'boost' 'debugedit' 'qt6-tools')
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}")
source=('git+https://gitlab.com/OpenMW/openmw.git')
sha1sums=('SKIP')

pkgver() {
  cd "${srcdir}/${pkgname%-git}"
  _tag="$(git describe --tags $(git rev-list --tags --max-count=1))"
  # We want the latest/highest minor version for _tag
  # First we strip off any openmw-*
  # There must be no dashes.
  # We remove any other words such as rc
  # Finally, if there is no major or patch number, add 0
  # Test using this script:
  # $ declare -a test_tags=("openmw-0.29.0" "0.42.0" "0.42.1" "1.42.1" "0.47.0-RC3" "openmw-48-rc10")
  # for _tag in "${test_tags[@]}"; do
  #     _fixed_tag=$(echo $_tag | sed 's/^openmw-//' | sed 's/-.*//' | sed -E 's/^([0-9]+)$/0.\1.0/')
  #     echo "$_tag -> $_fixed_tag"
  # done
  # Expected output:
  # openmw-0.29.0 -> 0.29.0
  # 0.42.0 -> 0.42.0
  # 0.42.1 -> 0.42.1
  # 1.42.1 -> 1.42.1
  # 0.47.0-RC3 -> 0.47.0
  # openmw-48-rc10 -> 0.48.0
  _fixed_tag=$(echo $_tag | sed 's/^openmw-//' | sed 's/-.*//' | sed -E 's/^([0-9]+)$/0.\1.0/')
  _numcommits="$(git rev-list  $(git rev-list --tags --no-walk --max-count=1)..HEAD --count)"
  _hash="$(git rev-parse --short HEAD)"
  printf "%s.r%s.g%s" "$_fixed_tag" "$_numcommits" "$_hash"
}

build() {

  # Use Workaround for ffmpeg4.4 from https://gitlab.com/OpenMW/openmw/-/issues/6631#note_848732223
  export PKG_CONFIG_LIBDIR='/usr/lib/ffmpeg4.4/pkgconfig/'
  cmake \
        -B _build \
        -S "${srcdir}/${pkgname%-git}"  \
        -D CMAKE_INSTALL_PREFIX=/usr \
        -D CMAKE_BUILD_TYPE=RelWithDebInfo \
        -D OPENMW_USE_SYSTEM_RECASTNAVIGATION=ON \
        -D LICDIR=/usr/share/licenses/${pkgname}
  make -C _build
}

package() {
  make DESTDIR="$pkgdir" -C _build install
  install -Dm 644 "${pkgname%-git}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

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