#!/bin/bash # Slackware build script for mjpegtools PRGNAM=mjpegtools VERSION=1.9.0rc3 ARCH=${ARCH:-i686} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -fomit-frame-pointer" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP || exit 1 rm -rf $PRGNAM-$VERSION tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1 cd $PRGNAM-$VERSION || exit 1 chown -R root:root . chmod -R u+w,go+r-w,a-s . CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --enable-shared=yes \ --enable-simd-accel \ --enable-static=no ####KLUDGE BELOW#### ## mjpegtools uses a cpuinfo.sh script to generate it's own compile flags ## these are not always correct and cause compile time problems with different ## CPUs. Dual Core Intels are seen as nocona, which is 64bit options ## Athlons are seen as k8 which is not a compile time option for ## athlon-xp 32bit cpus. Even if you are using x86_64 your custom $SLCKFLAGS ## are still passed. This error was discussed many times on the mjpegtools ## mailing list. find -name Makefile -exec sed -i -e 's:-march=nocona -mtune=nocona::' {} \; find -name Makefile -exec sed -i -e 's:-march=k8 -mtune=k8::' {} \; find -name Makefile -exec sed -i -e 's:-march=pentium3 -mtune=pentium3::' {} \; make || exit 1 make install DESTDIR=$PKG || exit 1 ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) ( 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 ) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a AUTHORS BUGS ChangeLog CHANGES COPYING INSTALL INSTALL.real \ mjpeg_howto.txt NEWS PLANS READM* TODO $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.tgz