sit/functions.sh
Rainer Keller 28db8095c5 - Specify F77 before Fortran (F90, F2003, F2008) compilers
- Don't use -j2 make option by default, may break some non-conforming source builts
 - Fix a few buglets (like LOGDIR , and when packages are NOT configure-based, aka
   do not create a config.log file)
2024-03-28 02:43:56 +01:00

146 lines
2.7 KiB
Bash

sit_fail() {
msg="Fail: $1"
echo "$msg"
exit 1
}
sit_info() {
msg=$1
echo $msg
}
sit_countdown() {
local tt=$1
for i in $(seq $tt -1 1); do
echo -n "$i "
sleep 1
done
echo
}
unpack() {
if [ ! -e ${SRC_POOL}/${A} ] ; then
sit_fail "${SRC_POOL}/${A} doesn't exist"
fi
case "${A##*.}" in
bz2)
tar xjf ${SRC_POOL}/${A} || sit_fail
;;
gz|tgz)
tar xzf ${SRC_POOL}/${A} || sit_fail
;;
xz)
tar xJf ${SRC_POOL}/${A} || sit_fail
;;
*)
sit_fail "Archive format not recogized"
;;
esac
}
src_unpack() {
unpack
}
sit_unpack() {
sit_info "Unpacking sources ..."
cd ${WORKDIR}
src_unpack
}
src_prepare() {
/bin/true
}
sit_prepare() {
sit_info "Preparing sources"
cd ${SRCDIR}
src_prepare || sit_fail "Preparing sources failed"
}
src_configure() {
${SRCDIR}/configure --prefix=$PREFIX $CONFIGURE_OPTS
if [ ! -z $LOGDIR -a -f config.log ] ; then
cp config.log $LOGDIR
fi
}
sit_configure() {
sit_info "Configuring sources ..."
cd ${BUILDDIR}
src_configure || sit_fail "Configure failed"
}
src_build() {
make $MAKEOPTS
}
sit_build() {
sit_info "Building sources ..."
cd ${BUILDDIR}
src_build || sit_fail "Build failed"
}
src_pretest() {
/bin/true
}
sit_pretest() {
sit_info "Running pre installation tests ..."
cd ${BUILDDIR}
src_pretest || sit_fail "Pre installation tests failed"
}
src_posttest() {
/bin/true
}
sit_posttest() {
sit_info "Running post installation tests ..."
cd ${BUILDDIR}
src_posttest || sit_fail "Post installation tests failed"
}
src_install() {
make install
}
sit_install() {
sit_info "Installing package ..."
cd ${BUILDDIR}
src_install || sit_fail "Install failed"
}
sit_copy_logs() {
if [ ! -z $LOGDIR ] ; then
cd $LOGDIR
bzip2 *.log
cp $LOGDIR/*.bz2 $PREFIX
fi
}
src_setperms() {
chmod -R g+rwX $PREFIX
chmod -R o+rX $PREFIX
}
sit_setperms() {
sit_info "Setting proper permissions"
src_setperms || sit_fail "Could not set permissions"
}
sit_sitinfo() {
local SIT_VERSION="unknown"
if [ "$(svnversion $SIT_PATH)" != "exported" ] ; then
SIT_VERSION="svn-r$(svnversion $SIT_PATH)"
elif cd $SIT_PATH; git svn find-rev r1 >/dev/null 2>&1 ; then
SIT_VERSION="svn-r$(cd $SIT_PATH; git svn find-rev HEAD)";
else
SIT_VERSION="unknown"
fi
echo "Invocation: $(ps --pid $$ -o cmd | tail -n 1)"
echo "Started: $(date)"
echo "Version: $SIT_VERSION"
echo "Environment:"
echo "------------------------------------------------------------------------------"
env
echo "------------------------------------------------------------------------------"
}