Gentoo Archives: gentoo-commits

From: Matthew Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/spotify/
Date: Wed, 05 Jan 2022 16:42:45
Message-Id: 1641400954.ffaf6180e1a5919724511fb7c896b45443910bab.prometheanfire@gentoo
1 commit: ffaf6180e1a5919724511fb7c896b45443910bab
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 28 12:49:39 2021 +0000
4 Commit: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 5 16:42:34 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffaf6180
7
8 media-sound/spotify: rework systray support
9
10 - drop systray flag
11 - expand launch script to detect and use systray application if present
12 - add optfeature
13 - bump to EAPI 8
14
15 Closes: https://bugs.gentoo.org/825406
16 Closes: https://bugs.gentoo.org/825410
17 Package-Manager: Portage-3.0.30, Repoman-3.0.3
18 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
19 Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>
20
21 media-sound/spotify/spotify-1.1.72-r1.ebuild | 133 +++++++++++++++++++++++++++
22 1 file changed, 133 insertions(+)
23
24 diff --git a/media-sound/spotify/spotify-1.1.72-r1.ebuild b/media-sound/spotify/spotify-1.1.72-r1.ebuild
25 new file mode 100644
26 index 000000000000..b36208e04b8c
27 --- /dev/null
28 +++ b/media-sound/spotify/spotify-1.1.72-r1.ebuild
29 @@ -0,0 +1,133 @@
30 +# Copyright 1999-2021 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +inherit desktop optfeature pax-utils unpacker xdg
36 +
37 +DESCRIPTION="Spotify is a social music platform"
38 +HOMEPAGE="https://www.spotify.com/download/linux/"
39 +SRC_BASE="http://repository.spotify.com/pool/non-free/s/${PN}-client/"
40 +BUILD_ID_AMD64="439.gc253025e"
41 +SRC_URI="${SRC_BASE}${PN}-client_${PV}.${BUILD_ID_AMD64}_amd64.deb"
42 +
43 +LICENSE="Spotify"
44 +SLOT="0"
45 +KEYWORDS="~amd64"
46 +IUSE="libnotify local-playback pax-kernel pulseaudio"
47 +RESTRICT="mirror strip"
48 +
49 +BDEPEND=">=dev-util/patchelf-0.10"
50 +RDEPEND="
51 + dev-libs/nss
52 + dev-python/dbus-python
53 + libnotify? ( x11-libs/libnotify )
54 + dev-libs/openssl:0=
55 + media-libs/alsa-lib
56 + media-libs/fontconfig
57 + media-libs/harfbuzz
58 + media-libs/mesa[X(+)]
59 + net-misc/curl[ssl]
60 + net-print/cups[ssl]
61 + pulseaudio? ( media-sound/pulseaudio )
62 + !pulseaudio? ( media-sound/apulse )
63 + local-playback? ( media-video/ffmpeg:0/56.58.58 )
64 + x11-libs/gtk+:3
65 + app-accessibility/at-spi2-atk
66 + x11-libs/libxkbcommon
67 + x11-libs/libXScrnSaver
68 + x11-libs/libXtst
69 + x11-libs/libSM
70 + x11-libs/libICE
71 +"
72 + #sys-libs/glibc
73 +
74 +S="${WORKDIR}/"
75 +
76 +QA_PREBUILT="
77 + opt/spotify/spotify-client/spotify
78 + opt/spotify/spotify-client/libEGL.so
79 + opt/spotify/spotify-client/libGLESv2.so
80 + opt/spotify/spotify-client/libcef.so
81 + opt/spotify/spotify-client/libvk_swiftshader.so
82 + opt/spotify/spotify-client/libvulkan.so.1
83 + opt/spotify/spotify-client/swiftshader/libEGL.so
84 + opt/spotify/spotify-client/swiftshader/libGLESv2.so
85 +"
86 +
87 +src_prepare() {
88 + default
89 + # Spotify links against libcurl-gnutls.so.4, which does not exist in Gentoo.
90 + patchelf --replace-needed libcurl-gnutls.so.4 libcurl.so.4 usr/bin/spotify \
91 + || die "failed to patch libcurl library dependency"
92 +}
93 +
94 +src_install() {
95 + gunzip usr/share/doc/spotify-client/changelog.gz || die
96 + dodoc usr/share/doc/spotify-client/changelog
97 +
98 + SPOTIFY_PKG_HOME=usr/share/spotify
99 + insinto /usr/share/pixmaps
100 + doins ${SPOTIFY_PKG_HOME}/icons/*.png
101 +
102 + # install in /opt/spotify
103 + SPOTIFY_HOME=/opt/spotify/spotify-client
104 + insinto ${SPOTIFY_HOME}
105 + doins -r ${SPOTIFY_PKG_HOME}/*
106 + fperms +x ${SPOTIFY_HOME}/spotify
107 +
108 + dodir /usr/bin
109 + cat <<EOF >"${D}"/usr/bin/spotify || die
110 +#! /bin/sh
111 +if command -v spotify-dbus.py &> /dev/null; then
112 + echo "Launching spotify with Gnome systray integration"
113 + LD_LIBRARY_PATH="/usr/$(get_libdir)/apulse" \\
114 + spotify-dbus.py "\$@"
115 +elif command -v spotify-tray &> /dev/null; then
116 + echo "Launching spotify with generic systray integration"
117 + TRAY_ARGS=" --client-path=${SPOTIFY_HOME}/spotify --toggle "
118 + # seperate out the --minimized argument, parse it to spotify-tray
119 + # propagate the rest to the spotify client itself
120 + if [[ "\$@" == *"--minimized"* ]]; then
121 + TRAY_ARGS+=" --minimized "
122 + fi
123 + LD_LIBRARY_PATH="/usr/$(get_libdir)/apulse" \\
124 + spotify-tray \${TRAY_ARGS} -- "\$@"
125 +else
126 + echo "Neither gnome-integration-spotify or spotify-tray installed"
127 + echo "Launching spotify without systray integration"
128 + LD_LIBRARY_PATH="/usr/$(get_libdir)/apulse" \\
129 + exec ${SPOTIFY_HOME}/spotify "\$@"
130 +fi
131 +EOF
132 + fperms +x /usr/bin/spotify
133 +
134 + local size
135 + for size in 16 22 24 32 48 64 128 256 512; do
136 + newicon -s ${size} "${S}${SPOTIFY_PKG_HOME}/icons/spotify-linux-${size}.png" \
137 + "spotify-client.png"
138 + done
139 + domenu "${S}${SPOTIFY_PKG_HOME}/spotify.desktop"
140 + if use pax-kernel; then
141 + #create the headers, reset them to default, then paxmark -m them
142 + pax-mark C "${ED}${SPOTIFY_HOME}/${PN}" || die
143 + pax-mark z "${ED}${SPOTIFY_HOME}/${PN}" || die
144 + pax-mark m "${ED}${SPOTIFY_HOME}/${PN}" || die
145 + eqawarn "You have set USE=pax-kernel meaning that you intend to run"
146 + eqawarn "${PN} under a PaX enabled kernel. To do so, we must modify"
147 + eqawarn "the ${PN} binary itself and this *may* lead to breakage! If"
148 + eqawarn "you suspect that ${PN} is being broken by this modification,"
149 + eqawarn "please open a bug."
150 + fi
151 +}
152 +
153 +pkg_postinst() {
154 + xdg_pkg_postinst
155 +
156 + ewarn "If Spotify crashes after an upgrade its cache may be corrupt."
157 + ewarn "To remove the cache:"
158 + ewarn "rm -rf ~/.cache/spotify"
159 +
160 + optfeature "Gnome specific systray integration" gnome-extra/gnome-integration-spotify
161 + optfeature "systray integration on non-Gnome DEs" media-sound/spotify-tray
162 +}