rendered paste body#!/bin/sh
# Heavily based on the Slackware 12.0 SlackBuild
# http://cimg.sourceforge.net/
# Packager Gerson E. Ruotolo
# http://
CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package/CImg
NAME=CImg
VERSION=1.2.7
CHOST=i486
ARCH=${ARCH:-i686}
BUILD=1
#SOURCE=http://program-site.org/$NAME-$VERSION.tar.gz
#if [ ! -e $NAME-$VERSION.tar.gz ]; then
#wget -c $SOURCE
#fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O3 -march=i686 -mtune=i686"
elif [ "$ARCH" = "athlon64" ]; then
SLKCFLAGS="-O2 -march=athlon64 -mtune=i686"
elif [ "$ARCH" = "athlonxp" ]; then
SLKCFLAGS="-O3 -march=athlon-xp -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
fi
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
mkdir -p $PKG
fi
cd $TMP
mkdir $PKG/usr
mkdir $PKG/usr/bin
mkdir $PKG/usr/include
mkdir $PKG/usr/share
mkdir $PKG/usr/share/doc
mkdir $PKG/usr/share/doc/CImg
#extension tar.gz
tar zxvf $CWD/$NAME-$VERSION.tar.gz
#extension tar.bz2
#tar jxvf $CWD/$NAME-$VERSION.tar.bz2
echo -e "\E[0;32m+------------------------------+\E[0;0m"
echo -e "\E[0;32m| Start SlackBuild $NAME-$VERSION |\E[0;0m"
echo -e "\E[0;32m+------------------------------+\E[0;0m"
cd $TMP/$NAME-$VERSION/documentation
cp -R * $PKG/usr/share/doc/CImg
cd $TMP/$NAME-$VERSION/examples
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
chown -R root:root .
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make olinux
cp CImg_demo $PKG/usr/bin
cp curve_editor $PKG/usr/bin
cp dtmri_view $PKG/usr/bin
cp edge_explorer $PKG/usr/bin
cp fade_images $PKG/usr/bin
cp generate_loop_macros $PKG/usr/bin
cp greycstoration $PKG/usr/bin
cp greycstoration4integration $PKG/usr/bin
cp hough_transform $PKG/usr/bin
cp image2ascii $PKG/usr/bin
cp image_registration $PKG/usr/bin
cp image_surface $PKG/usr/bin
cp inrcast $PKG/usr/bin
cp jawbreaker $PKG/usr/bin
cp mcf_levelsets $PKG/usr/bin
cp mcf_levelsets3D $PKG/usr/bin
cp nlmeans $PKG/usr/bin
cp odykill $PKG/usr/bin
cp pde_heatflow2D $PKG/usr/bin
cp pde_TschumperleDeriche2D $PKG/usr/bin
cp pslider $PKG/usr/bin
cp tetris $PKG/usr/bin
cp toolbox3d $PKG/usr/bin
cp tron $PKG/usr/bin
cp tutorial $PKG/usr/bin
cp wavelet_atrous $PKG/usr/bin
cp $TMP/$NAME-$VERSION/CImg.h $PKG/usr/include
( 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
find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz
chmod 775 $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP
fi