Monday, May 25, 2009

Mplayer Build Script for Slamd64 12.1

Most of unofficial package for Slamd64 Linux distribution can be found at http://builds.slamd64.com. However, some of the scripts are not well tested or work out-of-the-box, at least against Slamd64 12.1. One of such a script is the Mplayer build script. The build script for Mplayer lacks the PKGNAM variable which should be set to mplayer like this:

PKGNAM=mplayer

The lack of this variable in Slamd64 12.1 will cause package creation failure. I found this error after reading the pkghelper's scripts in the /etc/pkghelpers.d directory. This is the complete build script with the fix:

#!/bin/sh

# Slackware build script for mplayer

# Copyright 2006-2008 Robby Workman, Northport, AL, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Updated for slamd64, and to PHBuild

PRGNAM=mplayer
PKGNAM=mplayer
VERSION=${VERSION:-svn_20090413}
BUILD=${BUILD:-1}
TAG=${TAG:-_SB64}
TMP=${TMP:-/tmp/SB64}
OUTPUT=${OUTPUT:-/tmp}

. /etc/pkghelpers
pkghelpers_env

CODECSDIR=${CODECSDIR:-/usr/lib64/codecs}
RUNTIME_CPU=${RUNTIME_CPU:-yes}

if [ "$RUNTIME_CPU" = "yes" ]; then
do_cpu="en"
else
do_cpu="dis"
fi

# Additional languages + fonts
# Choices are: bg cs de dk el en es fr hu it ja ko mk nb
# nl pl ro ru sk sv tr uk pt_BR zh_CN zh_TW
OSDFONTS="LiberationSans-Regular.ttf DejaVuSans.ttf Arialuni.ttf arial.ttf Vera.ttf"
LANGUAGES=${LANGUAGES:-"en"}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION

# Fix permissions
pkghelpers_permissions

CFLAGS= \
./configure \
--prefix=/usr \
--libdir=/usr/lib$LIBSUFFIX \
--mandir=/usr/man \
--confdir=/etc/mplayer \
--enable-gui \
--${do_cpu}able-runtime-cpudetection \
--codecsdir="$CODECSDIR" \
--language="$LANGUAGES" \

make
make install DESTDIR=$PKG

# Now let's build the html docs
( cd DOCS/xml
for i in $(echo $LANGUAGES | tr , ' ') ; do
make MAKEFLAGS="-j1" html-single-$i ;
done
)

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHORS Changelog Copyright LICENSE README DOCS/tech \
$PKG/usr/doc/$PRGNAM-$VERSION
# This isn't exactly ideal, but it's better than having the entire
# script fail simply because the docs wouldn't build
( cp -a DOCS/HTML-single $PKG/usr/doc/$PRGNAM-$VERSION/html 2>/dev/null )
find $PKG/usr/doc/$PRGNAM-$VERSION -type d -name '.svn' | xargs rm -rf
cat $CWD/$PRGNAM.PHBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.PHBuild


# Don't clobber an existing config file
cat etc/example.conf > $PKG/etc/mplayer/mplayer.conf.new

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

# We'll link to one of the standard ttf fonts defined above.
# Thanks to Eric Hameleers for this code snippet and permission to use it.
cat << EOF >> $PKG/install/doinst.sh
# Symlink a default TrueType font for OSD:
if [ ! -f usr/share/mplayer/subfont.ttf ]; then
for font in $OSDFONTS ; do
if [ -f usr/share/fonts/TTF/\$font ]; then
( mkdir -p usr/share/mplayer
cd usr/share/mplayer
ln -fs /usr/share/fonts/TTF/\$font subfont.ttf
)
break
fi
done
fi
EOF

cd $PKG
pkghelpers_fixup
pkghelpers_makepkg

That's it. This fixed script has been tested in Slamd64 12.1 installation and works without a hitch.

Tuesday, May 19, 2009

Introduction to IP and ISDN

I didn't realize until just now that there is a very good introduction to IP+ISDN networks in the office web page :P. Well, not until the DNS relay/caching talks surfaced.
For those interested in the subject, this is the link:
http://www.abilis.net/fileadmin/tutorial/en/index.html

Even though the tutorial mainly talks about the Abilis product, the tutorial contains a lot of primer on IP+ISDN network architecture.