#!/bin/sh # Heavily based on the Slackware 13.1 SlackBuild # http://ngspice.sourceforge.net # Packagers Andrea Sciucca ( gohanz at infinito.it) # Last build from Vito Magnanimo (vitomag89@gmail.com) # http://www.slacky.it # # Exit on most errors set -e CWD=`pwd` OUTPUT=${OUTPUT:-$CWD} PKGNAME=ng-spice-rework SNAME=ngspice TMP=${TMP:-/tmp/txz/$PKGNAME} PKG=$TMP/package VERSION=${VERSION:-22} ARCH=${ARCH:-x86_64} BUILD=${BUILD:-1} TAG=${TAG:-sl} SOURCE=http://kent.dl.sourceforge.net/sourceforge/ngspice/$SNAME-$VERSION.tar.gz DSOURCE=http://kent.dl.sourceforge.net/sourceforge/ngspice/$SNAME$VERSION-manual.pdf.gz if [ ! -e $SNAME-$VERSION.tar.gz ]; then wget -c $SOURCE fi if [ ! -e $SNAME$VERSION-manual.pdf.gz ]; then wget -c $DSOURCE fi if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486 elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486 elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC"; SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" fi rm -rf $PKG $TMP mkdir -p $TMP $PKG $OUTPUT cd $TMP tar xvzf $CWD/$SNAME-$VERSION.tar.gz echo -e "\E[0;32m+-------------------------------------+\E[0;0m" echo -e "\E[0;32m| Start SlackBuild $PKGNAME-$VERSION |\E[0;0m" echo -e "\E[0;32m+-------------------------------------+\E[0;0m" mv ngspice-$VERSION $PKGNAME-$VERSION cd $PKGNAME-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . LDFLAGS="$SLKLDFLAGS" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ --infodir=/usr/info \ --program-prefix= \ --program-suffix= \ --enable-xgraph \ --enable-xspice \ --enable-intnoise \ --enable-cider \ --enable-dot-global \ --enable-numparam \ --enable-x \ --build=$ARCH-slackware-linux make $JOBS make install DESTDIR=$PKG # Strip binaries and shared objects, if present ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true ) #Add documentation files: readme, changelog and so on mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild cp -a AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README FAQ $CWD/$SNAME$VERSION-manual.pdf.gz \ $PKG/usr/doc/$PKGNAME-$VERSION chmod 644 $PKG/usr/doc/$PKGNAME-$VERSION/* # Also add the slack-desk file and this slackbuild to the package mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/slack-desc cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/$PKGNAME.SlackBuild # Compress the man pages if present if [ -d $PKG/usr/man ]; then ( 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 ) fi # Find and print dependencies into slack-required file cd $PKG chown -R root:root $PKG if [ -x /usr/bin/requiredbuilder ];then requiredbuilder -y -v -s $CWD $PKG fi # Create txz package /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} # Cleanup if enabled if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi