summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d2e748d167f66b0eb027b7f82f02c7e04593e18a (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
# Maintainer: z3n <z3nlabs at proton dot me>

pkgname=fcp-support-git
_pkgname=fcp-support
pkgver=r50.8313436
pkgrel=1
pkgdesc="Focusrite Control Protocol user-space driver for Scarlett 4th Gen big models (16i16, 18i16, 18i20)"
arch=('x86_64')
url="https://github.com/geoffreybennett/fcp-support"
license=('GPL-3.0-or-later')
depends=(
    'alsa-lib'
    'systemd-libs'
    'openssl'
    'zlib'
    'json-c'
)
makedepends=(
    'git'
    'pkgconf'
)
optdepends=(
    'alsa-scarlett-gui-git: GUI for controlling Focusrite interfaces'
    'scarlett4-firmware: Firmware files for Scarlett 4th Gen (required for first-time setup)'
    'polkit: Passwordless start/stop of fcp-server for audio group users (recommended)'
)
provides=("$_pkgname")
conflicts=("$_pkgname")
install=$pkgname.install
source=("git+${url}.git#branch=1.0beta")
sha256sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    # Get version from git tags
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "$srcdir/$_pkgname"

    # Build with proper version string and PREFIX
    VERSION="$(git describe --abbrev=4 --dirty --always --tags 2>/dev/null || echo 'Unknown')" \
    PREFIX=/usr \
    make
}

package() {
    cd "$srcdir/$_pkgname"

    # Install to /usr instead of /usr/local
    make install \
        PREFIX=/usr \
        DESTDIR="$pkgdir"

    # Install polkit rule to allow audio group to manage fcp-server without password
    # This enables alsa-scarlett-gui to auto-start the server seamlessly
    install -Dm644 /dev/stdin \
        "$pkgdir/usr/share/polkit-1/rules.d/50-fcp-server.rules" <<'EOF'
// Allow audio group members to start/stop fcp-server without authentication
// This enables seamless integration with alsa-scarlett-gui
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.systemd1.manage-units" &&
        action.lookup("unit").match(/^fcp-server@[0-9]+\.service$/) &&
        subject.isInGroup("audio")) {
        return polkit.Result.YES;
    }
});
EOF
}