slackbuilds_ponce/multimedia/k9copy-reloaded/k9copy-reloaded.SlackBuild
Lenard Spencer f73ea6e194 multimedia/k9copy-reloaded: Update ffmpeg version.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2019-01-12 07:44:37 +07:00

163 lines
4.9 KiB
Bash

#!/bin/sh
# Slackware build script for k9copy-reloaded
# Copyright 2016 by Lenard Spencer (lspencer31-at-cfl-rr-com)
# All rights reserved.
#
# ffmpeg static library section borrowed (stolen?) from xine-lib.SlackBuild
# from Slackware 14.2 source archives,copyrighted by Pat Volkerding, et. al.
#
# 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=k9copy-reloaded
SRCNAM=k9copy
VERSION=${VERSION:-3.0.3}
BUILD=${BUILD:-2}
FFMPEG_VERSION=${FFMPEG_VERSION:-2.8.15}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
# 32bit x86 fails without this...
FFARCHOPTS="--disable-asm"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
# 32bit x86 fails without this...
FFARCHOPTS="--disable-asm"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
FFARCHOPTS="--arch=x86_64 --enable-pic"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
FFARCHOPTS=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf ffmpeg*
tar xvf $CWD/ffmpeg-$FFMPEG_VERSION.tar.?z*
cd ffmpeg*
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
echo "Building static ffmpeg libs ..."
FFMPEGDIR=/$TMP/ff-$(mcookie)
CFLAGS="$SLKCFLAGS -fvisibility=hidden -I/usr/include/openmj2-2.1" \
CXXFLAGS="$SLKCFLAGS -fvisibility=hidden -I/usr/include/openmj2-2.1" \
./configure \
--prefix=$FFMPEGDIR/usr \
--libdir=$FFMPEGDIR/usr/lib${LIBDIRSUFFIX} \
--shlibdir=$FFMPEGDIR/usr/lib${LIBDIRSUFFIX} \
--enable-gpl \
--enable-version3 \
--enable-postproc \
--disable-doc \
--disable-avfilter \
--disable-avdevice \
--disable-swresample \
--disable-ffserver \
--disable-ffplay \
--disable-ffmpeg \
--disable-ffprobe \
--enable-pthreads \
--disable-debug \
--disable-shared \
--enable-static \
--enable-hardcoded-tables \
--enable-memalign-hack \
--enable-bzlib \
--enable-zlib \
--enable-libopenjpeg \
${FFARCHOPTS}
make
make install # Note: no DESTDIR !!
cd -
rm -rf $SRCNAM
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# patches from upstream and community:
patch -p1 < $CWD/patches/k9copy-mimetype.patch
patch -p0 < $CWD/patches/k9copy-tempdir.patch
# Needed to link with the ffmpeg static libs we just built:
export PKG_CONFIG_PATH="${FFMPEGDIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig"
mkdir -p build
cd build
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DFFMPEGSCALE_LIBRARY:FILEPATH=${FFMPEGDIR}/usr/lib${LIBDIRSUFFIX} \
-DFFMPEGSCALE_INCLUDE_DIR_LAVC=${FFMPEGDIR}/usr/include \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DMAN_INSTALL_DIR=/usr/man \
-DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=$PKG
cd ..
find $PKG -print0 | xargs -0 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 COPYING README $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
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}