neuhalfen.name

A random collection of posts

Packaging Mencoder on Solaris 11

Permalink

Building mencoder with Xvid, lame but unfortunately not with h.264 support.

yasni

export PKGROOT=$HOME/yasm
mkdir $PKGROOT && cd $PKGROOT
[ -d root ] && rm -rf root
git clone git://github.com/yasm/yasm.git src
cd src
./autogen.sh
# it errs :-(

aclocal missing

./autogen.sh
You must have aclocal installed to compile yasm.
Download the appropriate package for your system,
or get the source from one of the GNU ftp sites
listed in http://www.gnu.org/order/ftp.html
You must have automake installed to compile yasm.
Download the appropriate package for your system,
or get the source from one of the GNU ftp sites
listed in http://www.gnu.org/order/ftp.html

Solution:

pkg install -v developer/build/autoconf developer/build/libtool developer/build/automake-110
gsed -i -e 's!aclocal !/usr/bin/aclocal-1.10 !' -e 's!automake !/usr/bin/automake-1.10 !' autogen.sh

building yasni

./autogen.sh
# everything is ok
./configure --prefix=$(pwd)/../root/usr/
make && make install

packaging yasni

cd $PKGROOT
ls
# root src
pkgsend generate root > MANIFEST.files
pkgdepend generate -d root MANIFEST.files > depend
pkgdepend resolve depend
ls *.res
# depend.res
# cat depend.res
# depend fmri=pkg:/system/library@0.5.11-0.151.0.1 type=require
cat <<EOF>MANIFEST.meta
set name=maintainer value="Jens Neuhalfen <jens@neuhalfen.name>"
set name=upstream_url value="http://yasm.tortall.net"
set name=description value="The Yasm Modular Assembler Project"
set name=variant.arch value=i386
license ../src/COPYING license=BSD
EOF
cat *res >> MANIFEST.meta
pkgfmt MANIFEST.*
cat <<EOF>send.sh
#!/bin/bash
IPS_SERVER=http://ips.local.neuhalfen.name:80
export NAME=developer/yasm
export VERSION=1.1.0
export BUILD=1
export PACKAGE=\${NAME}@\${VERSION}-\${BUILD}
cd $(pwd)
export PKGSEND="pkgsend -s \$IPS_SERVER"
eval \`\$PKGSEND open \$PACKAGE\`
\$PKGSEND include -d root MANIFEST.meta
\$PKGSEND include -d root MANIFEST.files
\$PKGSEND close
EOF
sh send.sh

mp3lame

First download the source

export PKGROOT=$HOME/lame
mkdir $PKGROOT && cd $PKGROOT
[ -d root ] && rm -rf root
[ -d src ] && rm -rf src
[ -d root ] && rm -rf root
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1318702669&use_mirror=netcologne
tar xfz lame-3.99.tar.gz
mv lame-3.99 src
cd src/
./configure --prefix=$PKGROOT/root/usr/ --enable-shared --with-pic --disable-static
make
make install

packaging lame

cd $PKGROOT
ls
# lame-3.99.tar.gz root src
pkgsend generate root > MANIFEST.files
pkgdepend generate -d root MANIFEST.files > depend
rm *.res
pkgdepend resolve depend
ls *.res
# depend.res
# cat depend.res
# depend fmri=pkg:/system/library/gcc-3-runtime@3.4.3-0.151.0.1 type=require
# depend fmri=pkg:/system/library/math@0.5.11-0.151.0.1 type=require
# depend fmri=pkg:/system/library@0.5.11-0.151.0.1 type=require
cat <<EOF>MANIFEST.meta
set name=maintainer value="Jens Neuhalfen <jens@neuhalfen.name>"
set name=upstream_url value="http://lame.sourceforge.net/"
set name=description value="Lame codec"
set name=variant.arch value=i386
license ../src/COPYING license=LGPLv2
EOF
cat *res >> MANIFEST.meta
pkgfmt MANIFEST.*
cat <<EOF>send.sh
#!/bin/bash
IPS_SERVER=http://ips.local.neuhalfen.name:80
export NAME=library/codec/lamemp3
export VERSION=3.99
export BUILD=1
export PACKAGE=\${NAME}@\${VERSION}-\${BUILD}
cd $(pwd)
export PKGSEND="pkgsend -s \$IPS_SERVER"
eval \`\$PKGSEND open \$PACKAGE\`
\$PKGSEND include -d root MANIFEST.meta
\$PKGSEND include -d root MANIFEST.files
\$PKGSEND close
EOF
sh send.sh

Xvid

First download the source

export PKGROOT=$HOME/Xvid
mkdir $PKGROOT && cd $PKGROOT
[ -d src ] && rm -rf src
[ -d root ] && rm -rf root
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar xfz xvidcore-1.3.2.tar.gz
mv xvidcore src
cd src/build/generic
./configure --prefix=$PKGROOT/root/usr/
# ...
make
# ...
# ld: fatal: unrecognized option '--'

error while linking

The Xvid build needs to be patched (courtesy of Serious Webapps)

diff Makefile.orig Makefile
137c137
< @cd $(BUILD_DIR) && $(CC) $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS)
---
> @cd $(BUILD_DIR) && /bin/ld $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS)

and

diff platform.inc.orig platform.inc
49c49,51
< SPECIFIC_LDFLAGS=-Wl,-soname,libxvidcore.$(SHARED_EXTENSION).$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm -lpthread
---
> #SPECIFIC_LDFLAGS=-Wl,-soname,libxvidcore.$(SHARED_EXTENSION).$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm -lpthread
> SPECIFIC_LDFLAGS=-h libxvidcore.$(SHARED_EXTENSION).$(API_MAJOR) -B dynamic -shared -M libxvidcore.ld -lc -lm -lpthread
>

Now we can compile:

make
make install

packaging Xvid

cd $PKGROOT
ls
# root src xvidcore-1.3.2.tar.gz
pkgsend generate root > MANIFEST.files
pkgdepend generate -d root MANIFEST.files > depend
rm *.res
pkgdepend resolve depend
ls *.res
# depend.res
# cat depend.res
# depend fmri=pkg:/system/library@0.5.11-0.151.0.1 type=require
cat <<EOF>MANIFEST.meta
set name=maintainer value="Jens Neuhalfen <jens@neuhalfen.name>"
set name=upstream_url value="http://www.xvid.org"
set name=description value="Xvid codec"
set name=variant.arch value=i386
license ../src/LICENSE license=GPLv2
EOF
cat *res >> MANIFEST.meta
pkgfmt MANIFEST.*
cat <<EOF>send.sh
#!/bin/bash
IPS_SERVER=http://ips.local.neuhalfen.name:80
export NAME=library/codec/Xvid
export VERSION=1.3.2
export BUILD=1
export PACKAGE=\${NAME}@\${VERSION}-\${BUILD}
cd $(pwd)
export PKGSEND="pkgsend -s \$IPS_SERVER"
eval \`\$PKGSEND open \$PACKAGE\`
\$PKGSEND include -d root MANIFEST.meta
\$PKGSEND include -d root MANIFEST.files
\$PKGSEND close
EOF
sh send.sh

h.264

Compiling h.264 (the library) does not work yet. Compiling only the executeable works though.

make

export PKGROOT=$HOME/h.264
mkdir -p $PKGROOT
cd $PKGROOT
git clone git://git.videolan.org/x264.git src
[ -d root ] && rm -rf root
cd src/
# --enable-shared kills the build later on :-(
./configure --enable-pic --enable-shared --prefix=$PKGROOT/root/usr/
Platform: X86
System: SunOS
cli: yes
libx264: internal
shared: yes
static: no
asm: yes
interlaced: yes
avs: no
lavf: no
ffms: no
gpac: no
gpl: yes
thread: posix
filters: crop select_every
debug: no
gprof: no
strip: no
PIC: yes
visualize: no
bit depth: 8
You can run 'make' or 'make fprofiled' now.
make
# ...
# ld: fatal: relocations remain against allocatable but non-writable sections
# collect2: ld returned 1 exit status
# make: *** [libx264.so.118] Error 1
# Bummer - still broken

make install

make install
# install -d /home/jens/h.264/root/usr//bin
# directory /home/jens/h.264/root/usr//bin created
# install x264 /home/jens/h.264/root/usr//bin
# find: cannot read dir /etc/openssl/private: Permission denied
# find: cannot read dir /etc/inet/secret: Permission denied
# find: cannot read dir /etc/flash/precreation: Permission denied
# find: cannot read dir /etc/flash/postcreation: Permission denied
# find: cannot read dir /etc/flash/preexit: Permission denied
# find: cannot read dir /etc/sfw/openssl/private: Permission denied
# find: cycle detected for /lib/secure/32/
# find: cycle detected for /lib/crypto/32/
# find: cycle detected for /lib/32/
# find: cycle detected for /usr/lib/link_audit/32/
# find: cycle detected for /usr/lib/secure/32/
# find: cycle detected for /usr/lib/32/
# find: cycle detected for /usr/lib/lwp/32/
# install: x264 was not found anywhere!
# make: *** [install-cli] Error 2
# install ginstall
pkg install pkg:/file/gnu-coreutils
# use ginstall instead of install
gsed -i.orig -e 's/\([\t]\)install/\1ginstall/' Makefile
make install

packaging H264

You’ll only get here if you compile “without dynamic”.

cd $PKGROOT
ls
# root src
pkgsend generate root > MANIFEST.files
pkgdepend generate -d root MANIFEST.files > depend
rm *.res
pkgdepend resolve depend
ls *.res
# depend.res
# cat depend.res
# depend fmri=pkg:/system/library/math@0.5.11-0.151.0.1 type=require
# depend fmri=pkg:/system/library@0.5.11-0.151.0.1 type=require
cat <<EOF>MANIFEST.meta
set name=maintainer value="Jens Neuhalfen <jens@neuhalfen.name>"
set name=upstream_url value="http://www.xvid.org"
set name=description value="h.264 encoder"
set name=variant.arch value=i386
license ../src/COPYING license=GPLv2
EOF
cat *res >> MANIFEST.meta
pkgfmt MANIFEST.*
cat <<EOF>send.sh
#!/bin/bash
IPS_SERVER=http://ips.local.neuhalfen.name:80
export NAME=library/codec/Xvid
export VERSION=1.3.2
export BUILD=1
export PACKAGE=\${NAME}@\${VERSION}-\${BUILD}
cd $(pwd)
export PKGSEND="pkgsend -s \$IPS_SERVER"
eval \`\$PKGSEND open \$PACKAGE\`
\$PKGSEND include -d root MANIFEST.meta
\$PKGSEND include -d root MANIFEST.files
\$PKGSEND close
EOF
sh send.sh

mencoder

prerequisites

pkg install yasm git gcc Xvid gawk pkg:/system/library/freetype-2

building

export PKGROOT=$HOME/mencoder
mkdir -p $PKGROOT
wget http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
bunzip2 mplayer-export-snapshot.tar.bz2
tar xf mplayer-export-snapshot.tar
cd mplayer-export-2011-10-13/
./configure --help
No FFmpeg checkout, press enter to download one with git or CTRL+C to abort
Initialized empty Git repository in /home/jens/mencoder/src/mplayer-export-2011-10-13/ffmpeg/.git/
remote: Counting objects: 6741, done.
remote: Compressing objects: 100% (4536/4536), done.
remote: Total 6741 (delta 4105), reused 3875 (delta 2082)
Receiving objects: 100% (6741/6741), 9.35 MiB | 1515 KiB/s, done.
Resolving deltas: 100% (4105/4105), done.
Usage: ./configure [OPTIONS]...
# ...
./configure
error: unknown option `ff-only'
usage: git-fetch [options] [<repository> <refspec>...]
.....

The version of git shipped with Solaris is rather old (1.5.6), so we need to patch the configure script. Also, the configure scripts cannot detect the system architecture (Error: unsupported architecture UNKNOWN):

# Make the pre-rebase hook executeable, git rebase will refuse to work otherwise (you might as well delete the script)
chmod 755 ffmpeg/.git/hooks/pre-rebase
diff configure.orig configure
44c44
< if ! (cd ffmpeg && git pull --rebase --ff-only) ; then
---
> if ! (cd ffmpeg && git fetch && git rebase origin/master) ; then
1494c1494
< x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;;
---
> i86pc|x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;;

Now it is time to build

export PATH=/usr/gnu/bin:$PATH
./configure --prefix=$PKGROOT/root/usr --disable-tremor-internal
#
# add an #include <alloca.h> to loader/pe_image.c
gsed -i -e '/#include <assert.h>/i#include <alloca.h>' loader/pe_image.image.c
# The freetype headers are located elsewhere in solaris
CPPFLAGS=-I/usr/include/freetype2 make
make INSTALL=ginstall install

packaging

cd $PKGROOT
ls
# root src
pkgsend generate root > MANIFEST.files
pkgdepend generate -d root MANIFEST.files > depend
rm *.res
pkgdepend resolve depend
ls *.res
# depend.res
cat <<EOF>MANIFEST.meta
set name=maintainer value="Jens Neuhalfen <jens@neuhalfen.name>"
set name=upstream_url value="http://www.mplayerhq.hu/"
set name=description value="mplayer"
set name=variant.arch value=i386
license .././src/mplayer-export-2011-10-13/LICENSE license=GPLv2
EOF
cat *.res >> MANIFEST.meta
echo depend fmri=pkg:/system/library/gcc-3-runtime type=require>> MANIFEST.meta
pkgfmt MANIFEST.*
cat <<EOF>send.sh
#!/bin/bash
IPS_SERVER=http://ips.local.neuhalfen.name:80
export NAME=multimedia/mencoder
export VERSION=2011.10.13
export BUILD=1
export PACKAGE=\${NAME}@\${VERSION}-\${BUILD}
cd $(pwd)
export PKGSEND="pkgsend -s \$IPS_SERVER"
eval \`\$PKGSEND open \$PACKAGE\`
\$PKGSEND include -d root MANIFEST.meta
\$PKGSEND include -d root MANIFEST.files
\$PKGSEND close
EOF
sh send.sh

iconv: conversion from UTF-8 to 646 unsupported

If you get tons of iconv: conversion from UTF-8 to 646 unsupported, set the environment variable MPLAYER_CHARSET to noconv. This seems to be a bug in the Solaris iconv implementation (here).

https://www.opencsw.org/mantis/view.php?id=2614

Comments