summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e46a71462c45ca6393972c17c06c9d699d36b2a7 (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
89
90
91
92
93
94
95
# Maintainer: George Rawlinson <george@rawlinson.net.nz>

pkgname=nanosaur2
pkgver=2.1.0
pkgrel=2
pkgdesc='Sequel to the original Nanosaur'
arch=('x86_64')
url='https://github.com/jorio/Nanosaur2'
license=('custom:CC-BY-NC-SA-4.0')
depends=(
  'glibc'
  'gcc-libs'
  'libglvnd'
  'sdl2'
  'hicolor-icon-theme'
)
makedepends=('git' 'cmake')
_commit='3739005d3a505f6072b6b4e5b2d1874a4bd34acb'
source=(
  "$pkgname::git+https://github.com/jorio/Nanosaur2.git#commit=$_commit"
  'github.com-jorio-Pomme::git+https://github.com/jorio/Pomme'
  "$pkgname.desktop"
  "$pkgname.sh"
)
sha512sums=('SKIP'
            'SKIP'
            '1ce25c64507b08c6ca9075a56a75f93efc19f1aa9e1e86fbe9f5967940aae438bc4839e4b47326fc8c0f3ba6211ceecff32982582bae9896c5ef05bcdf8ab410'
            '64f7eb3572774ad58608bf0de5e3a9994fe14ba6b2065225540f02e0b7f4ff5ff308d81a730970eaae97c17efc85904dc559ce4e84bc445b37a69e529ddc6696')
b2sums=('SKIP'
        'SKIP'
        'e41fd1bc5e7aa9af7f7bc5c13400f947c9837a54d716ea6cfcb1319a539ed20e7cc9775a6add851a6bc9670ebb34db2191576ebde240a49be23766e5274fe3f5'
        'cfa74a2b52b6b45a10c9f30e7f0bc4e81add9eab68aa9c83ba58737fdfb2dd881151ab72e2bfe87abd1a302fbfce5a813d0c3c77781e6c164049d6bb3c7ab549')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  # setup git submodules
  git submodule init
  git config submodule.Pomme.url "$srcdir/github.com-jorio-Pomme"
  git -c protocol.file.allow=always submodule update

  # ftbfs: gcc 13 & cstdint headers
  cd extern/Pomme
  git cherry-pick --no-commit d57c28e205462e51063e787f9ebddaadff592f1e
}

build() {
  cd "$pkgname"

  cmake \
    -S . \
    -B build \
    -D CMAKE_BUILD_TYPE=None \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -W no-dev

  cmake --build build
}

package() {
  # binary & assets
  install -dv "$pkgdir/usr/lib/$pkgname"
  cp -vr "$pkgname"/build/{Data,Nanosaur2} "$pkgdir/usr/lib/$pkgname"

  # wrapper script for $PATH execution
  install -vDm755 "$pkgname.sh" "$pkgdir/usr/bin/$pkgname"

  # desktop file & icon
  install -vDm644 \
    -t "$pkgdir/usr/share/applications" \
    "$pkgname.desktop"
  install -vDm644 \
    "$pkgname/packaging/nanosaur2-desktopicon.png" \
    "$pkgdir/usr/share/icons/hicolor/512x512/apps/$pkgname.png"

  cd "$pkgname"

  # documentation
  install -vDm644 \
    -t "$pkgdir/usr/share/doc/$pkgname" \
    {CHANGELOG,README,SECRETS}.md screenshot.webp
  cp -vr docs "$pkgdir/usr/share/doc/$pkgname"
  sed -e "s/@PROJECT_VERSION@/$pkgver/" \
    packaging/ReadMe.txt.in \
    > "$pkgdir/usr/share/doc/$pkgname/ReadMe.txt"

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.md
}