summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fe72e9cb034a872436c7b84ec61a23f424fcbde1 (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
84
85
86
87
88
# Maintainer Severin Glöckner <severin dot gloeckner at stud dot htwk minus leipzig dot de>

_suffix=-1.12
pkgname=wesnoth-1.12
pkgver=1.12.6
pkgrel=11
pkgdesc="Turn-based strategy game on a fantasy world (legacy version)"
arch=('i686' 'x86_64')
url="https://www.wesnoth.org"
license=('GPL')
depends=('sdl' 'sdl_image' 'sdl_mixer' 'sdl_ttf' 'sdl_net' 'boost-libs' 'bzip2' 'zlib' 'libvorbis' 'pango' 'cairo' 'fontconfig' 'dbus' 'fribidi' 'readline')
makedepends=('boost' 'gettext' 'cmake')
options=('!emptydirs')
source=("https://downloads.sourceforge.net/sourceforge/wesnoth/wesnoth-$pkgver.tar.bz2"
        "wesnoth$_suffix.desktop"
        "wesnothd$_suffix.tmpfiles.conf"
        "wesnothd$_suffix.service"
        "wesnoth$_suffix.appdata.xml"
        "wesnoth-boost.patch::https://github.com/wesnoth/wesnoth/commit/789588d11e3512b3494b4aeac11b44f1c38ad86d.patch")

sha256sums=('a50f384cead15f68f31cfa1a311e76a12098428702cb674d3521eb169eb92e4e'
            'f765499315d6650fe91424c0818cc57fc9fd06108c29e78c2db987c148dbf877'
            '4d11e481ad8610bb2ad65290d2b3d1bf2d058485deaa9016325499b113e0f89f'
            'ccbfcf1516d45ce29e2416a138c0fb3ae71ab479ecb5f6f5e343d009dc933288'
            'd3f031c70e59ac544712c45e6fd9be7cd79f481aad38977e7a129e1bede54840'
            '74bfc9187b3cdd1744477ca509344a516a94c9992a4c6273ed8a9f370d96600a')

PKGEXT='.pkg.tar'

prepare() {
  cd wesnoth-$pkgver

  patch -Np1 < ${srcdir}/wesnoth-boost.patch
}

build() {
  # As this is an older version and not worked on anymore, it will someday break
  # If you happen to find a fix, please fill a Pull Request for the 1.12 branch
  # at bugs.wesnoth.org

  # silence compiler warnings - they are not going to be fixed
  export CFLAGS="$CFLAGS -w"
  export CXXFLAGS="$CXXFLAGS -w"

  rm -rf build && mkdir build && cd build
  cmake ../wesnoth-$pkgver \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DBINARY_SUFFIX=-1.12 \
      -DDATADIRNAME=wesnoth-1.12 \
      -DDOCDIR=share/doc/wesnoth-1.12 \
      -DFIFO_DIR=/run/wesnothd-1.12 \
      -DPREFERENCES_DIR=.local/share/wesnoth/1.12 \
      -DENABLE_OMP=ON \
      -DENABLE_DESKTOP_ENTRY=OFF \
      -DENABLE_DISPLAY_REVISION=OFF \
      -Wno-dev # silence cmake warnings
  make -j 4
}

package() {
  cd build

  make DESTDIR="$pkgdir" install

  # add suffix to manpages
  cd "$pkgdir/usr/share/man"
  for filename in man6/wesnoth.6 */man6/wesnoth.6 man6/wesnothd.6 */man6/wesnothd.6
    do
      mv "$filename" $(dirname $filename)/$(basename $filename .6)-1.12.6
  done

  # better use the tools from the newest version of wesnoth
  rm -r "$pkgdir/usr/share/wesnoth$_suffix/data/tools"

  # these translation files are not needed
  find "$pkgdir/usr/share/wesnoth$_suffix/translations" -name wesnoth-manpages.mo -delete
  find "$pkgdir/usr/share/wesnoth$_suffix/translations" -name wesnoth-manual.mo -delete

  # placing relevant packaging files (launcher, icons, systemd and appdata files)
  install -D -m644 "$srcdir/wesnoth$_suffix.desktop" "$pkgdir/usr/share/applications/wesnoth$_suffix.desktop"
  install -D -m644 "$srcdir/wesnoth-$pkgver/images/game-icon.png" "$pkgdir/usr/share/icons/hicolor/64x64/apps/$pkgname-icon.png"
  install -D -m644 "$srcdir/wesnoth-$pkgver/data/core/images/wesnoth-icon.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/$pkgname-icon.png"

  install -D -m644 "$srcdir/wesnothd$_suffix.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/wesnothd$_suffix.conf"
  install -D -m644 "$srcdir/wesnothd$_suffix.service" "$pkgdir/usr/lib/systemd/system/wesnothd$_suffix.service"

  install -D -m644 "$srcdir/wesnoth$_suffix.appdata.xml" "$pkgdir/usr/share/metainfo/wesnoth$_suffix.appdata.xml"
}