Tuesday, November 23, 2010

Install VLC on Slackware 13.1

,
I think VLC is the most powerful video application that available on Linux. Yesterday I had tried to install it on my Slackware 13.1 system, but there's an error while compiling the application due to incompatible part of libpng 1.4.x code. This problem can be solved if we use the patch of libpng 1.4.x.
In this article I will show you how I compile and install VLC on my system. Before install the VLC, I have tried to install the dependencies as many as I can get them. Here's the ordered list of the deps :
  1. a52dec
    a52dec is a test program for liba52. It decodes ATSC A/52 streams, and also includes a demultiplexer for mpeg-1 and mpeg-2 program streams. This package also includes liba52. liba52 is a free library for decoding ATSC A/52 streams.
  2. amrnb
    This library is an effort to link against the amrnb-codec, standardized by the 3GPP.
  3. amrwb
    This is library is an effort to link against the amrwb-codec, standardized by the 3GPP
  4. libdaemon
    Libdaemon is a lightweight C library that eases the writing of UNIX daemons.
  5. avahi (require libdaemon)
    Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing.  It uses D-BUS for communication between user applications and a system daemon.  The daemon is used to coordinate application efforts in caching replies, necessary to minimize the traffic imposed on networks.
  6. dirac
    Dirac is a open and royalty free high quality codec developed by BBC Research.
  7. enca
    Enca detects the encoding of text files, on the basis of knowledge of their language. It can also convert them to other encodings, allowing you to recode files without knowing their current encoding. It supports most of Central and East European languages, and a few Unicode variants, independently on language.
  8. mp4v2
    This library provides functions to read, create, and modify mp4 files.  This is a standalone version of mp4v2 library.
  9. faac (strongly recommend mp4v2)
    FAAC is an Advanced Audio Coder (MPEG2-AAC, MPEG4-AAC). The goal of FAAC is to explore the possibilities of AAC and exceed the quality of the currently best MP3 encoders.
  10. faad2
    Faad2 is the fastest ISO AAC audio decoder available. Faad2 correctly decodes all MPEG-4 and MPEG-2 MAIN, LC (Low Complexity), HE (High Efficiency), LTP (Long Term Prediction), LD (Low Delay), and ER (Error Resiliency) object type AAC files. Faad2 includes code for SBR (HE AAC) decoding.
  11. lame
    LAME is an educational tool to be used for learning about MP3 encoding. The goal of the LAME project is to use the open source model to improvethe psycho acoustics, noise shaping, and speed of MP3.
  12. twolame (backend only)
    TwoLAME is an optimized MPEG Audio Layer 2 (MP2) encoder. TwoLAME should be able to be used as a drop-in replacement for LAME (a MPEG Layer 3 encoder). If you want to install the frontend, you will need the libsndfile.
  13. libass
    libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format. It is mostly compatible with VSFilter. Since I installed enca before, I pass the --enable-enca while running the configure script.
  14. libdc1394
    libdc1394 is a library that provides a complete high level application programming interface (API) for developers who wish to control IEEE 1394 based cameras that conform to the 1394-based Digital Camera Specifications(also known as the IIDC or DCAM Specifications).
  15. libdvbpsi
    libdvbpsi is a simple library designed for decoding and generation of MPEG TS and DVB PSI tables.
  16. libdvdcss
    libdvdcss is a cross-platform library for transparent DVD device access with on-the-fly CSS decryption.
  17. libdvdnav
    libdvdnav is a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback, and even interactive DVD games.
  18. libdvdread
    libdvdread provides a simple foundation for reading DVD video disks.  It provides the functionality that is required to access many DVDs.  It parses IFO files, reads NAV-blocks, and performs CSS authentication and descrambling.
  19. libmpeg2
    libmpeg2 is a free library for decoding mpeg-2 and mpeg-1 video streams.
  20. libv4l
    libv4l is a collection of libraries which adds a thin abstraction layer on top of video4linux2 devices.
  21. live555
    This code forms a set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP).
  22. lua
    Lua is a free software light-weight programming language designed for extending applications.
  23. openjpeg
    The OpenJPEG library is an open-source JPEG 2000 codec.
  24. orc
    Orc is a library and set of tools for compiling and executing very simple programs that operate on arrays of data. The language is a generic assembly language that represents many of the features available in SIMD architectures, including saturated addition and subtraction, and many arithmetic operations.
  25. schroedinger
    Schrodinger is a high-speed implementation in C of the Dirac codec. It requires orc for version 1.0.9 or higher.
  26. speex
    Speex is an Open Source/Free Software patent-free audio compression
    format designed for speech.
  27. yasm
    Yasm is a complete rewrite of the NASM assembler under the "new"
    BSD License.
  28. libvpx (requires yasm)
    Libvpx is the successor of the VP3 codec, on which the Theora codec was based.
  29. x264
    x264 is a free library for encoding H264/AVC video streams.
  30. Xvidcore
    Xvid is an ISO MPEG-4 compliant video codec. Xvid claims to be the best currently available MPEG-4 video codec solution.
  31. opencore-amr
    OpenCORE Adaptive Multi Rate (AMR) speech codec library implementation. This library contains an implementation of the 3GPP TS 26.073 specification for the Adaptive Multi Rate (AMR) speech codec and an implementation for the 3GPP TS 26.173 specification for the Adaptive Multi-Rate - Wideband (AMR-WB) speech decoder.
  32. graphviz
    Graphviz is open source graph visualization software.  It has several main graph layout programs.  It also has web and interactive graphical interfaces, and auxiliary tools, libraries, and language bindings.
  33. libebml
    libebml is a C++ libary to parse EBML files. EBML (Extensible Binary
    Meta-Language library) is a simple XML like binary language for describing data in structured style.
  34. libmatroska (requires libebml)
    libmatroska is a C++ libary to parse Matroska files (.mkv and .mka).
  35. rtmpdump
    rtmpdump is a toolkit for RTMP streams. All forms of RTMP are supported, including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://.
  36. gsm
    gsm contains command line utilities and libgsm, an implementation of the European GSM 06.10 provisional standard for full-rate speech transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse excitation/long term prediction) coding at 13 kbit/s.
  37. ffmpeg
    FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. I'm  enabling the following libraries to the configure script, since I have install it before : DC1394, DIRAC, FAAC, FAAD, GSM, JP2, LAME, OPENCORE, RTMP, SCHROEDINGER, SPEEX, VPX, X264, XVID.
  38. libdv
    The Quasar DV codec (libdv) is a software codec for DV video. DV is the encoding format used by most digital camcorders, typically those that support the IEEE 1394 (aka FireWire or i.Link) interface.
  39. libshout (requires speex)
    Libshout is a library for communicating with and sending data to an icecast server.  It handles the socket connection, the timing of the data, and prevents bad data from getting to the icecast server.
  40. libavc
    libavc1394 is a programming interface for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set.
  41. opencv
    OpenCV is a library of programming functions mainly aimed at real time computer vision.
That's all the dependencies that installed on my system before installing VLC. All this deps can be downloaded at slackbuild repository. Now, let's install VLC. I use VLC 1.0.6. Before install the VLC, we need libpng 1.4.x patch. You can copy the patch code below to your favorite text editor, and save it with the following name : libpng-1.4.patch.

diff --git a/modules/codec/png.c b/modules/codec/png.c
index 5dd4c2e..acd5694 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -152,7 +152,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_info = png_create_info_struct( p_png );
     if( p_info == NULL )
     {
-        png_destroy_read_struct( &p_png, png_infopp_NULL, png_infopp_NULL );
+        png_destroy_read_struct( &p_png, NULL, NULL );
         block_Release( p_block ); *pp_block = NULL;
         return NULL;
     }
@@ -160,7 +160,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_end_info = png_create_info_struct( p_png );
     if( p_end_info == NULL )
     {
-        png_destroy_read_struct( &p_png, &p_info, png_infopp_NULL );
+        png_destroy_read_struct( &p_png, &p_info, NULL );
         block_Release( p_block ); *pp_block = NULL;
         return NULL;
     }

After that, you can install the VLC using my slackbuild script :

#!/bin/sh

# Slackware build script for VLC

# Written by Budi Ariyanto (fx.budi.ariyanto@gmail.com)
# 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.

PRGNAM=vlc   
VERSION=${VERSION:-1.0.6} 
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}  

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo} 
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e # Exit on most errors

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# patch for compatibility with libpng-1.4
patch -p1 < $CWD/libpng-1.4.patch

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux \
  --enable-run-as-root \
  --enable-release \
  --enable-switcher \
  --enable-shout \
  --enable-dv \
  --enable-dvdread \
  --enable-v4l \
  --enable-vcdx \
  --enable-faad \
  --enable-twolame \
  --enable-real \
  --enable-realrtsp \
  --enable-flac \
  --enable-tremor \
  --enable-theora \
  --enable-dirac \
  --enable-csri \
  --enable-libass \
  --enable-asademux \
  --enable-xvmc \
  --enable-svg \
  --enable-snapshot \
  --enable-mga \
  --enable-omapfb \
  --enable-svgalib \
  --enable-aa \
  --enable-caca \
  --enable-lirc \
  --enable-mkv \
  --enable-xosd \
  --enable-fbosd \
  --enable-opencv

# Compile the application and install it into the $PKG directory
make
make install DESTDIR=$PKG

find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
  doc/*.txt \
  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

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

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

You also can copy the slackbuild script, and paste it to your editor. Save it with the following name : vlc.Slackbuild. Make sure the libpng patch, slackbuild script and the vlc source are together in a directory. After that, execute the slackbuild script, wait for the process, install it and enjoy VLC! :)

2 comments:

  1. Hmm but, Where Can I download the VLC sources for your slackbuild?

    Great Post!..
    I will make it!


    Thank's A lot!

    ReplyDelete
  2. You can download it at http://download.videolan.org/pub/videolan/vlc/1.0.6/

    There are later versions you can download.

    If you are not using version 1.0.6(earlier version not recommended), don't forget to edit the VERSION at line 26 in my slackbuild script to your respective version of VLC.

    :)

    ReplyDelete