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.

129 lines
3.8 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 ncbi sourcecode is available at:
# ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/CURRENT
# Source package infos
NAMESRC=${NAMESRC:-ncbi}
VERSION=${VERSION:-6.1}
ARCHIVE=${ARCHIVE:-$NAMESRC.tar.gz}
WGET=${WGET:-ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/old/20090301/$ARCHIVE}
# Built package infos
NAMETGZ=${NAMETGZ:-ncbi-toolkit}
BUILD=${BUILD:-2GGD}
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 checks
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 archive
if [ ! -r $ARCHIVE ]; then
wget "$WGET"
fi
sha1sum -c $ARCHIVE.sha1
NAME=$(tar ft $ARCHIVE | head -1 | cut -d / -f 1)
# Build
cd $TMP
echo "Building $ARCHIVE..."
mkdir ncbi && cd ncbi
tar xf $CWD/$ARCHIVE
patch -p 1 < $CWD/build-fixes.diff
./ncbi/make/makedis.csh
# Install binaries and include files
mkdir -p $PKG/usr/include
cp -aL ncbi/bin $PKG/usr/bin
rm $PKG/usr/bin/{demo*,dosimple,test*}
mv $PKG/usr/bin/wblast2.REAL $PKG/usr/bin/wblast2
mv $PKG/usr/bin/wblast2_cs.REAL $PKG/usr/bin/wblast2_cs
cp -aL ncbi/lib $PKG/usr/lib
strip --strip-unneeded $PKG/usr/bin/* $PKG/usr/lib/*
cp -aL ncbi/include $PKG/usr/include/ncbi
rm $PKG/usr/include/ncbi/{cn3d*,pcre*,vib*}
# Install and compress man pages
mkdir -p $PKG/usr/man
cp -aL ncbi/doc/man $PKG/usr/man/man1
rm $PKG/usr/man/man1/{Psequin.1,asnval.1,cleanasn.1,ddv.1,entrez2.1,\
fmerge.1,gbseqget.1,insdseqget.1,nps2gps.1,sortbyquote.1,spidey.1,\
trna2sap.1,trna2tbl.1,udv.1}
find $PKG/usr/man/man1 -type f -exec gzip -9 {} \;
# Install shared NCBI data
mkdir -p $PKG/usr/share/ncbi
cp -aL ncbi/data $PKG/usr/share/ncbi
# Install the documentation
DOCDIR=$PKG/usr/doc/$NAMETGZ-$VERSION
mkdir -p $DOCDIR
cp ncbi/README{,.htm} ncbi/VERSION $DOCDIR
cp ncbi/config/README $DOCDIR/README.config
cp ncbi/network/nsclilib/readme $DOCDIR/README.net-cfg
cp -aL ncbi/doc/* $DOCDIR
rm -rf $DOCDIR/man
# Install the default config file
mkdir -p $PKG/etc/ncbi
install -m 644 $CWD/ncbirc $PKG/etc/ncbi/ncbirc.new
# Sanitize permissions
find $PKG -type d -exec chmod 755 {} \;
find $PKG -type f -exec chmod 644 {} \;
find $PKG/usr/bin -type f -exec chmod 755 {} \;
# Copy slack-desc and doinst.sh files
mkdir -p $PKG/install
install -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# 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/$NAME
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi