summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7af3ca7d4c824b31fc274b4b88e077417c93fa89 (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
# Maintainer: James Tucker <jftucker@gmail.com>
# Contributor: Chris Sutcliff <chris@sutcliff.me>
# Contributor: Jonathan Bangert <jonathan@bangert.dk>
pkgname=music-assistant-desktop
pkgver=0.7.2
pkgrel=1
pkgdesc="Music Assistant Desktop Companion App"
arch=('x86_64')
url="https://github.com/music-assistant/desktop-app"
license=('Apache-2.0')
depends=(
    'alsa-lib'
    'cairo'
    'dbus'
    'gdk-pixbuf2'
    'glib2'
    'glibc'
    'gtk3'
    'hicolor-icon-theme'
    'libgcc'
    'libpulse'
    'libsoup3'
    'openssl'
    'libayatana-appindicator'
    'webkit2gtk-4.1'
)
makedepends=(
    'cargo'
    'cargo-tauri'
    'curl'
    'file'
    'librsvg'
    'rust'
    'wget'
)
conflicts=('music-assistant-desktop-git' 'music-assistant-desktop-bin' 'music-assistant-companion-git' 'music-assistant-app-git' 'music-assistant-desktop-app-git')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('185bd211e3141a78dace1bd7671b44e7dd141ff3f2fbbc560b92286a91c38c61')
# Never let makepkg put -flto in CFLAGS/CXXFLAGS/LDFLAGS here. The C sources
# pulled in through build.rs ('cc' crate) are compiled by gcc and emit GNU IR,
# which rust-lld cannot consume, so the final link fails on unresolved symbols.
# It surfaces as an opaque ring build failure, but the cause is the mixed
# GCC/LLVM IR, not ring: https://github.com/briansmith/ring/issues/2746
# Rust-side LTO is a separate setting and is unaffected by this.
options=('!lto')

prepare() {
    cd "$srcdir/desktop-app-$pkgver"
    export CARGO_HOME="$srcdir/cargo-home"
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" --manifest-path src-tauri/Cargo.toml

    # The in-repo .desktop omits StartupWMClass, so the running window does not
    # associate with the launcher entry. Tauri's own generated entry (see the
    # upstream .deb) sets it. Drop this once upstream ships it.
    grep -q '^StartupWMClass=' music-assistant.desktop ||
        echo 'StartupWMClass=music-assistant-companion' >> music-assistant.desktop
}

build() {
    cd "$srcdir/desktop-app-$pkgver"
    export CARGO_HOME="$srcdir/cargo-home"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR="$srcdir/target"

    # Enable debug info so makepkg can split it into the -debug package
    export CARGO_PROFILE_RELEASE_DEBUG=2

    cargo tauri build --no-bundle
}

package() {
    cd "$srcdir/desktop-app-$pkgver"

    # Install binary
    install -Dm755 "$srcdir/target/release/music-assistant-companion" \
        "$pkgdir/usr/bin/music-assistant-companion"

    # Install the tauri.conf.json "resources" (translations). Tauri resolves
    # resource_dir() to /usr/lib/<productName> on Linux, which is where the
    # upstream deb puts them too. Only en.json is compiled into the binary.
    install -Dm644 -t "$pkgdir/usr/lib/Music Assistant/resources/translations" \
        src-tauri/resources/translations/*.json

    # Install desktop file. Since 0.6.2 the MPRIS root object advertises
    # DesktopEntry="Music Assistant", so the entry has to be installed under
    # that basename for media controls to resolve the app. This matches the
    # upstream .deb.
    install -Dm644 music-assistant.desktop \
        "$pkgdir/usr/share/applications/Music Assistant.desktop"

    # Install icons
    install -Dm644 src-tauri/icons/32x32.png \
        "$pkgdir/usr/share/icons/hicolor/32x32/apps/music-assistant-companion.png"
    install -Dm644 src-tauri/icons/128x128.png \
        "$pkgdir/usr/share/icons/hicolor/128x128/apps/music-assistant-companion.png"
    install -Dm644 src-tauri/icons/128x128@2x.png \
        "$pkgdir/usr/share/icons/hicolor/256x256/apps/music-assistant-companion.png"
    install -Dm644 app-icon.png \
        "$pkgdir/usr/share/icons/hicolor/512x512/apps/music-assistant-companion.png"

    # Install license
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}