summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 458607644293a402f0f521e30677648bcbc3ba49 (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
# Maintainer: Alexey Andreyev <aa13q@ya.ru>
# Contributor: Sefa Eyeoglu <contact@scrumplex.net>

pkgname=libquotient-git
pkgver=0.6.0.r387.g7036ed0
pkgrel=1
pkgdesc="A Qt5 library to write cross-platform clients for Matrix"
arch=(x86_64)
url="https://github.com/quotient-im/libQuotient"
license=("LGPL2")
depends=("qt5-base" "qt5-multimedia")
optdepends=("qt5-olm-git")
makedepends=("git" "cmake" "make" "gcc")
provides=("libquotient")
conflicts=("libquotient")
source=("${pkgname}::git+https://github.com/quotient-im/libQuotient.git")
sha512sums=("SKIP")


# Thanks to Morguldir <morguldir@protonmail.com> for this!
pkgver() {
    cd "$pkgname"

    _info="$(git blame -s CMakeLists.txt | grep set\(API)"
    _commit="$(echo $_info | awk '{print $1}')"
    _ver="$(echo $_info | awk '{print $4}' | sed s/[^0-9.]//g)"
    _patch_ver="$(git blame -p CMakeLists.txt | grep project\(Quotient | sed s/[^0-9]//g)"
    _revisions="$(git rev-list --count $_commit..HEAD)"
    _current_commit="$(git log --pretty=format:'%h' -n 1)"
    printf "%s.%d.r%d.g%s" $_ver $_patch_ver $_revisions $_current_commit
}

prepare() {
    mkdir -p "build"
}

build() {
    cd "build"
    cmake ../${pkgname} \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_SHARED_LIBS=1

    make
}

package() {
    cd "build"
    make DESTDIR="${pkgdir}" install

    cd "../$pkgname"
    install -Dm 644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}