Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.2 KiB

#!/bin/bash
# Build script for Slackware
# Damien Goutte-Gattat "gouttegd" <dgouttegattat at incenp.org>
#
# Redistribution and use of this script, with or without modifications, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Latest ATLAS sourcecode is available at:
# http://math-atlas.sourceforge.net/
#
# Latest Lapack sourcecode is available at:
# http://www.netlib.org/lapack/
# Source packages infos
ATLAS_NAMESRC=${ATLAS_NAMESRC:-atlas}
ATLAS_VERSION=${ATLAS_VERSION:-3.8.2}
ATLAS_ARCHIVE=${ATLAS_ARCHIVE:-${ATLAS_NAMESRC}$ATLAS_VERSION.tar.gz}
ATLAS_URL=${ATLAS_URL:-http://garr.dl.sourceforge.net/sourceforge/math-atlas}
LAPACK_NAMESRC=${LAPACK_NAMESRC:-lapack}
LAPACK_VERSION=${LAPACK_VERSION:-3.1.1}
LAPACK_ARCHIVE=${LAPACK_ARCHIVE:-$LAPACK_NAMESRC-$LAPACK_VERSION.tgz}
LAPACK_URL=${LAPACK_URL:-http://www.netlib.org/lapack}
# Built package infos
NAMETGZ=${NAMETGZ:-libatlas}
VERSION=${VERSION:-$ATLAS_VERSION}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-i486}
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMETGZ}
CWD=$(pwd)
set -e # Quit if a command returns non-zero
# Sanity check
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP does not exist or is not a directory!"
exit 1
fi
# Get and verify the source archives
if [ ! -r $ATLAS_ARCHIVE ]; then
wget "$ATLAS_URL/$ATLAS_ARCHIVE"
fi
if [ ! -r $LAPACK_ARCHIVE ]; then
wget "$LAPACK_URL/$LAPACK_ARCHIVE"
fi
sha1sum -c $ATLAS_ARCHIVE.sha1
sha1sum -c $LAPACK_ARCHIVE.sha1
ATLAS_DIRNAME=$(tar ft $ATLAS_ARCHIVE | head -n 1 | cut -d / -f 1)
LAPACK_DIRNAME=$(tar ft $LAPACK_ARCHIVE | head -n 1 | cut -d / -f 1)
# Determine the CPU's clock frequency
MHZ=$(sed -nre 's/^cpu MHz\s+: ([0-9]+)\.[0-9]{3}/\1/ p' /proc/cpuinfo | head -n 1)
# Extract the archives
cd $TMP
tar xf $CWD/$LAPACK_ARCHIVE
tar xf $CWD/$ATLAS_ARCHIVE
# Build the temporary Lapack library
cd $LAPACK_DIRNAME
cp $CWD/make.inc make.inc
make lib
# Build the ATLAS library (static)
mkdir -p $TMP/$ATLAS_DIRNAME/build
cd $TMP/$ATLAS_DIRNAME/build
../configure \
--prefix=/usr \
-b 32 -D c -DPentiumCPS=$MHZ -Fa alg -fPIC \
--with-netlib-lapack=$TMP/$LAPACK_DIRNAME/lapack_LINUX.a
make
make install DESTDIR=$PKG/usr
# Build, install and strip the shared libraries
cd $TMP/$ATLAS_DIRNAME/build/lib
make shared
install -s -m 0644 *.so $PKG/usr/lib
strip --strip-unneeded $PKG/usr/lib/*.so
# Install and compress man pages
mkdir -p $PKG/usr/man/manl
find $TMP/$LAPACK_DIRNAME/manpages -type f -name '*.l' \
-exec install -m 644 '{}' $PKG/usr/man/manl \;
find $PKG/usr/man -type f -exec gzip -9 '{}' \;
# Install documentation
mkdir -p $PKG/usr/doc/$NAMETGZ-$VERSION/lapack/html
cd $TMP/$LAPACK_DIRNAME
install -m 644 COPYING README $PKG/usr/doc/$NAMETGZ-$VERSION/lapack
install -m 644 html/* $PKG/usr/doc/$NAMETGZ-$VERSION/lapack/html
cd $TMP/$ATLAS_DIRNAME
install -m 0644 INSTALL.txt README doc/* $PKG/usr/doc/$NAMETGZ-$VERSION
# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/$LAPACK_DIRNAME $TMP/$ATLAS_DIRNAME
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi