media-sound/spotify: bump version to 1.1.0
[gentoo.git] / media-sound / spotify / spotify-1.0.98.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit gnome2-utils pax-utils unpacker xdg-utils
6
7 DESCRIPTION="Spotify is a social music platform"
8 HOMEPAGE="https://www.spotify.com/ch-de/download/previews/"
9 SRC_BASE="http://repository.spotify.com/pool/non-free/s/${PN}-client/"
10 BUILD_ID_AMD64="78.gb45d2a6b-10"
11 #BUILD_ID_X86=""
12 #SRC_URI="amd64? ( ${SRC_BASE}${PN}-client_${PV}.${BUILD_ID_AMD64}_amd64.deb )
13 #       x86? ( ${SRC_BASE}${PN}-client_${PV}.${BUILD_ID_X86}_i386.deb )"
14 SRC_URI="${SRC_BASE}${PN}-client_${PV}.${BUILD_ID_AMD64}_amd64.deb"
15 LICENSE="Spotify"
16 SLOT="0"
17 KEYWORDS="~amd64"
18 IUSE="libnotify systray pax_kernel pulseaudio"
19 RESTRICT="mirror strip"
20
21 DEPEND=">=dev-util/patchelf-0.9_p20180129"
22 # zenity needed for filepicker
23 RDEPEND="
24         dev-libs/openssl:0
25         dev-libs/nss
26         gnome-base/gconf
27         gnome-extra/zenity
28         media-libs/alsa-lib
29         media-libs/harfbuzz
30         media-libs/fontconfig
31         media-libs/mesa
32         net-misc/curl[ssl]
33         net-print/cups[ssl]
34         x11-libs/gtk+:2
35         x11-libs/libXScrnSaver
36         x11-libs/libXtst
37         dev-python/pygobject:3
38         dev-python/dbus-python
39         libnotify? ( x11-libs/libnotify )
40         pulseaudio? ( media-sound/pulseaudio )
41         systray? ( gnome-extra/gnome-integration-spotify )"
42         #sys-libs/glibc
43
44 S=${WORKDIR}/
45
46 QA_PREBUILT="opt/spotify/spotify-client/spotify"
47
48 src_prepare() {
49         # Fix desktop entry to launch spotify-dbus.py for systray integration
50         if use systray ; then
51                 sed -i \
52                         -e 's/spotify \%U/spotify-dbus.py \%U/g' \
53                         usr/share/spotify/spotify.desktop || die "sed failed"
54         fi
55         default
56
57         # Spotify links against libcurl-gnutls.so.4, which does not exist in Gentoo.
58         patchelf --replace-needed libcurl-gnutls.so.4 libcurl.so.4 usr/bin/spotify \
59                 || die "failed to patch libcurl library dependency"
60 }
61
62 src_install() {
63         gunzip usr/share/doc/spotify-client/changelog.gz || die
64         dodoc usr/share/doc/spotify-client/changelog
65
66         SPOTIFY_PKG_HOME=usr/share/spotify
67         insinto /usr/share/pixmaps
68         doins ${SPOTIFY_PKG_HOME}/icons/*.png
69
70         # install in /opt/spotify
71         SPOTIFY_HOME=/opt/spotify/spotify-client
72         insinto ${SPOTIFY_HOME}
73         doins -r ${SPOTIFY_PKG_HOME}/*
74         fperms +x ${SPOTIFY_HOME}/spotify
75
76         dodir /usr/bin
77         cat <<-EOF >"${D}"/usr/bin/spotify || die
78                 #! /bin/sh
79                 exec ${SPOTIFY_HOME}/spotify "\$@"
80         EOF
81         fperms +x /usr/bin/spotify
82
83         local size
84         for size in 16 22 24 32 48 64 128 256 512; do
85                 newicon -s ${size} "${S}${SPOTIFY_PKG_HOME}/icons/spotify-linux-${size}.png" \
86                         "spotify-client.png"
87         done
88         domenu "${S}${SPOTIFY_PKG_HOME}/spotify.desktop"
89         if use pax_kernel; then
90                 #create the headers, reset them to default, then paxmark -m them
91                 pax-mark C "${ED}${SPOTIFY_HOME}/${PN}" || die
92                 pax-mark z "${ED}${SPOTIFY_HOME}/${PN}" || die
93                 pax-mark m "${ED}${SPOTIFY_HOME}/${PN}" || die
94                 eqawarn "You have set USE=pax_kernel meaning that you intend to run"
95                 eqawarn "${PN} under a PaX enabled kernel.  To do so, we must modify"
96                 eqawarn "the ${PN} binary itself and this *may* lead to breakage!  If"
97                 eqawarn "you suspect that ${PN} is being broken by this modification,"
98                 eqawarn "please open a bug."
99         fi
100 }
101
102 pkg_postinst() {
103         gnome2_icon_cache_update
104         xdg_mimeinfo_database_update
105         xdg_desktop_database_update
106
107         ewarn "If Spotify crashes after an upgrade its cache may be corrupt."
108         ewarn "To remove the cache:"
109         ewarn "rm -rf ~/.cache/spotify"
110 }
111
112 pkg_postrm() {
113         gnome2_icon_cache_update
114         xdg_mimeinfo_database_update
115         xdg_desktop_database_update
116 }