Skip to content

Instantly share code, notes, and snippets.

@dbenage-cx
Created October 6, 2017 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbenage-cx/e214bd5ade35b206706a10729db7c3da to your computer and use it in GitHub Desktop.
Save dbenage-cx/e214bd5ade35b206706a10729db7c3da to your computer and use it in GitHub Desktop.
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