summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7ed6b9b22400b761bd31e4ac98f1f05899f84a16 (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
96
97
98
99
100
101
102
103
104
# Maintainer:
# Contributor: Andrea Feletto <andrea@andreafeletto.com>

## useful links
# https://codeberg.org/river/river
# https://github.com/riverwm/river

## options

: ${_build_xwayland:=false}
: ${_build_git:=true}

unset _pkgtype
[ "${_build_xwayland::1}" != "t" ] && _pkgtype+="-noxwayland"
[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git"

# basic info
_pkgname="river"
pkgname="$_pkgname${_pkgtype:-}"
pkgver=0.2.6.r285.g12de175
pkgrel=1
pkgdesc='Dynamic tiling wayland compositor'
url='https://codeberg.org/river/river'
license=('GPL-3.0-only')
arch=('x86_64')

depends=(
  'libevdev'
  'libxkbcommon'
  'mesa'
  'pixman'
  'wayland'
  'wayland-protocols'
  'wlroots'
)
makedepends=(
  'git'
  'scdoc'
  'zig'
)
optdepends=(
  'polkit: access seat through systemd-logind'
)

[[ "${_build_xwayland::1}" == "t" ]] && depends+=('xorg-xwayland')

provides=("$_pkgname")
conflicts=("$_pkgname")

options=('!strip')

_pkgsrc="$_pkgname"
source=(
  'git+https://github.com/riverwm/river.git'
  'git+https://github.com/ifreund/zig-pixman.git'
  'git+https://github.com/ifreund/zig-wayland.git'
  'git+https://github.com/swaywm/zig-wlroots.git'
  'git+https://github.com/ifreund/zig-xkbcommon.git'
)
sha256sums=(
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
)

prepare() {
  cd "$_pkgsrc"
  git submodule init
  for dep in pixman wayland wlroots xkbcommon; do
    git config "submodule.deps/zig-$dep.url" "$srcdir/zig-$dep"
  done
  git -c protocol.file.allow=always submodule update
}

pkgver() {
  cd "$_pkgsrc"
  local _tag=$(git tag | sort -rV | head -1)
  local _version"=${_tag#v}"
  local _revision=$(git rev-list --count --cherry-pick "$_tag"...HEAD)
  local _hash=$(git rev-parse --short=7 HEAD)

  printf '%s.r%s.g%s' "${_version:?}" "${_revision:?}" "${_hash:?}"
}

package() {
  cd "$_pkgsrc"
  local _zig_options=(
    --prefix '/usr'
    -Doptimize=ReleaseSafe
  )

  [[ "${_build_xwayland::1}" == "t" ]] && _zig_options+=(-Dxwayland)

  DESTDIR="$pkgdir" zig build "${_zig_options[@]}"

  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -Dm644 contrib/river.desktop -t "$pkgdir/usr/share/wayland-sessions/"

  install -d "$pkgdir/usr/share/$_pkgname"
  cp --reflink=auto -fr example "$pkgdir/usr/share/$_pkgname/"
}