summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f8dcb88617243789c7c26e60f44a843db9217a7f (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
105
106
107
108
109
110
111
112
113
114
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Tilman BLUMENBACH <tilman+aur AT ax86 DOT net>

pkgname=(barrier barrier-headless)
pkgver=2.4.0
pkgrel=3
pkgdesc="Open-source KVM software based on Synergy"
arch=(x86_64)
url="https://github.com/debauchee/barrier"
license=("LicenseRef-GPL-2.0-only-WITH-OpenSSL-Exception")
changelog=CHANGELOG.rst
depends=(curl avahi libx11 libxrandr libxext
        libxinerama xorgproto libxtst libxi
        libsm libice openssl)
makedepends=(cmake git qt5-base hicolor-icon-theme)
source=("git+https://github.com/debauchee/barrier.git#tag=v${pkgver}"
        "git+https://github.com/google/googletest.git"
        "git+https://github.com/google/googlemock.git"
        "git+https://github.com/gulrak/filesystem.git"
        "1886.patch")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            '4b2e2c3c2c6524dfd3f2f1003c62e218a459291f0e6fb87a3ce56ba48a4a11fe')

prepare() {
    cd "barrier"

    git submodule init
    git config submodule.ext/gtest.url "$srcdir/googletest"
    git config submodule.ext/gmock.url "$srcdir/googlemock"
    git config submodule.ext/gulrak-filesystem.url "$srcdir/filesystem"
    git -c protocol.file.allow=always submodule update

    # lib/platform: Fix encoding for text copied between linux and windows
    # https://github.com/debauchee/barrier/commit/dd3ea8adfef868e52098ea24d2ed08320a90e3b9
    git cherry-pick -n dd3ea8adfef868e52098ea24d2ed08320a90e3b9

    # Add missing cstddef includes for NULL
    # https://github.com/debauchee/barrier/commit/4b12265ae5d324b942698a3177e1d8b1749414d7
    git cherry-pick -n 4b12265ae5d324b942698a3177e1d8b1749414d7

    # Add missing cstdint includes for GCC 13
    # https://github.com/debauchee/barrier/pull/1886
    patch -Np1 < "$srcdir/1886.patch"
}

build() {
    cd "barrier"

    mkdir -p build
    cd build

    cmake -G "Unix Makefiles" \
        -D CMAKE_BUILD_TYPE:STRING=Release \
        -D CMAKE_INSTALL_PREFIX:STRING=/usr \
        -D BARRIER_REVISION:STRING=00000000 \
        -D BARRIER_VERSION_STAGE:STRING=RELEASE \
        ..
    make
}

_package_common() {
    # Install binaries:
    cd "barrier/build"
    DESTDIR="${pkgdir}" make install

    # Install the license:
    cd ..
    install -m 644 -D LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    # Install the manpages:
    mkdir -p "${pkgdir}/usr/share/man/man1"
    install -m 644 doc/*.1 "${pkgdir}/usr/share/man/man1"

    # Install the examples:
    mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
    install -m 644 doc/barrier.conf* "${pkgdir}/usr/share/doc/${pkgname}"
}

package_barrier() {
    pkgdesc="Open-source KVM software based on Synergy (GUI)"
    depends=("barrier-headless=${pkgver}-${pkgrel}" qt5-base hicolor-icon-theme)

    # Install all the files:
    _package_common

    # Now go and delete files that are already in
    # barrier-headless:
    for file in \
        /usr/share/doc \
        /usr/share/man \
        /usr/bin/barrier{s,c} \
    ;do
        rm -rf "${pkgdir}/${file}"
    done
}

package_barrier-headless() {
    pkgdesc="Open-source KVM software based on Synergy (client and server CLI binaries)"

    # Install all the files:
    _package_common

    # Now go and delete the GUI-related files:
    for file in \
        /usr/bin/barrier \
        /usr/share/applications \
        /usr/share/icons \
    ;do
        rm -rf "${pkgdir}/${file}"
    done
}