January 03, 2013

Handbrake on SLED 11 SP2 revisited

Follow-up to Handbrake on SLED 11 SP2 from Mike's blag

I decided to figure out what needed to be done to build the currently current version of Handbrake, 0.9.8, on SLED 11 SP2.

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Install these packages: doxygen yasm patch autoconf automake libbz2-devel libwebkit-devel libnotify-devel libgudev-1_0-devel gstreamer-0_10-plugins-base-devel dbus-1-glib-devel libtool gcc gcc-c++ intltool gtk2-devel glib2-devel zlib-devel libogg-devel

Then run the following commands. hbinstdir is where Handbrake gets installed to, change the value if you want. You can omit the lines relating to libdvdcss if you already have that installed somewhere Handbrake will find it, or if you don't want to be able to rip any DVDs that use CSS.

$ hbinstdir=/local/myapps/handbrake/
$ mkdir handbrakebuild
$ cd handbrakebuild
$ curl http://ftp.gnu.org/gnu/automake/automake-1.12.tar.gz | tar xvfz -
$ cd automake-1.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd "${hbinstdir}"share/aclocal
$ for i in /usr/share/aclocal/*;do ln -s $i;done
$ cd -
$ cd ..
$ curl http://fribidi.org/download/fribidi-0.19.5.tar.bz2 | tar xvfj -
$ cd fribidi-0.19.5/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ curl http://download.videolan.org/pub/libdvdcss/1.2.12/libdvdcss-1.2.12.tar.bz2 | tar xvfj -
$ cd libdvdcss-1.2.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ export PATH="${hbinstdir}bin:${PATH}"
$ export FRIBIDI_LIBS="-L${hbinstdir}lib/ -lfribidi"
$ export FRIBIDI_CFLAGS="-I${hbinstdir}include/"
$ export LDFLAGS="-L${hbinstdir}lib/ -lfribidi"
$ curl -L "http://downloads.sourceforge.net/project/handbrake/0.9.8/HandBrake-0.9.8.tar.bz2?r=http%3A%2F%2Fhandbrake.fr%2Fdownloads.php&ts=1356991772&use_mirror=garr" | tar xvfj -
$ cd HandBrake-0.9.8
$ sed -i 's/autoreconf -I m4 -fiv/sh autogen.sh/' contrib/libvorbis/module.defs
$ ./configure --prefix="${hbinstdir}" --launch --launch-jobs=0 --verbose

Assuming the build process finishes without errors then install

$ cd build && make install

The binaries have been compiled against fribidi-0.19.5 but they're dynamically linked. So if you have the version of fribidi that's included with SLED installed the binaries will find and use that by default. If you don't have fribidi installed, they'll be looking for something that doesn't exist. So to make the binaries look at the right version of fribidi they need to be run in a wrapper

$ cd "${hbinstdir}/bin"
$ mv ghb ghb.real
$ mv HandBrakeCLI HandBrakeCLI.real
$ cat > ghb << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
ghb.real
EOF
$ chmod u+x ghb
$ cat > HandBrakeCLI << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
HandBrakeCLI.real
EOF
$ chmod u+x HandBrakeCLI

Run Handbrake with

$ /replace_with_whatever_you_set_hbinstdir_to/bin/ghb

The tweak to libvorbis/module.defs comes from http://benjisimon.blogspot.co.uk/2012/04/gotcha-of-day-building-handbrake-on.html

Initially I used LIBRARY_PATH=${hbinstdir}lib/ instead of LDFLAGS but system locations are searched before anything specified in LIBRARY_PATH and if you have fribidi-devel installed that's found first and the Handbrake build fails.

I also initially used export PKG_CONFIG_PATH="${hbinstdir}/lib/pkgconfig/" instead of FRIBIDI_CFLAGS and FRIBIDI_LIBS but the Handbrake build process was still finding the system version. I eventually realised the Handbrake build process sets it's own value for PKG_CONFIG_PATH which overwrites anything you've set.



- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Search this blog

Tags

Not signed in
Sign in

Powered by BlogBuilder
© MMXXIV