spotify: Fetch binaries at install-time

This commit is contained in:
Stefan Mühlinghaus 2015-01-22 00:34:14 +01:00
parent 9cd19e157f
commit 930ea4465d
3 changed files with 75 additions and 39 deletions

54
srcpkgs/spotify/INSTALL Normal file
View File

@ -0,0 +1,54 @@
# INSTALL for 'spotify'
# Fetching proprietary binaries at install-time
_BUILDDIR="/tmp/spotify.build"
_LIBS=$(ldconfig -vNX -n /usr/lib 2>/dev/null)
linklib() {
_LIB=$(echo "$_LIBS" | grep "${1}\.so" | sed 's/\s*\([^ ]*\).*$/\1/')
ln -s "/usr/lib/${_LIB}" "/usr/share/spotify/libs/${1}.so.${2}"
}
if test "$ACTION" = "post"; then
. /usr/share/spotify/pkgdata
mkdir -p "$_BUILDDIR"
(
cd "$_BUILDDIR"
xbps-uhelper fetch "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${SVERSION}.deb"
echo "${SCHECKSUM} spotify-client_${SVERSION}.deb" >checksum
sha256sum -c checksum || exit 1
ar x "spotify-client_${SVERSION}.deb"
tar xzf data.tar.gz 2>/dev/null
) || {
echo Error while extracting;
rm -r "$_BUILDDIR";
exit 1;
}
mkdir -p /usr/share/licenses/spotify
mv "${_BUILDDIR}/usr/share/doc/spotify-client/copyright" /usr/share/licenses/spotify/
mv "${_BUILDDIR}/opt/spotify/spotify-client" /usr/share/spotify/spotify-client
for _s in 16 22 24 32 48 64 128 256 512; do
mkdir -p "/usr/share/icons/hicolor/${_s}x${_s}/apps"
ln -s "/usr/share/spotify/spotify-client/Icons/spotify-linux-${_s}.png" "/usr/share/icons/hicolor/${_s}x${_s}/apps/spotify.png"
done
mkdir -p /usr/share/applications
ln -s /usr/share/spotify/spotify-client/spotify.desktop /usr/share/applications/spotify.desktop
if test "$ARCH" = "x86_64"; then
linklib "libssl" "1.0.0"
linklib "libcrypto" "1.0.0"
linklib "libudev" "0"
else
linklib "libssl" "0.9.8"
linklib "libcrypto" "0.9.8"
linklib "libnss3" "1d"
linklib "libnssutil3" "1d"
linklib "libsmime3" "1d"
linklib "libplc4" "0d"
linklib "libnspr4" "0d"
linklib "libudev" "0"
fi
rm -r "$_BUILDDIR"
fi

12
srcpkgs/spotify/REMOVE Normal file
View File

@ -0,0 +1,12 @@
# REMOVE for 'spotify'
# Deleting dynamically fetched files
if test "$ACTION" = "post"; then
rm -r /usr/share/licenses/spotify
rm /usr/share/applications/spotify.desktop
for _s in 16 22 24 32 48 64 128 256 512; do
rm "/usr/share/icons/hicolor/${_s}x${_s}/apps/spotify.png"
done
rm -r /usr/share/spotify
fi

View File

@ -1,37 +1,31 @@
# Template build file for 'spotify'. # Template build file for 'spotify'.
pkgname=spotify pkgname=spotify
version=0.9 version=0.9
revision=1 revision=2
short_desc="Proprietary music streaming client" short_desc="Proprietary music streaming client"
maintainer="Stefan Mühlinghaus <jazzman@alphabreed.com>" maintainer="Stefan Mühlinghaus <jazzman@alphabreed.com>"
homepage="https://www.spotify.com" homepage="https://www.spotify.com"
license="Proprietary" license="Proprietary"
create_wrksrc=1 create_wrksrc=1
allow_unknown_shlibs=1
only_for_archs="x86_64 i686" only_for_archs="x86_64 i686"
repository=nonfree repository=nonfree
build_style=fetch build_style=fetch
makedepends="libgpg-error-devel" makedepends="libgpg-error-devel"
distfiles="ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.4.tar.bz2"
checksum="d5f88d9f41a46953dc250cdb8575129b37ee2208401b7fa338c897f667c7fb33"
depends="binutils qt gtk+ nss GConf libXScrnSaver"
if test "${XBPS_TARGET_MACHINE}" = "x86_64"; then if test "${XBPS_TARGET_MACHINE}" = "x86_64"; then
_sversion=".11.27.g2b1a638.81-1_amd64" _sversion=".11.27.g2b1a638.81-1_amd64"
_schecksum="4f93776cac562f622e635c64fa61ee46cb9bdfbda0a2aff0905acf007894d479" _schecksum="4f93776cac562f622e635c64fa61ee46cb9bdfbda0a2aff0905acf007894d479"
depends+=" pango-xft"
else else
_sversion=".4.183.g644e24e.428-1_i386" _sversion=".4.183.g644e24e.428-1_i386"
_schecksum="ca45d057357e4c30efee3838dd941222500463ddd0a1db6981e4d48d7ad986f2" _schecksum="ca45d057357e4c30efee3838dd941222500463ddd0a1db6981e4d48d7ad986f2"
depends="nss"
fi fi
distfiles="http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}${_sversion}.deb
ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.4.tar.bz2"
checksum="${_schecksum}
d5f88d9f41a46953dc250cdb8575129b37ee2208401b7fa338c897f667c7fb33"
do_extract() { do_extract() {
local _srcpath="${XBPS_SRCDISTDIR}/spotify-${version}" tar xjf "${XBPS_SRCDISTDIR}/spotify-${version}/libgcrypt-1.5.4.tar.bz2"
ar x "${_srcpath}/spotify-client_${version}${_sversion}.deb"
tar xzf data.tar.gz
tar xjf "${_srcpath}/libgcrypt-1.5.4.tar.bz2"
} }
do_build() { do_build() {
@ -41,33 +35,9 @@ do_build() {
} }
do_install() { do_install() {
vbin "${FILESDIR}/spotify" vbin ${FILESDIR}/spotify
vlicense usr/share/doc/spotify-client/copyright
vmkdir usr/share
vcopy opt/spotify usr/share
vmkdir usr/share/applications
ln -sf /usr/share/spotify/spotify-client/spotify.desktop "${DESTDIR}/usr/share/applications/spotify.desktop"
for _s in 16 22 24 32 48 64 128 256 512; do
vmkdir "usr/share/icons/hicolor/${_s}x${_s}/apps"
ln -sf "/usr/share/spotify/spotify-client/Icons/spotify-linux-${_s}.png" "${DESTDIR}/usr/share/icons/hicolor/${_s}x${_s}/apps/spotify.png"
done
vmkdir usr/share/spotify/libs vmkdir usr/share/spotify/libs
vinstall libgcrypt-1.5.4/src/.libs/libgcrypt.so.11.8.3 755 usr/share/spotify/libs libgcrypt.so.11 vinstall libgcrypt-1.5.4/src/.libs/libgcrypt.so.11.8.3 755 usr/share/spotify/libs libgcrypt.so.11
if test "${XBPS_TARGET_MACHINE}" = "x86_64"; then echo "export SVERSION=\"${version}${_sversion}\"" >"${DESTDIR}/usr/share/spotify/pkgdata"
ln -sf /usr/lib/libssl.so.29 "${DESTDIR}/usr/share/spotify/libs/libssl.so.1.0.0" echo "export SCHECKSUM=\"${_schecksum}\"" >>"${DESTDIR}/usr/share/spotify/pkgdata"
ln -sf /usr/lib/libcrypto.so.30 "${DESTDIR}/usr/share/spotify/libs/libcrypto.so.1.0.0"
ln -sf /usr/lib/libudev.so.1 "${DESTDIR}/usr/share/spotify/libs/libudev.so.0"
else
ln -sf /usr/lib/libssl.so.29 "${DESTDIR}/usr/share/spotify/libs/libssl.so.0.9.8"
ln -sf /usr/lib/libcrypto.so.30 "${DESTDIR}/usr/share/spotify/libs/libcrypto.so.0.9.8"
ln -sf /usr/lib/libnss3.so "${DESTDIR}/usr/share/spotify/libs/libnss3.so.1d"
ln -sf /usr/lib/libnssutil3.so "${DESTDIR}/usr/share/spotify/libs/libnssutil3.so.1d"
ln -sf /usr/lib/libsmime3.so "${DESTDIR}/usr/share/spotify/libs/libsmime3.so.1d"
ln -sf /usr/lib/libplc4.so "${DESTDIR}/usr/share/spotify/libs/libplc4.so.0d"
ln -sf /usr/lib/libnspr4.so "${DESTDIR}/usr/share/spotify/libs/libnspr4.so.0d"
ln -sf /usr/lib/libudev.so.1 "${DESTDIR}/usr/share/spotify/libs/libudev.so.0"
fi
} }