sit/install_toolchain.sh

113 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# Installation script to build the autotools toolchain.
# Christoph Niethammer <christoph.niethammer@web.de> (C) 2011
set -e
set -x
export ORIGDIR=`pwd`
export SIT_DIR=$(dirname "$ORIGDIR/$0")
echo $SIT_DIR
export SRC_POOL=${HOME}/src
export WORKDIR_BASE=${HOME}/work
PREFIX=$HOME/bin/local
MAKEOPTS="-j4"
module load compiler/gnu/4.4.3
M4_VERSION=1.4.15
BISON_VERSION=2.4.2
LIBTOOL_VERSION=2.2.10
AUTOCONF_VERSION=2.65
AUTOMAKE_VERSION=1.11.1
function sit_fail() {
msg=$0
echo "$msg"
exit 1
}
function sit_unpack() {
if [ ! -e ${SRC_POOL}/${A} ]
then
sit_fail "${SRC_POOL}/${A} doesn't exist"
fi
case "${A##*.}" in
bz2)
tar xfjv ${SRC_POOL}/${A} || sit_fail
;;
gz|tgz)
tar xfzv ${SRC_POOL}/${A} || sit_fail
;;
xz)
tar xfJv ${SRC_POOL}/${A} || sit_fail
;;
*)
sit_fail "Archive format not recogized"
;;
esac
}
function sit_configure() {
cd ${BUILDDIR=}
${SRCDIR}/configure --prefix=$PREFIX
}
function sit_build() {
make $MAKEOPTS
}
function sit_install() {
make install
}
function sit_auto_install() {
export WORKDIR=$WORKDIR_BASE/${P}
export SRCDIR=${WORKDIR}/${P}
export BUILDDIR=${WORKDIR}/build
if [ -d ${WORKDIR} ]
then
rm -rf ${WORKDIR}
fi
mkdir -p ${WORKDIR}
mkdir -p ${BUILDDIR}
cd ${WORKDIR}
sit_unpack
sit_configure
sit_build
sit_install
}
# install m4
P=m4-${M4_VERSION}
A=${P}.tar.bz2
sit_auto_install
# install bison
P=bison-${BISON_VERSION}
A=${P}.tar.bz2
sit_auto_install
# install libtool
P=libtool-${LIBTOOL_VERSION}
A=${P}.tar.gz
sit_auto_install
# install autoconf
P=autoconf-${AUTOCONF_VERSION}
A=${P}.tar.gz
sit_auto_install
# install automake
P=automake-${AUTOMAKE_VERSION}
A=${P}.tar.bz2
sit_auto_install
exit 0