#!/bin/sh # Copyright Loris Vincenzi (http://www.slacky.eu) # All rights reserved. # # Heavily based on the Slackware 13.1 SlackBuild # http://www.ffmpeg.org # # 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. # # # Required: dirac, faac, jack-audio-connection-kit, lame, libdc1394, libgsm, libnut (Static) # Required: libva, libvdpau, libvpx , opencore-amr, openjpeg, orc, rtmpdump (Static) # Required: schroedinger, speex, x264, xvidcore # # # # Exit on most errors set -e # Set variables: CWD=`pwd` OUTPUT=${OUTPUT:-$CWD} PKGNAME=ffmpeg TMP=${TMP:-/tmp/txz/$PKGNAME} PKG=$TMP/package VERSION=${VERSION:-0.6.2} ARCH=${ARCH:-i686} # i686 or x86_64 JOBS=${JOBS:--j2} BUILD=${BUILD:-1} TAG=${TAG:-sl} # Download sorce tarball if still not present SOURCE="http://www.ffmpeg.org/releases/$PKGNAME-$VERSION.tar.bz2" if [ ! -e $CWD/$PKGNAME-$VERSION.tar.bz2 ]; then wget $SOURCE fi # Set compiling FLAGS if [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST="i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC"; SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"; CHOST="x86_64" fi rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT # Decompress the source tarball cd $TMP tar xjvf $CWD/$PKGNAME-$VERSION.tar.bz2 echo -e "\E[0;32m+-------------------------+\E[0;0m" echo -e "\E[0;32m| Start SlackBuild FFmpeg |\E[0;0m" echo -e "\E[0;32m+-------------------------+\E[0;0m" # Adjust permissions and ownerships cd $PKGNAME-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . # Building FFmpeg package CPPFLAGS="-I/usr/include/vpx" \ LDFLAGS="$SLKLDFLAGS" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure --prefix=/usr \ --shlibdir=/usr/lib${LIBDIRSUFFIX} \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --build-suffix=${LIBDIRSUFFIX} \ --mandir=/usr/man \ --disable-static \ --enable-shared \ --enable-gpl \ --enable-version3 \ --enable-nonfree \ --enable-postproc \ --enable-swscale \ --enable-avfilter \ --enable-avfilter-lavf \ --enable-pthreads \ --enable-x11grab \ --enable-bzlib \ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --enable-version3 \ --enable-libdc1394 \ --enable-libdirac \ --enable-libfaac \ --enable-libfaad \ --enable-libfaadbin \ --enable-libgsm \ --enable-libmp3lame \ --enable-libnut \ --enable-libopenjpeg \ --enable-librtmp \ --enable-libschroedinger \ --enable-libvpx \ --enable-libspeex \ --enable-libtheora \ --enable-libvorbis \ --enable-libx264 \ --enable-memalign-hack \ --enable-libxvid \ --enable-zlib \ --disable-debug \ --enable-vdpau \ --arch=${ARCH} \ $([ "${ARCH}" == 'i686' ] && echo '--disable-ssse3' '--disable-amd3dnowext' '--disable-mmx2') echo -e "\E[0;32mPress any key to build the package!\E[0;0m" read make $JOBS make install DESTDIR=$PKG # Strip binaries and shared objects, if present ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true ) # Add documentation files: readme, changelog and so on mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild cp [A-Z]* doc/TODO doc/*.{html,txt} $PKG/usr/doc/$PKGNAME-$VERSION chmod 644 $PKG/usr/doc/$PKGNAME-$VERSION/* # Installing configuration file install -m 644 -p -D doc/ffserver.conf $PKG/etc/ffserver.conf.new # Also add the slack-desk file and this slackbuild to the package mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/slack-desc cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/$PKGNAME.SlackBuild # Compress the man pages if present if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi # Find and print dependencies into slack-required file cd $PKG chown -R root:root $PKG if [ -x /usr/bin/requiredbuilder ];then requiredbuilder -y -v -s $CWD $PKG fi # Create txz package /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} # Cleanup if enabled if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi