Skip to content

Instantly share code, notes, and snippets.

@thorsteneckel
Last active March 8, 2019 13:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thorsteneckel/c0610fb415c8d0486bce to your computer and use it in GitHub Desktop.
Save thorsteneckel/c0610fb415c8d0486bce to your computer and use it in GitHub Desktop.
ejurgensen/forked-daapd on FreeBSD 10.1
#!/bin/sh
# PROVIDE: forked-daapd
# REQUIRE: avahi_daemon dbus
# Add the following lines to /etc/rc.conf to enable `forked-daapd':
#
# forked_daapd_enable="YES"
# forked_daapd_flags="<set as needed>"
. /etc/rc.subr
name="forked_daapd"
rcvar=`set_rcvar`
command="/usr/local/sbin/forked-daapd"
command_args=""
pidfile="/var/run/forked-daapd.pid"
required_files="/usr/local/etc/forked-daapd.conf"
# read configuration and set defaults
load_rc_config "$name"
: ${forked_daapd_enable="NO"}
run_rc_command "$1"

forked-daapd on FreeBSD 10.1

These are my steps installing 'ejurgensen/forked-daapd' on my FreeBSD 10.1 amd64 using user root and editor joe. Feedback would be great!

create working folder

export WORKDIR=/usr/local/src/forked-daapd
mkdir -p $WORKDIR
cd $WORKDIR

install dependencies

from pkg repository

# maybe 'pkg install automake' ?
pkg install gmake libantlr3c autoconf libtool gettext gperf glib libconfuse libevent2 mxml libgcrypt taglib libunistring libplist openjdk8-jre libiconv avahi-app avahi sqlite3 yasm pkgconf

OpenJDK fdescfs and procfs

This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and procfs(5) mounted on /proc.

If you have not done it yet, please do the following:

mount -t fdescfs fdesc /dev/fd
mount -t procfs proc /proc

To make it permanent, you need the following lines in /etc/fstab:

fdesc   /dev/fd         fdescfs         rw      0       0
proc    /proc           procfs          rw      0       0

create soundcard link ( you might want to install 'oss'? )

mkdir -p /usr/local/lib/oss/include/sys/
ln -sf /usr/include/sys/soundcard.h /usr/local/lib/oss/include/sys/

libavl_0.3.5

download and extract

cd $WORKDIR
curl -O http://www.debian.co.il/debian/pool/main/liba/libavl/libavl_0.3.5.orig.tar.gz
tar xzvf libavl_0.3.5.orig.tar.gz
cd avl-0.3.5

maybe fix GNUmakefile?

There might be an error in the 'GNUmakefile' of AVL while installing with make. Here is the fix: Change all $(LIBRARIES) variables to $(LIBRARY) in 'GNUmakefile'.

joe GNUmakefile

compile and install

gmake CC=clang CFLAGS=-fPIC
gmake install


antlr3

cd $WORKDIR
mkdir antlr3
cd antlr3
curl -O https://raw.githubusercontent.com/antlr/website-antlr3/gh-pages/download/antlr-3.4-complete.jar
mv antlr-3.4-complete.jar /usr/local/share/java/antlr-3.4-complete.jar
cd $WORKDIR
cd antlr3
echo '#!/bin/sh' > antlr3
echo 'export CLASSPATH' >> antlr3
echo 'CLASSPATH=$CLASSPATH:/usr/local/share/java/antlr-3.4-complete.jar:/usr/share/java /usr/local/openjdk8/bin/java org.antlr.Tool $*' >> antlr3
#echo exec /usr/local/bin/java -cp /usr/local/share/java/antlr-3.3-complete.jar org.antlr.Tool \"\$@\" >> antlr3
chmod u+x antlr3
mv antlr3 /usr/local/bin/antlr3

libantlr3c

cd $WORKDIR
#curl -O http://www.antlr3.org/download/C/libantlr3c-3.2.tar.gz
curl -O https://raw.githubusercontent.com/antlr/website-antlr3/gh-pages/download/C/libantlr3c-3.4.tar.gz
tar xzvf libantlr3c-3.4.tar.gz
cd libantlr3c-3.4
./configure --enable-64bit
gmake
gmake install

ffmpeg or libav

ffmpeg 2.3.3 from ports

If you might want aac support. Grab a cup of coffee - this might take a while.

# maybe 'pkg remove automake' ?
cd /usr/ports/multimedia/ffmpeg
make config
make install clean

libav 11.2 from ports

cd /usr/ports/multimedia/libav
make config
make install clean

ejurgensen/forked-daapd

compile and install

cd $WORKDIR
git clone https://github.com/ejurgensen/forked-daapd.git
cd forked-daapd
autoreconf -iv -Wno-portability
CFLAGS="-march=native -O2 -pipe" LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure --localstatedir=/var --with-oss4=/usr/local/lib/oss/include/sys --enable-itunes --enable-lastfm
gmake
gmake install

configure environment

backup and customize config

cp /usr/local/etc/forked-daapd.conf /usr/local/etc/forked-daapd.conf.sample
joe /usr/local/etc/forked-daapd.conf

add user and set permissions

useradd daapd
chown daapd:daapd /var/cache/forked-daapd

enable startup

joe /etc/rc.conf
dbus_enable="YES"
avahi_daemon_enable="YES"
forked_daapd_enable="YES"

rc.d script

open/create file
joe /usr/local/etc/rc.d/forked-daapd
insert attached file 'forked-daapd'
set permissions
chmod u+x /usr/local/etc/rc.d/forked-daapd
@sticilface
Copy link

That would be ace:)

Seems to all work. The only issue I have is when streaming music via airplay, if i got back to the album view and scroll the music just stops streaming. It is still playing in the remote, i have to pause and then play again and it is fine. And there is nothing in the log, even set to [DEBUG]. does this happen to you?

@sticilface
Copy link

OK, so chickens counted before eggs.

I can't get the remote to pair. This worked fine for version 23.3 which still supported freebsd 9 see owntone/owntone-server#239. but the airplay drops out whenever i browse the lib.

Forked-daapd compile, builds, and seems to run just fine.
I can only pair my iOS remote if i restart forked-daapd, and then i get remote cannot connect to iTunes. check your network settings.
so forked-daapd seems to 1) not pick up the .remote file, unless i restart. 2) then the pairing works. but it doesn't load.

have you had any of these troubles?

@ejurgensen
Copy link

I've added back pipe support and fixed a FreeBSD issue, so some of the above is no longer relevant.

See owntone/owntone-server#239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment