]> git.friedersdorff.com Git - max/gentoo-overlay.git/blob - spotify-1.1.0.ebuild
1b2526fbfa26028deff4aa5b2b69f4c2c230ac79
[max/gentoo-overlay.git] / spotify-1.1.0.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="237.g378f6f25-11"
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 libressl 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         libressl? ( dev-libs/libressl:0= )
25         !libressl? ( dev-libs/openssl:0= )
26         dev-libs/nss
27         gnome-base/gconf
28         gnome-extra/zenity
29         media-libs/alsa-lib
30         media-libs/harfbuzz
31         media-libs/fontconfig
32         media-libs/mesa
33         net-misc/curl[ssl]
34         net-print/cups[ssl]
35         x11-libs/gtk+:2
36         x11-libs/libXScrnSaver
37         x11-libs/libXtst
38         dev-python/pygobject:3
39         dev-python/dbus-python
40         libnotify? ( x11-libs/libnotify )
41         pulseaudio? ( media-sound/pulseaudio )
42         systray? ( gnome-extra/gnome-integration-spotify )"
43         #sys-libs/glibc
44
45 S=${WORKDIR}/
46
47 QA_PREBUILT="opt/spotify/spotify-client/spotify"
48
49 src_prepare() {
50         # Fix desktop entry to launch spotify-dbus.py for systray integration
51         if use systray ; then
52                 sed -i \
53                         -e 's/spotify \%U/spotify-dbus.py \%U/g' \
54                         usr/share/spotify/spotify.desktop || die "sed failed"
55         fi
56         default
57
58         # Spotify links against libcurl-gnutls.so.4, which does not exist in Gentoo.
59         patchelf --replace-needed libcurl-gnutls.so.4 libcurl.so.4 usr/bin/spotify \
60                 || die "failed to patch libcurl library dependency"
61 }
62
63 src_install() {
64         gunzip usr/share/doc/spotify-client/changelog.gz || die
65         dodoc usr/share/doc/spotify-client/changelog
66
67         SPOTIFY_PKG_HOME=usr/share/spotify
68         insinto /usr/share/pixmaps
69         doins ${SPOTIFY_PKG_HOME}/icons/*.png
70
71         # install in /opt/spotify
72         SPOTIFY_HOME=/opt/spotify/spotify-client
73         insinto ${SPOTIFY_HOME}
74         doins -r ${SPOTIFY_PKG_HOME}/*
75         fperms +x ${SPOTIFY_HOME}/spotify
76
77         dodir /usr/bin
78         cat <<-EOF >"${D}"/usr/bin/spotify || die
79                 #! /bin/sh
80                 exec ${SPOTIFY_HOME}/spotify "\$@"
81         EOF
82         fperms +x /usr/bin/spotify
83
84         local size
85         for size in 16 22 24 32 48 64 128 256 512; do
86                 newicon -s ${size} "${S}${SPOTIFY_PKG_HOME}/icons/spotify-linux-${size}.png" \
87                         "spotify-client.png"
88         done
89         domenu "${S}${SPOTIFY_PKG_HOME}/spotify.desktop"
90         if use pax_kernel; then
91                 #create the headers, reset them to default, then paxmark -m them
92                 pax-mark C "${ED}${SPOTIFY_HOME}/${PN}" || die
93                 pax-mark z "${ED}${SPOTIFY_HOME}/${PN}" || die
94                 pax-mark m "${ED}${SPOTIFY_HOME}/${PN}" || die
95                 eqawarn "You have set USE=pax_kernel meaning that you intend to run"
96                 eqawarn "${PN} under a PaX enabled kernel.  To do so, we must modify"
97                 eqawarn "the ${PN} binary itself and this *may* lead to breakage!  If"
98                 eqawarn "you suspect that ${PN} is being broken by this modification,"
99                 eqawarn "please open a bug."
100         fi
101 }
102
103 pkg_postinst() {
104         gnome2_icon_cache_update
105         xdg_mimeinfo_database_update
106         xdg_desktop_database_update
107
108         ewarn "If Spotify crashes after an upgrade its cache may be corrupt."
109         ewarn "To remove the cache:"
110         ewarn "rm -rf ~/.cache/spotify"
111 }
112
113 pkg_postrm() {
114         gnome2_icon_cache_update
115         xdg_mimeinfo_database_update
116         xdg_desktop_database_update
117 }