Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example Boost build script (this was originally intended for personal use)
#!/bin/sh
VER="${1}"
ROOTDIR="/opt/projects/boost"
BUILDDIR="${ROOTDIR}/src/build_${VER}"
STAGEDIR="${ROOTDIR}/src/stage_${VER}"
INSTALLDIR="${ROOTDIR}/${VER}"
SRCDIR="${ROOTDIR}/src/boost_${VER}"
LOGDIR="${ROOTDIR}/src"
if [[ -z "${VER}" || "${VER}" == "--help" || "${VER}" == "-h" ]];
then
echo "Usage: ${0} VERSION"
echo " VERSION - Underscored version, matches src directory e.g. 1_60_0"
echo .
exit
fi
if [[ ! -f ${SRCDIR}/bootstrap.sh ]];
then
echo "${SRCDIR}/bootstrap.sh does not exist"
exit 1
fi
echo
echo
echo "Source: ${SRCDIR}"
echo "Install: ${INSTALLDIR}"
echo
read -rn 1 -p "Continue? (y/N)" START
echo
if [[ "${START}" != "y" ]];
then
exit
fi
if [[ -d ${BUILDDIR} ]];
then
echo "Removing existing build dir: ${BUILDDIR}"
rm -rf $BUILDDIR
fi
mkdir $BUILDDIR
if [[ -d ${STAGEDIR} ]];
then
echo "Removing existing stage dir: ${STAGEDIR}"
rm -rf $STAGEDIR
fi
mkdir $STAGEDIR
cd $SRCDIR
echo -n "Starting bootstrap..."
./bootstrap.sh --prefix=${INSTALLDIR} >${LOGDIR}/${VER}--bootstrap.log 2>&1 &&
echo "finished" &&
echo -n "Starting b2..." &&
./b2 --build-dir=${BUILDDIR} stage --stage-dir=${STAGEDIR} >${LOGDIR}/${VER}--b2.log 2>&1 &&
echo "finished" &&
echo -n "Installing..." &&
./bjam install >${LOGDIR}/${VER}--bjam.log 2>&1 &&
echo "finished"
echo
echo "Boost ${VER} Installed to ${INSTALLDIR}, logs copied to ${LOGDIR}"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment