#!/bin/bash # Copyright (c) 2006 Eric Hameleers # Distributed under the terms of the GNU General Public License, Version 2 # ----------------------------------------------------------------------------- # # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: rrdtool # URL: http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ # Needs: # Changelog: # 1.2.8-1: 18/May/2005 by Eric Hameleers # * Initial build. # 1.2.12-1: 21/feb/2006 by Eric Hameleers # * Upgrade. The cgilib is no longer needed as of 1.2.12. # # Run 'sh SlackBuild --cleanup' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # # Small modifications made by rhatto at riseup.net # # ----------------------------------------------------------------------------- # --- INIT --- # Set initial variables: CWD=`pwd` cat << EOCAT You'll need the following packages: freetype EOCAT if [ "$INTERACT" != "no" ]; then echo "Hit ENTER do continue, Crtl-C to abort" read crap else echo sleeping 3 seconds... sleep 3 fi if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi PACKAGE="rrdtool" PRGNAM="$PACKAGE" ARCH=${ARCH:=i486} VERSION=${VERSION:=1.2.13} BUILD=${BUILD:=1rha} SRC_DIR=${SRC:=$CWD} TMP=${TMP:=/tmp} REPOS=${REPOS:=$TMP} if [ "$ARCH" == "x86_64" ]; then export LDFLAGS="-L/lib64 -L/usr/lib64" LIBDIR=/usr/lib64 else LIBDIR=/usr/lib fi SRC="$PRGNAM-$VERSION.tar.gz" URL="http://people.ee.ethz.ch/~oetiker/webtools/$PRGNAM/pub/$SRC" SRC_DIR="$SRC_DIR/$PACKAGE" mkdir -p $SRC_DIR if [ ! -f "$SRC_DIR/$SRC" ]; then wget "$URL" -O "$SRC_DIR/$SRC" fi if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi TMP="$TMP/$PACKAGE" PKG=$TMP/package-$PRGNAM rm -rf $TMP mkdir -p $PKG if [ ! -d $TMP/tmp-$PRGNAM ]; then mkdir -p $TMP/tmp-$PRGNAM # location to build the source fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi # --- PACKAGE BUILDING --- echo "++" echo "|| $PRGNAM-$VERSION" echo "++" rm -rf $PKG/* cd $PKG # Explode the package framework: if [ -f $CWD/_$PRGNAM.tar.gz ]; then explodepkg $CWD/_$PRGNAM.tar.gz fi cd $TMP # --- TARBALL EXTRACTION,PATCH,MODIFY --- echo "Extracting the program tarball for $PRGNAM..." tar -xzvf $SRC_DIR/${PRGNAM}-${VERSION}.tar.gz cd ${PRGNAM}-${VERSION} chown -R root.root . # --- BUILDING --- echo Building ... CPPFLAGS="$SLKCFLAGS" CFLAGS="$SLKCFLAGS" export CPPFLAGS CFLAGS ./configure --prefix=/usr \ --localstatedir=/var \ --sysconfdir=/etc \ --libdir=$LIBDIR \ --enable-perl-site-install \ 2>&1 | tee $TMP/configure-${PRGNAM}.log make 2>&1 | tee $TMP/make-${PRGNAM}.log # # Install all the needed stuff to the package dir # # Use installwatch if available: which installwatch > /dev/null 2>&1 if [ $? == 0 ]; then installwatch -o $TMP/install-${PRGNAM}.log make DESTDIR=$PKG install else make DESTDIR=$PKG install 2>&1 |tee $TMP/install-${PRGNAM}.log fi # unneeded perl stuff find $PKG/usr/lib/perl5/ -name Bundle -type d | xargs rm -rf find $PKG/usr/lib/perl5/ -name perllocal.pod | xargs rm -f find $PKG/usr/lib/perl5/ -name .packlist | xargs rm -f find $PKG/usr/lib/perl5/ -type f -size 0c | xargs rm -f # Remove empty directories (assuming two levels of file-less directories) find $PKG/usr/lib/perl5/ -type d | xargs rmdir 2>/dev/null find $PKG/usr/lib/perl5/ -type d | xargs rmdir 2>/dev/null # Screw-uppings mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mv $PKG/usr/share/rrdtool/examples $PKG/usr/doc/$PRGNAM-$VERSION/ mv $PKG/usr/share/doc/*/html $PKG/usr/doc/$PRGNAM-$VERSION/ rm -rf $PKG/usr/share/doc mkdir -p $PKG/usr/man/man3/ mv $PKG/usr/share/man/man3/* $PKG/usr/man/man3/ rm -rf $PKG/usr/share/man # --- DOCUMENTATION --- DOCS="CHANGES CONTRIBUTORS COPYING COPYRIGHT NEWS NT-BUILD-TIPS.txt \ README THREADS TODO" mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS \ $PKG/usr/doc/$PRGNAM-$VERSION chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* # Compress the man page(s) gzip -9f $PKG/usr/man/*/* # Strip binaries ( 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 ) # --- OWNERSHIP, RIGHTS --- chmod -R o-w $PKG chown root:bin $PKG/usr/bin/* $PKG/usr/sbin/* $PKG/bin/* $PKG/sbin/* \ $PKG/usr/X11R6/bin/* $PKG/opt/kde/bin/* 2>/dev/null # --- PACKAGE DESCRIPTION --- mkdir -p $PKG/install cat << EOF > $PKG/install/slack-desc # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler-----------------------------------------------------| rrdtool: rrdtool (Time-series data storage and graphing software) rrdtool: rrdtool: RRDtool (Round Robin Database Tool) is time-series data storage and rrdtool: graphing utility created by the author of MRTG. Using RRDtool, you rrdtool: can write your own MRTG-like tools in a matter minutes with only a rrdtool: few lines of Perl or shell code. rrdtool: rrdtool: rrdtool: rrdtool: rrdtool: EOF if [ -f $CWD/doinst.sh ]; then cat $CWD/doinst.sh > $PKG/install/doinst.sh fi # --- BUILDING --- # Build the package: cd $PKG # mv usr/lib/perl usr/lib/perl5 makepkg --linkadd y --chown n $REPOS/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz \ 2>&1 | tee $TMP/makepkg-${PRGNAM}.log #(cd $REPOS && md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz.md5) #cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $REPOS/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.txt # --- CLEANUP --- # Clean up the extra stuff: if [ "$CLEANUP" == "yes" ]; then rm -rf $TMP fi