summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6a70babf574a42d9f5b43a31bbfa138deb666553 (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: Roald Clark <roaldclark@gmail.com>

_pkgname=rune-player
pkgname=rune-player-git
pkgver=0.0.0.dev.12.r8.g814baab
pkgrel=1
pkgdesc="The player that blends classic design with modern technology"
arch=('x86_64')
url="https://github.com/Losses/rune"
license=('MPL-2.0')
depends=(
    'alsa-lib'
    'at-spi2-core'
    'cairo'
    'dbus'
    'fontconfig'
    'gcc-libs'
    'gdk-pixbuf2'
    'glib2'
    'glibc'
    'gtk3'
    'harfbuzz'
    'hicolor-icon-theme'
    'libepoxy'
    'pango'
    'zlib'
)
makedepends=(
    'flutter-intellij-patch'
    'flutter-target-linux'
    'flutter-tool'
    'git'
    'patchelf'
    'protobuf'
    'protoc-gen-dart'
    'protoc-gen-prost'
    'rustup'
)
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
options=(!lto)
source=(
    "${_pkgname}::git+${url}.git"
    "rune-player.desktop"
)
sha256sums=('SKIP'
            'c15f664477a7d1ed4f6b040cc348d5bfc43884b44722bc2598b79d36139811c1')

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd "${srcdir}/${_pkgname}"
    flutter pub get
}

build() {
    cd "${srcdir}/${_pkgname}"
    export LDFLAGS="${LDFLAGS} -Wl,--no-as-needed"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    flutter pub run rinf message
    flutter build linux --no-pub --release --verbose
}

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

    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"

    pushd assets/icons
    find . \( -path "./fluent" -o -path "./macos" \) -prune -o -type f -exec install -v -Dm644 {} $pkgdir/usr/share/icons/{} \;
    cd Papirus
    find . -type f -exec install -v -Dm644 {} $pkgdir/usr/share/icons/hicolor/{} \;
    popd
    ln -sfrv $pkgdir/usr/share/icons/Papirus $pkgdir/usr/share/icons/Papirus-Dark
    ln -sfrv $pkgdir/usr/share/icons/Papirus $pkgdir/usr/share/icons/Papirus-Light
    ln -sfrv $pkgdir/usr/share/icons/breeze/apps/1024/rune.png $pkgdir/usr/share/icons/rune.png

    cd build/linux/x64/release/bundle
    install -Dm755 player "$pkgdir/usr/lib/$_pkgname/rune"
    pushd lib
    find . -type f -exec install -v -Dm644 {} $pkgdir/usr/lib/$_pkgname/lib/{} \;
    popd
    pushd data
    find . -type f -exec install -v -Dm644 {} $pkgdir/usr/lib/$_pkgname/data/{} \;
    popd
    install -dm755 "$pkgdir/usr/bin"
    ln -sfrv "$pkgdir/usr/lib/$_pkgname/rune" "$pkgdir/usr/bin/rune"

    # Fix rpath that causes 'Insecure RUNPATH'
    for shared_lib in "$pkgdir/usr/lib/$_pkgname/lib"/*.so; do
        [[ -z $(patchelf --print-rpath "$shared_lib") ]] && continue
        [[ $(patchelf --print-rpath "$shared_lib") == '$ORIGIN' ]] && continue
        patchelf --set-rpath '$ORIGIN' "$shared_lib"
    done

    install -Dm644 "$srcdir/$_pkgname.desktop" -t "$pkgdir/usr/share/applications/"
}