summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8e76f80201ceb4a91c85e0d27af24394bd5012e6 (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
# Maintainer: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG

pkgname=ecwolf-hg
pkgver=1.3.3.r3.f002d4054728
pkgrel=1
pkgdesc='Advanced source port of "Wolfenstein 3D" and "Spear of Destiny" based on Wolf4SDL (development version)'
arch=('i686' 'x86_64')
url="http://maniacsvault.net/ecwolf"
license=('GPL' 'custom: ID')
provides=('ecwolf')
conflicts=('ecwolf')
depends=('sdl_net' 'libvorbis' 'flac' 'opusfile' 'libmikmod' 'fluidsynth' 'libjpeg' 'gtk2')
makedepends=('mercurial' 'cmake')
optdepends=('wolf3d-shareware: Demo version of Wolfenstein 3D')
install=ecwolf.install
source=("hg+https://bitbucket.org/Blzut3/ecwolf"
        "hg+https://bitbucket.org/Blzut3/sdl_mixer-for-ecwolf"
        "ecwolf-datadirs.patch")
sha256sums=('SKIP'
            'SKIP'
            '46d59c0a25e34e32fc73cef60c146103cb3e57bc7c904c048371c3eccb89e183')

pkgver() {
  cd ecwolf
  local _tag=$(hg tags -q | sort -r | grep "^[0-9]\.[0-9]" | head -n1)
  local _commits=$(hg log --template "{node}\n" -r $_tag:tip | wc -l)
  local _hash=$(hg identify -i | sed "s/+//")
  printf "%s.r%s.%s" "$_tag" "$_commits" "$_hash"
}

prepare() {
  # reset build folders
  rm -rf build mixer-build
  mkdir build mixer-build

  # data dir hack (using a patch, so we can see it fail, when the source has changed)
  patch -Np0 < ecwolf-datadirs.patch
}

build() {
  msg2 "Building custom SDL_mixer..."
  cd mixer-build
  cmake ../sdl_mixer-for-ecwolf
  make

  msg2 "Building ecwolf..."
  cd ../build
  # build patch utility, enable gpl licensed opl emulator and force custom SDL2_mixer with dependency libraries
  cmake ../ecwolf -DBUILD_PATCHUTIL=ON -DGPL=ON \
    -DSDLMIXER_INCLUDE_DIR="$srcdir/sdl_mixer-for-ecwolf" \
    -DSDLMIXER_LIBRARY="$srcdir/mixer-build/libSDL_mixer.a;-lfluidsynth;-lvorbisfile;-lvorbis;-lopusfile;-lopus;-lFLAC;-lmikmod;-logg"
  make
}

package() {
  cd build

  # binaries
  install -Dm755 ecwolf "$pkgdir"/usr/bin/ecwolf
  install -m755 tools/patchutil/patchutil "$pkgdir"/usr/bin/ecwolf-patchutil
  # data
  install -Dm644 ecwolf.pk3 "$pkgdir"/usr/share/ecwolf/ecwolf.pk3
  cd ../ecwolf
  # doc
  install -d "$pkgdir"/usr/share/doc/ecwolf-hg
  install -Dm644 README.* "$pkgdir"/usr/share/doc/ecwolf-hg
  # license
  install -Dm644 docs/license-id.txt "$pkgdir"/usr/share/licenses/ecwolf-hg/license-id.txt
}