Merge pull request #8579 from jraygauthier/jrg/i686_linux_libspotify

Add support for libspotify on `i686-linux`.
This commit is contained in:
Arseniy Seroka 2015-07-04 02:54:59 +03:00
commit f71b7f08af

View file

@ -1,8 +1,11 @@
{ stdenv, fetchurl, libspotify, alsaLib, readline, pkgconfig, apiKey, unzip, gnused }:
let version = "12.1.51"; in
let
version = "12.1.51";
isLinux = (stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux");
in
if (stdenv.system != "x86_64-linux" && stdenv.system != "x86_64-darwin")
if (stdenv.system != "x86_64-linux" && stdenv.system != "x86_64-darwin" && stdenv.system != "i686-linux")
then throw "Check https://developer.spotify.com/technologies/libspotify/ for a tarball for your system and add it here"
else stdenv.mkDerivation {
name = "libspotify-${version}";
@ -18,6 +21,11 @@ else stdenv.mkDerivation {
url = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Darwin-universal.zip";
sha256 = "1gcgrc8arim3hnszcc886lmcdb4iigc08abkaa02l6gng43ky1c0";
}
else if stdenv.system == "i686-linux" then
fetchurl {
url = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Linux-i686-release.tar.gz";
sha256 = "1bjmn64gbr4p9irq426yap4ipq9rb84zsyhjjr7frmmw22xb86ll";
}
else
null;
@ -26,9 +34,9 @@ else stdenv.mkDerivation {
# no patch or build phase for darwin
phases =
[ "unpackPhase" ] ++
(stdenv.lib.optionals (stdenv.system == "x86_64-linux") [ "patchPhase" "buildPhase" ]) ++
(stdenv.lib.optionals (isLinux) [ "patchPhase" "buildPhase" ]) ++
[ "installPhase" ];
installPhase = if (stdenv.system == "x86_64-linux")
installPhase = if (isLinux)
then "installPhase"
else ''
mkdir -p "$out"/include/libspotify
@ -46,11 +54,11 @@ else stdenv.mkDerivation {
buildInputs = stdenv.lib.optional (stdenv.system == "x86_64-darwin") unzip;
# linux-specific
installFlags = stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
installFlags = stdenv.lib.optionalString (isLinux)
"prefix=$(out)";
patchPhase = stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
patchPhase = stdenv.lib.optionalString (isLinux)
"${gnused}/bin/sed -i 's/ldconfig//' Makefile";
postInstall = stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
postInstall = stdenv.lib.optionalString (isLinux)
"mv -v share $out";
passthru = {