summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 73376235557242ae46936c93f67ba6ef7e115b0d (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
# Maintainer: Dennis Herbrich (Gyroplast) <dennis.herbrich@veloxis.de>
# Contributor: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG

pkgname=dunedynasty
pkgver=1.6.2
pkgrel=1
pkgdesc="Maintained fork of an enhanced continuation of the classic real-time strategy game Dune II"
url="https://github.com/gameflorist/dunedynasty"
arch=('i686' 'x86_64')
license=('GPL-2.0-only')
depends=(
  'allegro'
  'alsa-lib'
  'enet'
  'libgl'
)
makedepends=('cmake')
optdepends=(
  'fluidsynth: MIDI music support alternative'
  'soundfont-fluid: soundfont for fluidsynth'
  'timidity++: MIDI music support alternative'
  'timidity-freepats: patch set for timidity++'
  'libmad: MP3 music support'
)
install="${pkgname}.install"
changelog=CHANGELOG.md
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/gameflorist/dunedynasty/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('97ca7af2423279674e4ac290a1c7d6ae85ad8a58b56108c8acceae829086a40f')

prepare() {
  cd "${pkgname}-${pkgver}"

  # change doc directory to Archlinux conventions
  sed \
    -e 's|DESTINATION "doc/dunedynasty-${DUNE_DYNASTY_VERSION}")|DESTINATION "share/doc/dunedynasty")|' \
    -i CMakeLists.txt

  # default config settings for Archlinux in sample file
  sed \
    -e "s|^\s*\;\?s*sound_font\s*=\s*.*|sound_font=/usr/share/soundfonts/default.sf2|" \
    -i dist/dunedynasty.cfg-sample
}

build() {
  cd "${pkgname}-${pkgver}"

  # allow format-security errors in existing codebase until fixed upstream
  CFLAGS="${CFLAGS} -Wno-error=format-security" \
  cmake \
    -S "${srcdir}/${pkgname}-${pkgver}" \
    -B "${srcdir}/${pkgname}-${pkgver}/build" \
    -DOpenGL_GL_PREFERENCE=GLVND \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DDUNE_DATA_DIR="/usr/share/${pkgname}"

  cmake \
    --build "${srcdir}/${pkgname}-${pkgver}/build" \
    --config Release
}

package() {
  cd "${pkgname}-${pkgver}"

  DESTDIR="${pkgdir}" cmake \
    --install "${srcdir}/${pkgname}-${pkgver}/build" \
    --config Release

  # remove common license file
  rm -f "${pkgdir}/usr/share/doc/${pkgname}/LICENSE.txt"

  # desktop file and icon
  install -Dm644 src/video/dune2_32x32.xpm "${pkgdir}/usr/share/pixmaps/${pkgname}.xpm"
  install -Dm644 "dist/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
}