summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 694bf6a350f33aaf12370b8ceb120926ad83e239 (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
# Maintainer: theRealPadster <padspambox at gmail dot com>
# Based on the authy and spotify AUR packages
# https://aur.archlinux.org/packages/authy
# https://aur.archlinux.org/packages/spotify
# https://unix.stackexchange.com/questions/560065/how-can-i-manually-download-a-snap-package-for-example-with-wget

pkgname=spotify-edge
pkgver=1.2.31.1205
_commit=g4d59ad7c
pkgrel=1
pkgdesc='A proprietary music streaming service. Edge version.'
arch=('x86_64')
url='https://www.spotify.com'
provides=('spotify')
conflicts=('spotify')
license=('custom')
depends=('alsa-lib>=1.0.14' 'gtk3' 'libxss' 'desktop-file-utils' 'openssl' 'nss' 'at-spi2-atk' 'libcurl-gnutls' 'libsm' 'libayatana-appindicator')
optdepends=('ffmpeg4.4: Adds support for playback of local files'
            'zenity: Adds support for importing local files'
            'libnotify: Desktop notifications')
makedepends=('squashfs-tools')
_snapid='pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7'
_snaprev='75'
source=(
    'spotify.sh'
    'spotify.protocol'
    'LICENSE'
    "https://api.snapcraft.io/api/v1/snaps/download/${_snapid}_${_snaprev}.snap"
)
sha512sums=(
    'da48b628a4ea925dd8521133ebf364b261b11aed252d264dde6605d915cdb631919ffe672c58534bcdb60869e5d87a49a60a8198780b99517123f0031e83fdb1'
    '999abe46766a4101e27477f5c9f69394a4bb5c097e2e048ec2c6cb93dfa1743eb436bde3768af6ba1b90eaac78ea8589d82e621f9cbe7d9ab3f41acee6e8ca20'
    '2e16f7c7b09e9ecefaa11ab38eb7a792c62ae6f33d95ab1ff46d68995316324d8c5287b0d9ce142d1cf15158e61f594e930260abb8155467af8bc25779960615'
    'a3888b71b36a6ecc68f5824ccb44973bb51dbf808c86105cb1fe7752ea9628515663f8ca54df8b6fe741ec97fdf94a30a666eb3f8e30f7b3a2f9d9db7c55d88d'
)

prepare() {
    echo 'Extracting snap file...'
    unsquashfs -q -f -d "${srcdir}/${pkgname}" "${_snapid}_${_snaprev}.snap"
}

package() {
    # Install files
    install -d "${pkgdir}/opt/spotify"
    install -d "${pkgdir}/usr/share"
    install -d "${pkgdir}/usr/bin"

    # copy /usr/share/spotify into /opt/spotify
    cp -r "${srcdir}/${pkgname}/usr/share/spotify/." "${pkgdir}/opt/spotify"

    # Enable spotify to open URLs from the webapp
    sed -i 's/^Exec=.*/Exec=spotify --uri=%U/' "${pkgdir}"/opt/spotify/spotify.desktop

    # Fix the icon
    sed -i 's/^Icon=.*/Icon=spotify-client/' "${pkgdir}"/opt/spotify/spotify.desktop

    # Desktop Entry
    install -Dm 644 "${pkgdir}"/opt/spotify/spotify.desktop "${pkgdir}"/usr/share/applications/spotify.desktop

    # Copy icons
    install -Dm 644 "${pkgdir}"/opt/spotify/icons/spotify-linux-512.png "${pkgdir}"/usr/share/pixmaps/spotify-client.png

    for size in 22 24 32 48 64 128 256 512; do
        install -Dm 644 "${pkgdir}/opt/spotify/icons/spotify-linux-$size.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/spotify.png"
    done

    # Copy launch script which allows the use of custom flags
    install -Dm 755 spotify.sh "${pkgdir}/usr/bin/spotify"

    # Copy protocol file for KDE
    install -Dm 644 "${srcdir}/spotify.protocol" "${pkgdir}/usr/share/kservices5/spotify.protocol"

    # Install license
    # https://www.spotify.com/legal/end-user-agreement
    # TODO: should this be in a folder called spotify or spotify-edge?
    install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    # Fix permissions
    chmod -R go-w "${pkgdir}"
}