summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c4ef3e5b7b276e1e1f525f680e5896e2eafd12a (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
# Maintainer: imp0  <jan <(a)> siteworld <(.)> be>
# Contributor: NicoHood <archlinux {cat} nicohood {dog} de>
# Contributor: Ashley Whetter <(firstname) @ awhetter.co.uk>
# Contributor: Eothred <yngve.levinsen@gmail.com>

pkgname=spotify-dev
_pkgname=spotify
pkgver=1.2.31.1205
_commit=g4d59ad7c
pkgrel=1
pkgdesc='A proprietary music streaming service'
arch=('x86_64')
license=('custom')
url='https://www.spotify.com'
depends=('alsa-lib'
	'at-spi2-core'
	'gtk3'
	'libayatana-appindicator'
	'libcurl-gnutls'
	'libdbusmenu-glib'
	'libglvnd'
	'libice'
	'libsm'
	'nss'
	'nspr'
	'vulkan-icd-loader')
optdepends=('ffmpeg: Adds support for playback of local files'
            'zenity: Adds support for importing local files'
            'libnotify: Desktop notifications')
provides=("${_pkgname}")
conflicts=("${_pkgname}")

source=("${_pkgname}-Release::http://repository.spotify.com/dists/testing/Release"
	"${_pkgname}-${pkgver}-${CARCH}.deb::http://repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_${pkgver}.${_commit}_amd64.deb"
	"${_pkgname}-${CARCH}-Packages::http://repository.spotify.com/dists/testing/non-free/binary-amd64/Packages"
	'LICENSE')
sha512sums=('SKIP'
	'76babfbe40ab7b7c82d83a3ae40ab3dbc85e73b4a412aeaa8aa758c01c7cf69bd78df4ee222c4c5add84668f552212bed15049a8f8cd1025dc04a87f84c79f88'
	'SKIP'
	'2e16f7c7b09e9ecefaa11ab38eb7a792c62ae6f33d95ab1ff46d68995316324d8c5287b0d9ce142d1cf15158e61f594e930260abb8155467af8bc25779960615')

# Spotify uses different names for the arch
_SPOTIFY_ARCH=amd64

prepare() {
    # Validate hashes from the "Release" file
    echo "$(grep non-free/binary-${_SPOTIFY_ARCH}/Packages ${_pkgname}-Release | tail -n 2 | head -n 1 | awk '{print $1}') ${_pkgname}-${CARCH}-Packages" > "${_pkgname}-${CARCH}-Packages.sha256"
    sha256sum -c "${_pkgname}-${CARCH}-Packages.sha256"

    echo "$(grep SHA512 ${_pkgname}-${CARCH}-Packages | awk '{print $2}') ${_pkgname}-${pkgver}-${CARCH}.deb" > "${_pkgname}-${pkgver}-${CARCH}.deb.sha512"
    sha512sum -c "${_pkgname}-${pkgver}-${CARCH}.deb.sha512"
}

build() {
    tar -xzf data.tar.gz -C "${srcdir}"
}

package() {

    # Install icons
    install -D -m 644 "${srcdir}"/usr/share/spotify/spotify.desktop "${pkgdir}"/usr/share/applications/spotify.desktop
    install -D -m 644 "${srcdir}"/usr/share/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 -D -m 644 "${srcdir}/usr/share/spotify/icons/spotify-linux-$size.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/spotify.png"
    done

    # Some vars to make life easier
    _srcshare="${srcdir}/usr/share/${_pkgname}"
    _pkgopt="${pkgdir}/opt/${_pkgname}"

    # Create target directories
    install -d -m 755 "${_pkgopt}"
    install -d -m 755 "${_pkgopt}/Apps"
    install -d -m 755 "${_pkgopt}/locales"

    # Install files in rootdir
    for _rfile in $(find "${_srcshare}" -maxdepth 1 -type f -name "*.pak" -o -name "*.dat" -o -name "*.bin" -o -name "libcef.so" -o -name "*.json"); do
        install -D -m 644 "${_rfile}" "${_pkgopt}"
    done

    # Install files in appdir
    for _app in $(find "${_srcshare}/Apps" -maxdepth 1 -type f -name "*.spa"); do
        install -D -m 644 "${_app}" "${_pkgopt}/Apps"
    done

    # Install locale data
    for _loc in $(find "${_srcshare}/locales" -maxdepth 1 -type f -name "*.pak" -o -name "*.mo"); do
        install -D -m 644 "${_loc}" "${_pkgopt}/locales"
    done

    # Install binary
    install -D -m 755 "${_srcshare}/${_pkgname}" "${_pkgopt}"

    # Symlink binary
    install -d -m 755 "${pkgdir}"/usr/bin
    ln -s /opt/spotify/spotify "${pkgdir}"/usr/bin/spotify

    # Install license
    # https://www.spotify.com/legal/end-user-agreement
    install -D -m 644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}