spotify: 0.9.17.1 -> 1.0.19.106
changes by @globin: used wrapper instead of propagatedUserEnvPkgs for zenity closes #12191 Signed-off-by: Robin Gloster <mail@glob.in>
This commit is contained in:
parent
ff837f9288
commit
ebd1a4ca9f
|
@ -1,18 +1,18 @@
|
|||
{ fetchurl, stdenv, dpkg, xorg, qt4, alsaLib, makeWrapper, openssl_1_0_1, freetype
|
||||
{ fetchurl, stdenv, dpkg, xorg, alsaLib, makeWrapper, openssl_1_0_1, freetype
|
||||
, glib, pango, cairo, atk, gdk_pixbuf, gtk, cups, nspr, nss, libpng, GConf
|
||||
, libgcrypt, chromium, udev, fontconfig
|
||||
, dbus, expat, ffmpeg_0_10 }:
|
||||
, libgcrypt, udev, fontconfig, dbus, expat, ffmpeg_0_10, curl, zlib, gnome }:
|
||||
|
||||
assert stdenv.system == "x86_64-linux";
|
||||
|
||||
let
|
||||
version = "0.9.17.1.g9b85d43.7";
|
||||
version = "1.0.19.106.gb8a7150f";
|
||||
|
||||
deps = [
|
||||
alsaLib
|
||||
atk
|
||||
cairo
|
||||
cups
|
||||
curl
|
||||
dbus
|
||||
expat
|
||||
ffmpeg_0_10
|
||||
|
@ -26,19 +26,20 @@ let
|
|||
libpng
|
||||
nss
|
||||
pango
|
||||
qt4
|
||||
stdenv.cc.cc
|
||||
udev
|
||||
xorg.libX11
|
||||
xorg.libXcomposite
|
||||
xorg.libXcursor
|
||||
xorg.libXdamage
|
||||
xorg.libXext
|
||||
xorg.libXfixes
|
||||
xorg.libXi
|
||||
xorg.libXrandr
|
||||
xorg.libXrender
|
||||
xorg.libXrender
|
||||
xorg.libXScrnSaver
|
||||
xorg.libXtst
|
||||
zlib
|
||||
];
|
||||
|
||||
in
|
||||
|
@ -48,8 +49,8 @@ stdenv.mkDerivation {
|
|||
|
||||
src =
|
||||
fetchurl {
|
||||
url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_amd64.deb";
|
||||
sha256 = "0x87q7gd2997sgppsm4lmdiz1cm11x5vnd5c34nqb5d4ry5qfyki";
|
||||
url = "http://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_${version}_amd64.deb";
|
||||
sha256 = "be6b99329bb2fccdc9d77bc949dd463576fdb40db7f56195b4284bd348c470be";
|
||||
};
|
||||
|
||||
buildInputs = [ dpkg makeWrapper ];
|
||||
|
@ -61,8 +62,8 @@ stdenv.mkDerivation {
|
|||
libdir=$out/lib/spotify
|
||||
mkdir -p $libdir
|
||||
dpkg-deb -x $src $out
|
||||
mv $out/opt/spotify/* $out/
|
||||
rm -rf $out/usr $out/opt
|
||||
mv $out/usr/* $out/
|
||||
rm -rf $out/usr
|
||||
|
||||
# Work around Spotify referring to a specific minor version of
|
||||
# OpenSSL.
|
||||
|
@ -72,33 +73,22 @@ stdenv.mkDerivation {
|
|||
ln -s ${nspr}/lib/libnspr4.so $libdir/libnspr4.so
|
||||
ln -s ${nspr}/lib/libplc4.so $libdir/libplc4.so
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
rpath="$out/spotify-client/Data:$libdir:$out/spotify-client:${stdenv.cc.cc}/lib64"
|
||||
|
||||
ln -s $out/spotify-client/spotify $out/bin/spotify
|
||||
rpath="$out/share/spotify:$libdir"
|
||||
|
||||
patchelf \
|
||||
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath $rpath $out/spotify-client/spotify
|
||||
--set-rpath $rpath $out/share/spotify/spotify
|
||||
|
||||
patchelf \
|
||||
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath $rpath $out/spotify-client/Data/SpotifyHelper
|
||||
|
||||
preload=$out/libexec/spotify/libpreload.so
|
||||
librarypath="${stdenv.lib.makeLibraryPath deps}:$libdir"
|
||||
mkdir -p $out/libexec/spotify
|
||||
gcc -shared ${./preload.c} -o $preload -ldl -DOUT=\"$out\" -fPIC
|
||||
|
||||
wrapProgram $out/bin/spotify --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
|
||||
wrapProgram $out/spotify-client/Data/SpotifyHelper --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
|
||||
wrapProgram $out/share/spotify/spotify \
|
||||
--prefix LD_LIBRARY_PATH : "$librarypath" \
|
||||
--prefix PATH : "${gnome.zenity}/bin"
|
||||
|
||||
# Desktop file
|
||||
mkdir -p "$out/share/applications/"
|
||||
cp "$out/spotify-client/spotify.desktop" "$out/share/applications/"
|
||||
sed -i "s|Icon=.*|Icon=$out/spotify-client/Icons/spotify-linux-512.png|" "$out/share/applications/spotify.desktop"
|
||||
''; # */
|
||||
cp "$out/share/spotify/spotify.desktop" "$out/share/applications/"
|
||||
sed -i "s|Icon=.*|Icon=$out/share/spotify/Icons/spotify-linux-512.png|" "$out/share/applications/spotify.desktop"
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/* Spotify looks for its theme data in /usr/share/spotify/theme. This
|
||||
LD_PRELOAD library intercepts open() and stat() calls to redirect
|
||||
them to the corresponding location in $out. */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
char themeDir [] = "/usr/share/spotify/theme";
|
||||
char realThemeDir [] = OUT "/share/spotify/theme";
|
||||
|
||||
const char * rewrite(const char * path, char * buf)
|
||||
{
|
||||
if (strncmp(path, themeDir, sizeof(themeDir) - 1) != 0) return path;
|
||||
if (snprintf(buf, PATH_MAX, "%s%s", realThemeDir, path + sizeof(themeDir) - 1) >= PATH_MAX)
|
||||
abort();
|
||||
return buf;
|
||||
}
|
||||
|
||||
int open(const char *path, int flags, ...)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int (*_open) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open");
|
||||
mode_t mode = 0;
|
||||
if (flags & O_CREAT) {
|
||||
va_list ap;
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
}
|
||||
return _open(rewrite(path, buf), flags, mode);
|
||||
}
|
||||
|
||||
int open64(const char *path, int flags, ...)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int (*_open64) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open64");
|
||||
mode_t mode = 0;
|
||||
if (flags & O_CREAT) {
|
||||
va_list ap;
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
}
|
||||
return _open64(rewrite(path, buf), flags, mode);
|
||||
}
|
||||
|
||||
int __xstat64(int ver, const char *path, struct stat64 *st)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int (*___xstat64) (int ver, const char *, struct stat64 *) = dlsym(RTLD_NEXT, "__xstat64");
|
||||
return ___xstat64(ver, rewrite(path, buf), st);
|
||||
}
|
||||
|
||||
int access(const char *path, int mode)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int (*_access) (const char *path, int mode) = dlsym(RTLD_NEXT, "access");
|
||||
return _access(rewrite(path, buf), mode);
|
||||
}
|
Loading…
Reference in a new issue