Could it be useful to any NetBSD 2 users

*Liquidsoap for NetBSD 2.1 with last.fm: quick workarounds for pkgsrc*

1) General precaution: the LAME 3.97 package in pkgsrc is inappropriate
for liquidsoap.
It will crash liquidsoap each time it is used with the following errors:
Internal buffer inconsistency. flushbits <> ResvSizeInternal buffer
inconsistency.
Internal buffer inconsistency. flushbits <> ResvSizeError:
MAX_HEADER_BUF too small in bitstream.c

Install a later revision (e.g. force the installation of 3.98 in the
Makefile of the pkgsrc package) and don't use any optimisation more than
O (e.g. put CFLAGS += -O at the end of the pkgsrc Makefile)

2) The ocamlnet package from pkgsrc is too old for Liquidsoap.
Liquidsoap requires netclient (found in ocamlnet 2), only ocamlnet 1 is
provided by pkgsrc.
>cd /usr/pkgsrc/net/ocamlnet
>vi Makefile
change the version with one from the 2.X branch (e.g.
DISTNAME=ocamlnet-2.2.9)
>make extract NO_CHECKSUM=yes
>cd work/ocamlnet-2.2.9/src/
>./configure
>vi Makefile.conf
Remove from PKG_LIST all the modules you won't need (the minimal set
appears to be: netsys equeue netstring netclient)
>gmake && gmake opt && gmake opt install
>chmod -R a+r /usr/pkg/lib/ocaml/site-lib

3) xml-light (ocaml-xml-light) is not a pkgrc package.
You must compile ocaml-xml-light manually.
Download and decompress it somewhere.
>configure && make && make install
Download xml-light-2.2.zip
Download the Debian patch xml-light_2.2-8.diff.gz (it is used to make
xml-light compatible with ocaml-find)
Decompress the two archives in a same directory, somewhere.
>mv xml-light xml-light-2.2
>patch -p0 < xml-light_2.2-8.diff
>patch -p0 < xml-light-2.2/debian/patches/*.dpatch
>cd xml-light-2.2
>gmake
>gmake opt
copy the Debian META in the root directory of xml-light, modify it to
reflect your actual version of xml-light
>ocamlfind install xml-light META xml-light.cma xml-light.cmxa
xml-light.cma xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi
dtd.cmi xml-light.a xml-light.cmxa xml.cmx dtd.cmx
xmlParser.cmx

If you can't make xml-light compatible with ocaml-light, you can force
its detection when building Liquidsoap.
Before compiling Liquidsoap type at the prompt:
>export CPPFLAGS="-I/usr/include -I/usr/pkg/include"
>export CFLAGS="-I/usr/include -I/usr/pkg/include"
>export LDFLAGS="-L/usr/lib -L/usr/pkg/lib"
>export OCAMLMKLIB_FLAGS="-L/usr/pkg/lib/ocaml -L/usr/lib -L/usr/pkg/lib
-I/usr/include -I/usr/pkg/include"

4) I've never been able to run a daemonized instance of Liquidsoap on
NetBSD.
You may run it detached in the background though.
Here's a small rc.d conf file if needed:

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/bin
export PATH

if [ -f /etc/rc.subr ]
then
        . /etc/rc.subr
fi

name="liquidsoap"
rcvar=${name}
command="/home/overfitted/radio/liquidsoap/bin/${name}"
pidfile="/tmp/${name}.pid"

liquidsoap_user="liquidsoap"
liquidsoap_group="www"

extra_commands="status check"

start_cmd="liquidsoap_start"
stop_cmd="liquidsoap_stop"
status_cmd="liquidsoap_status"
restart_cmd="liquidsoap_restart"
check_cmd="liquidsoap_check"

liquidsoap_start()
{
        PID="`ps -ax|grep "${command}"|grep -v grep|awk '{print $1;}'`"
        if [ "${PID}" != "" ] ; then
                echo "${name} already running as pid ${PID}."
                return 1
        fi
        if [ -n ${rc_flags} ]; then
                #(nice -n -5 su -m ${liquidsoap_user} -c "${command}
${rc_flags} &") && echo "Starting ${name}."
                (nice -n -5 su -m ${liquidsoap_user} -c "${command} -u
${rc_flags} &") && echo "Starting ${name}."
                ps -ax|grep "${command}"|grep -v grep|awk '{print $1;}'
> ${pidfile} && chown ${liquidsoap_user} ${pidfile}
        else
                echo "${name} cannot start. Please specify a script to
interpret. ${rc_flags} are not proper parameters."
        fi
}

liquidsoap_stop()
{
        PID=`ps -ax|grep "${command}"|grep -v grep|awk '{print $1;}'`
        if [ "${PID}" != "" ] ; then
                        echo -n "Stopping ${name}."
                        echo -n '['
                        for WAIT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
                        do
                                if kill -0 ${PID} >/dev/null 2>&1; then
                                        sleep 2
                                        echo -n '.'
                                        test $WAIT -lt 15 || kill ${PID}
                                else
                                        break
                                fi
                        done
                        echo '].'
                        unset WAIT
                        rm -f ${pidfile}
        else
                echo "${name} is not running?"
        fi

}

liquidsoap_status()
{
        PID="`ps -ax|grep "${command}"|grep -v grep|awk '{print $1;}'`"
        if [ "${PID}" != "" ] ; then
                echo "${name} is running as pid ${PID}."
        else
                echo "${name} is not running?"
        fi
}

liquidsoap_check()
{
        if [ -n ${rc_flags} ]; then
                (nice -n -5 su -m ${liquidsoap_user} -c "${command} -c
${rc_flags}") && echo "${name} config file checked."
        else
                echo "${name} cannot start. Please specify a script to
interpret. ${rc_flags} are not proper parameters."
        fi
}

liquidsoap_restart()
{
        liquidsoap_stop
        sleep 5
        liquidsoap_start
}

load_rc_config $name
run_rc_command "$1"


The problem with a non-daemonized version of Liquidsoap running in the
background is that you can't make it aware of log rotation, which means
that this facility is lost, unfortunately.
If you use i.e. newsyslog, liquidsoap doesn't react to SIGUSR1 when
detached: you will end up logging into nothing.
/var/log/liquidsoaplog  liquidsoap:www          640  7    250  *    Z
/home/overfitted/radio/liquidsoap/var/run/liquidsoap.pid        SIGUSR1


Good luck (some -a lot of- typos and inaccuracies may have been written
above)

-- 
best regards,
sincèrement,

okay_awright
<okay_awrightATddcrDOTbiz>
Public PGP key on request

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to