# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild,v 1.1 2009/11/25 22:52:26 lavajoe Exp $ EAPI=5 inherit eutils perl-functions user SLIMSERVER_VENDOR_COMMIT="aca68b8423893897a87daa718f4a8cad5e2ea18f" DESCRIPTION="Logitech Media server" HOMEPAGE="http://www.logitechsqueezebox.com/support/download-squeezebox-server.html" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="lame wavpack musepack alac ogg flac avahi aac" SRC_URI="http://downloads.slimdevices.com/LogitechMediaServer_v${PV}/${P}-noCPAN.tgz https://github.com/Logitech/slimserver-vendor/archive/${SLIMSERVER_VENDOR_COMMIT}.tar.gz -> slimserver-vendor-${PV}.tar.gz" RUN_UID=logitechmediaserver RUN_GID=logitechmediaserver DEPEND="" RDEPEND=" virtual/logger avahi? ( net-dns/avahi ) dev-lang/perl dev-perl/GD[jpeg,png] dev-perl/IO-Socket-SSL >=dev-perl/Media-Scan-20190401 lame? ( media-sound/lame ) alac? ( media-sound/alac_decoder ) wavpack? ( media-sound/wavpack ) flac? ( media-libs/flac media-sound/sox[flac] ) ogg? ( media-sound/sox[ogg] ) aac? ( media-libs/faad2 ) " S="${WORKDIR}/${P}-noCPAN" # everything from slimserver-vendor, but Media::Scan CPANBUILD=" Audio::Scan Class::C3::XS Class::XSAccessor Compress::Raw::Zlib DBD::SQLite Digest::SHA1 EV Encode::Detect HTML::Parser Image::Scale IO::AIO IO::Interface JSON::XS Linux::Inotify2 Mac::FSEvents MP3::Cut::Gapless Sub::Name Template XML::Parser YAML::LibYAML " VARLIBSBS="/var/lib/logitechmediaserver" PREFSDIR="${VARLIBSBS}/prefs" LIVE_PREFS="${PREFSDIR}/server.prefs" SHAREDIR="/usr/share/logitechmediaserver" LIBDIR="/usr/lib/logitechmediaserver" PLUGINSDIR="${VARLIBSBS}/Plugins" pkg_setup() { # Create the user and group if not already present enewgroup ${RUN_GID} enewuser ${RUN_UID} -1 -1 "/dev/null" ${RUN_GID} } src_prepare() { default sed -e "s/foreach ('0.99', '0.93', '0.95', '0.94')/foreach ('1.02', '1.01', '0.99', '0.93', '0.95', '0.94')/" -i lib/Audio/Scan.pm } src_compile() { cd ${WORKDIR}/slimserver-vendor-${SLIMSERVER_VENDOR_COMMIT}/CPAN # Bug??? mkdir -p build/lib cp --dereference /usr/lib/gcc/x86_64-pc-linux-gnu/*/libstdc++.so build/lib/libstdc++.so for ITEM in ${CPANBUILD}; do ./buildme.sh -t ${ITEM} done rm -f build/lib/libstdc++.so } src_install() { # The main Perl executables exeinto /usr/sbin newexe slimserver.pl logitechmediaserver newexe scanner.pl logitechmediaserver-scanner newexe cleanup.pl logitechmediaserver-cleanup # The custom OS module for Gentoo - provides OS-specific path details cp "${FILESDIR}/gentoo-filepaths.pm" "Slim/Utils/OS/Custom.pm" || die "Unable to install Gentoo custom OS module" perl_set_version sed -e "s#@@SLIMPLUGINPATH@@#${VENDOR_LIB}/Slim/Plugin#" -i Slim/Utils/OS/Custom.pm # The server Perl modules pushd Slim/ perl_domodule -C Slim -r . || die "Unable to install server Perl modules" popd # CPAN modules insinto "/usr/share/logitechmediaserver/CPAN" doins -r CPAN/* doins -r ${WORKDIR}/slimserver-vendor-${SLIMSERVER_VENDOR_COMMIT}/CPAN/build/arch/*/*/* # Various directories of architecture-independent static files dodir "${SHAREDIR}" cp -r Firmware "${D}/${SHAREDIR}" || die "Unable to install firmware" cp -r Graphics "${D}/${SHAREDIR}" || die "Unable to install Graphics" cp -r HTML "${D}/${SHAREDIR}" || die "Unable to install HTML" cp -r IR "${D}/${SHAREDIR}" || die "Unable to install IR" cp -r SQL "${D}/${SHAREDIR}" || die "Unable to install SQL" # Architecture-dependent static files dodir "${LIBDIR}" cp -r lib/* "${D}/${LIBDIR}" || die "Unable to install architecture-dependent files" # Strings and version identification insinto "${SHAREDIR}" doins strings.txt doins revision.txt doins icudt46b.dat doins icudt46l.dat doins icudt58b.dat doins icudt58l.dat # Documentation dodoc Changelog*.html dodoc Installation.txt dodoc License*.txt newdoc "${FILESDIR}/Gentoo-plugins-README.txt" Gentoo-plugins-README.txt # Configuration files insinto /etc/logitechmediaserver doins convert.conf doins types.conf doins modules.conf # Install init scripts newconfd "${FILESDIR}/logitechmediaserver.conf.d" logitechmediaserver newinitd "${FILESDIR}/logitechmediaserver.init.d" logitechmediaserver # Install preferences keepdir "${PREFSDIR}" fowners ${RUN_GID}:${RUN_UID} "${PREFSDIR}" fperms 770 "${PREFSDIR}" keepdir "${PREFSDIR}"/plugin fowners ${RUN_GID}:${RUN_UID} "${PREFSDIR}"/plugin fperms 770 "${PREFSDIR}"/plugin # Initialize server cache directory keepdir /var/lib/logitechmediaserver/cache fowners ${RUN_GID}:${RUN_UID} /var/lib/logitechmediaserver/cache fperms 770 /var/lib/logitechmediaserver/cache # Initialize the log directory keepdir /var/log/logitechmediaserver fowners ${RUN_GID}:${RUN_UID} /var/log/logitechmediaserver fperms 770 /var/log/logitechmediaserver # Initialise the user-installed plugins directory keepdir "${PLUGINSDIR}" fowners ${RUN_GID}:${RUN_UID} "${PLUGINSDIR}" fperms 770 "${PLUGINSDIR}" # Install logrotate support insinto /etc/logrotate.d newins "${FILESDIR}/logitechmediaserver.logrotate.d" logitechmediaserver ## # Install Avahi support (if USE flag is set) ## if use avahi; then ## insinto /etc/avahi/services ## newins "${FILESDIR}/avahi-logitechmediaserver.service" logitechmediaserver.service ## fi } pkg_postinst() { # FLAC and LAME are quite useful (but not essential) for Squeezebox Server - # if they're not enabled then make sure the user understands that. if ! use flac; then ewarn "'flac' USE flag is not set. Although not essential, FLAC is required" ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for" ewarn "playing other less common file types (if you have a Squeezebox 2 or newer)." ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag". ewarn "" fi if ! use lame; then ewarn "'lame' USE flag is not set. Although not essential, LAME is" ewarn "required if you want to limit the bandwidth your Squeezebox or" ewarn "Transporter uses when streaming audio." ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag". ewarn "" fi # Remind user to configure Avahi if necessary if use avahi; then elog "" elog "Avahi support installed. Remember to edit the folowing file if" elog "you run Logitech Media Server's web interface on a port other than 9000:" elog "\t/etc/avahi/services/logitechmediaserver.service" fi elog "" elog "Logitech Media Server can be started with the following command:" elog "\t/etc/init.d/logitechmediaserver start" elog "" elog "Logitech Media Server can be automatically started on each boot with the" elog "following command:" elog "\trc-update add logitechmediaserver default" elog "" elog "You might want to examine and modify the following configuration" elog "file before starting Logitech Media Server:" elog "\t/etc/conf.d/logitechmediaserver" elog "" # Discover the port number from the preferences, but if it isn't there # then report the standard one. httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${LIVE_PREFS}" 2>/dev/null) elog "You may access and configure Squeezebox Server by browsing to:" elog "\thttp://localhost:${httpport:-9000}/" elog "" }