Monday, May 31, 2010

Installing wxCam 1.0.6 on Slackware 13.1

,
In the slackbuilds repository, there is wxCam package, but still in version 1.0.4. Now the wxCam has reached version 1.0.6. In order to install it, we need xvidcore, mjpegtools, CImg and wxGTK. All of them can be downloaded at slackbuild's site and installed without problem, except for CImg. At the slackbuild's site, the CImg library source still in version 1.2.9(31 ), but we need CImg-1.3.4 due to wxCam compile error. To make the package, you can use my Slackbuild script. I modify it a little from the original script and you can copy it to text editor and save as [package_name].SlackBuild.
#!/bin/sh
PRGNAM=CImg
VERSION=1.3.4
#change the version to 1.0.6 1.3.4
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-_bud}

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

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
unzip $CWD/$PRGNAM-$VERSION.zip #change the command to unzip because the package is in zip format.
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+w,go+r-w .

mkdir -p $PKG/usr/include/CImg
cat CImg.h > $PKG/usr/include/CImg/CImg.h
( cd $PKG/usr/include/ ; ln -sf /usr/include/CImg/CImg.h . )

mkdir -p $PKG/usr/share/CImg
cp -a plugins/ $PKG/usr/share/CImg

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/html
cp -ar CHANGES.txt Licence* README.txt examples \
  $PKG/usr/doc/$PRGNAM-$VERSION/
cp -ar html/* $PKG/usr/doc/$PRGNAM-$VERSION/html #change the directory to html
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}

I assumed that you have install this library the other deps package(xvidcore, mjpegtools and wxGTK). Now, let's make the tgz wxCam 1.0.6 package with my script that I modifiy from the original one. You can copy and save the script here also as [package_name].SlackBuild :


#!/bin/sh
PRGNAM=wxcam
VERSION=1.0.6 #change the version to 1.0.6
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_bud}

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"
fi

set -e

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 .
chmod -R a-s,u+w,go+r-w .

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --disable-static \
  --build=$ARCH-slackware-linux

make wxcamdocdir=/usr/doc/$PRGNAM-$VERSION
make install wxcamdocdir=/usr/doc/$PRGNAM-$VERSION 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 COPYING INSTALL $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG

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}


 After the package creation finished, install it and voila!! Now wxCam 1.0.6 is ready to use without any problem. Enjoy! :D

0 comments to “Installing wxCam 1.0.6 on Slackware 13.1”

Post a Comment