Press "Enter" to skip to content

Tag: lms

Logitech Media Server and FreeBSD

There are 3 ways to install Logitech Media Server on you FreeBSD computer: ports, packages and DIY (yes … you have to compile everything)

Ports

Just type:

pkg install portmaster
portmaster audio/logitechmediaserver

IMPORTANT: while configuring the options of all softwares you are going to install, when logitechmediaserver options will be prompted make sure that “TEST” will NOT be ticked.

Note that the last update of this port was at the 11th July 2017.

Packages

I have personally built packages from the ports because an LMS package is not available; due to this you have to add my repository to the package manager configuration file:

ee /etc/pkg/FreeBSD.conf

and add

audiodigitale: {
url: "http://audiodigitale.eu/repo/freebsd/pkgs",
mirror_type: "http",
enabled: yes
}

then you can:

pkg update
pkg install logitechmediaserver

Note that the last update was at the 6th January 2018.

DIY, aka: compile everything from source

Before starting this is what you need:

  • libtime.a
  • libpatience.a
  • Knowledges about what are jails (I will use CBSD to manage them)

Let’s start creating a jail that we will use to build everything:

cbsd jconstruct-tui

In “pkglist” insert manually:

unzip bash gmake rsync nasm wget libgd gcc perl5-5.24.1 automake libtool

Enter in the jail:

cbsd jstart build
cbsd jlogin build

I’m going to use /tmp to download everything and build lms:

cd /tmp
wget http://downloads.slimdevices.com/nightly/7.9/sc/3adb1b4/logitechmediaserver-7.9.1-1489743085.tgz
wget https://github.com/Logitech/slimserver-vendor/archive/public/7.9.zip
unzip 7*
tar xjf l*

Let’s start compiling:

cd slimserver-vendor-public-7.9/CPAN
./buildme.sh -t | tee /tmp/build.log
cd /tmp/logitechmediaserver-7.9.1-1489743085/CPAN/arch/5.24
rm -rf 5.1* && rm -rf 5.8 && rm -rf 5.22 && rm -rf 5.20
cp -Rp /tmp/slimserver-vendor-public-7.9/CPAN/build/arch/5.24/amd64-freebsd-thread-multi .
rm -rf x*

cd /tmp
tar cf FreeBSD-lms-7.9.1.tar logitechmediaserver-7.9.1-1489743085

wget http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz
tar xf f*
cd flac-1.3.2
autoreconf -i
./configure --enable-static --disable-shared
make

cd /tmp
wget http://downloads.sourceforge.net/faac/faad2-2.7.zip
unzip faad2-2.7.zip
cd faad2-2.7
./configure --enable-static --disable-shared
make

cd /tmp
wget http://www.wavpack.com/wavpack-5.1.0.tar.bz2
tar xf wavpack-5.1.0.tar.bz2
cd wavpack-5.1.0
autoreconf -i
./configure --enable-static --disable-shared
make

Now we have to exit from this jail and move everything we have just compiled to a new jail when logitechmediaserver will run.

First of all exit from the build jail:

exit

Create a new jail like we did before including the following packages:

wget perl5-5.24.1 libiconv

cbsd jstart lms
mv /usr/jails/jails-data/build-data/tmp/FreeBSD-lms-7.9.1.tar /usr/jails/jails-data/lms-data/tmp
cbsd jlogin lms

Now I’m going to copy lms and the binaries we have compile above in the “lms” jail. I will include the modified version of SoX able to convert in DSD; for further info: Logitechmediaserver, C-3PO and PCM to DSD conversion

cd /tmp
tar xf F*
pw groupadd -n lms -g 20000
pw useradd -n lms -u 20000 -g lms -s /usr/sbin/nologin -c "Logitech Media Server" -d /nonexistent
mkdir /usr/local/lms
mv logitechmediaserver-7.9.1-1489743085 /usr/local/lms/
cd /usr/local/lms
mv logitechmediaserver-7.9.1-1489743085/* /usr/local/lms
rmdir logitechmediaserver-7.9.1-1489743085
rm -rf Bin/a* && rm -rf Bin/i* && rm -rf Bin/p* && rm -rf Bin/s* && rm -rf Bin/x*
cd Bin
wget https://audiodigitale.eu/repo/sox/sox-FreeBSD
mv sox-FreeBSD sox

exit

Move flac, faad, wavpack binaries into the Bin folder of LMS:

mv /usr/jails/jails-data/build-data/tmp/flac-1.3.2/src/flac/flac /usr/jails/jails-data/lms-data/usr/local/lms/Bin/
mv /usr/jails/jails-data/build-data/tmp/faad2-2.7/frontend/faad /usr/jails/jails-data/lms-data/usr/local/lms/Bin/
mv /usr/jails/jails-data/build-data/tmp/wavpack-5.1.0/cli/wvunpack /usr/jails/jails-data/lms-data/usr/local/lms/Bin/

Back into lms jail:

cbsd jlogin lms
chown -R lms:lms /usr/local/lms
chmod -R 755 /usr/local/lms/Bin
mkdir /var/log/lms
mkdir /var/db/lms
mkdir /var/db/lms/cache
mkdir /var/db/lms/prefs
mkdir /var/db/lms/playlists
chown -R lms:lms /var/db/lms
chown -R lms:lms /var/log/lms
cd /etc/rc.d
wget https://audiodigitale.eu/repo/freebsd/lms
chmod 555 lms
echo 'lms_enable="YES"' >> /etc/rc.conf && echo 'lms_logdir="/var/log/lms"' >> /etc/rc.conf && echo 'lms_cachedir="/var/db/lms/cache"' >> /etc/rc.conf && echo 'lms_prefsdir="/var/db/lms/prefs"' >> /etc/rc.conf && echo 'lms_playlistdir="/var/db/lms/playlists"' >> /etc/rc.conf

exit

Now restart the jail and Logitech Media Server will start at boot (if you are lucky 😉 )

cbsd jstop lms
cbsd jstart lms