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

_name=rune
_pkgname=rune-player
pkgname=rune-player-git
pkgver=0.0.0.dev.12.r9.g4524559
pkgrel=1
pkgdesc="The player that blends classic design with modern technology"
arch=('x86_64')
url="https://github.com/Losses/${_name}"
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"
    "${_name}.desktop"
)
sha256sums=('SKIP'
            '8c680492966831e2da2968007f2d5d3dbfbf72fdab670592689ac42f37af2121')

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/${_name}.png ${pkgdir}/usr/share/icons/${_name}.png

    cd build/linux/x64/release/bundle
    install -Dm755 ${_name} -t "${pkgdir}/usr/lib/${_pkgname}/"
    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}/${_name}" "${pkgdir}/usr/bin/${_name}"

    # 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}/${_name}.desktop" -t "${pkgdir}/usr/share/applications/"
}