summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cd4f5c8cbf8e21160d90904e6760c3a41a8929ea (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
# Maintainer:
# Contributor: Alexey Andreyev <aa13q@ya.ru>
# Contributor: Aleksandar Trifunović <akstrfn at gmail dot com>
# Contributor: Ivan Semkin <ivan at semkin dot ru>

## links
# https://matrix.org/
# https://github.com/quotient-im/Quaternion

## options
: ${_commit:=b8ccb715ecbc8214bc2d13ee794f8722327984dc} # 0.0.96.1

_pkgname="quaternion"
pkgname="$_pkgname"
pkgver=0.0.96.1
pkgrel=4
pkgdesc='Qt-based IM client for the Matrix protocol'
url="https://github.com/quotient-im/Quaternion"
license=('GPL-3.0-or-later' 'LGPL-2.1-or-later')
arch=('aarch64' 'i686' 'x86_64')

depends=(
  libolm
  qt6-declarative
  qt6-multimedia
  qtkeychain-qt6
)
makedepends=(
  clang
  cmake
  git
  ninja
  qt6-tools
)

options=('!emptydirs')

_pkgsrc="$_pkgname"
source=(
  "$_pkgsrc"::"git+$url.git#commit=$_commit"

  # submodules for quaternion
  "libquotient"::'git+https://github.com/quotient-im/libQuotient'
)
sha256sums=(
  'SKIP'
  'SKIP'
)

_prepare_quaternion() (
  cd "$_pkgsrc"
  local _submodules=(
    'libquotient'::'lib'
  )
  _submodule_update
)

prepare() {
  _submodule_update() {
    local _module
    for _module in "${_submodules[@]}"; do
      git submodule init "${_module##*::}"
      git submodule set-url "${_module##*::}" "$srcdir/${_module%::*}"
      git -c protocol.file.allow=always submodule update "${_module##*::}"
    done
  }

  _prepare_quaternion
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_INSTALL_PREFIX="/usr"
    -DCMAKE_BUILD_TYPE=None
    -DBUILD_WITH_QT6=ON
    -DUSE_INTREE_LIBQMC=ON
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  depends+=(
    hicolor-icon-theme
  )

  DESTDIR="$pkgdir" cmake --install build

  # conflicts with extra/libquotient
  rm "$pkgdir/usr/lib/libQuotientQt6.a"
  rm "$pkgdir/usr/lib/pkgconfig/QuotientQt6.pc"
  rm "$pkgdir/usr/share/ndk-modules/Android.mk"
  rm -rf "$pkgdir/usr/include/Quotient"
  rm -rf "$pkgdir/usr/lib/cmake/QuotientQt6"
}