summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 89dac7d899eb93efa3b6d206e44f5ab573458649 (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
# Maintainer:
# Contributor: xiretza <xiretza+aur@xiretza.xyz>
# Contributor: Falk Alexander Seidl <fa@terminal.run>

_pkgname="fractal"
pkgname="fractal-git"
pkgver=9.r171.g07f36e2
pkgrel=1
pkgdesc="Matrix messaging app for GNOME written in Rust"
url="https://gitlab.gnome.org/World/fractal"
license=('GPL-3.0-only')
arch=('i686' 'x86_64')

depends=(
  'gst-plugins-base-libs'
  'gtk4'
  'gtksourceview5'
  'libadwaita'
  'libpipewire'
  'libshumate'
  'libwebp'
)
makedepends=(
  'clang'
  'git'
  'meson'
  'rust'
  'sass'
  'xdg-desktop-portal'
)

provides=("$_pkgname=${pkgver%%.g*}")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

_rust_env() {
  # NOTE: upstream uses a custom CARGO_HOME from within meson
  export CARGO_HOME="$srcdir/build/cargo-home"
  export RUSTUP_TOOLCHAIN=stable
}

prepare() {
  _rust_env

  # speed up compilation
  sed -E \
    -e 's&^(\s*debug) = .*$&\1 = false&' \
    -e 's&^(\s*codegen-units) = .*$&\1 = 8&' \
    -i "$_pkgsrc/Cargo.toml"

  cd "$_pkgsrc"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  _rust_env
  CFLAGS+=" -ffat-lto-objects"
  arch-meson "$_pkgsrc" build
  meson compile -C build
}

check() {
  _rust_env
  meson test -C build --print-errorlogs
}

package() {
  _rust_env
  # NOTE: explicitly prevent rebuild: https://gitlab.gnome.org/GNOME/fractal/-/issues/1327
  meson install -C build --destdir "$pkgdir" --no-rebuild
}