Wednesday, July 28, 2010

Gretl on Slackware 13.1

I recently built gretl 1.9.1 for Slackware 13.1. I needed to install two packages first, fftw and gdk-pixbuf. Both are available from slackbuilds.org.

LAPACK and BLAS are also necessary. I prefer to use the ACML because it is a lot faster than an unoptimized BLAS. I created symbolic links to make libacml.a appear to be both libblas.a and liblapack.a in /usr/lib:

ln -s /opt/acml4.4.0/gfortran32/lib/libacml.a /usr/local/lib/libblas.a
ln -s /opt/acml4.4.0/gfortran32/lib/libacml.a /usr/local/lib/liblapack.a

Here's the SlackBuild. It built a package and upon installation it runs correctly.
#!/bin/sh
# Heavily based on the Slackware 12.2 SlackBuild
# http://gretl.sourceforge.net/gretl_italiano.html

NAME=gretl
VERSION=1.9.1
ARCH=${ARCH:-i486}
BUILD=1mf
CWD=`pwd`

if ["$TMP" = ""]; then
 TMP=/tmp
fi

PKG=$TMP/package-$NAME

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

mkdir -p $PKG/usr

cd $TMP

tar xvjf $CWD/$NAME-$VERSION.tar.bz2

cd $NAME-$VERSION

CFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr --build=i486-slackware-linux --with-lapack-prefix=/usr

make
make prefix=$PKG/usr install

mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a ChangeLog COPYING EXTENDING INSTALL README README.audio README.win32 TODO $PKG/usr/doc/$NAME-$VERSION
mkdir -p $PKG/install
mkdir -p $PKG/usr/share/pixmaps
mkdir -p $PKG/usr/share/applications
cat $CWD/slack-desc > $PKG/install/slack-desc
cp $CWD/gretl.png $PKG/usr/share/pixmaps/gretl.png
cat $CWD/Gretl.desktop > $PKG/usr/share/applications/gretl.desktop
cp $CWD/$NAME.SlackBuild $PKG/usr/doc/$NAME-$VERSION/

( 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
)

mv $PKG/usr/share/man $PKG/usr
gzip -9 $PKG/usr/man/*/*
chmod 755 $PKG/usr/bin/*

cd $PKG

chown -R root:root .

requiredbuilder -v -y -s $CWD $PKG

cat $CWD/slack-required > $PKG/install/slack-required
cat $CWD/slack-required > $PKG/usr/doc/$NAME-$VERSION/slack-required

makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
 rm -rf $TMP/$NAME-$VERSION
 rm -rf $PKG
fi
License note: This is a modified version of a SlackBuild downloaded from slacky.eu a long time ago. It is in the public domain, as I understand it, and my modifications are public domain as well.

No comments:

Post a Comment