Fetch the repository succeeded.
#! /bin/bash
# ==============================================================================
BASEPATH=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd )
ROOTDIR="$BASEPATH"
BOOST_URL_BASE='https://boostorg.jfrog.io/artifactory/main/release/'
# ==============================================================================
function usage() {
echo 'Usage:'
echo " $0 [version-triple] [linux|win]"
echo "Example: $0 1.78.0 linux"
exit 1
}
if [ $# -lt 1 ]; then
echo 'Missing argument: Boost version (e.g. 1.78.0)' 1>&2
usage
exit 1
fi
if [ $# -lt 2 ]; then
echo 'Missing argument: platform (either "linux" or "win"' 1>&2
usage
exit 1
fi
VER=$1
shift
_ver=${VER//./_}
platform=$1
shift
# ==============================================================================
cd "$BASEPATH"
# ------------------------------------------------------------------------------
if [[ "$platform" == 'linux' ]]; then
boost_archive="boost_${_ver}.tar.gz"
elif [[ "$platform" == 'win' ]]; then
boost_archive="boost_${_ver}.zip"
else
echo "Unsupported value for 'platform': $platform"
exit 1
fi
if [ ! -f "$BASEPATH/$boost_archive" ]; then
echo "Downloading $boost_archive"
wget "$BOOST_URL_BASE/${VER}/source/${boost_archive}"
else
echo "$boost_archive already present in $BASEPATH"
fi
# ------------------------------------------------------------------------------
if [[ "$platform" == 'linux' ]]; then
tar zxf "$boost_archive" --strip-components=1
elif [[ "$platform" == 'win' ]]; then
unzip -qo "$boost_archive"
src_dir="boost_${_ver}"
rsync -a "${src_dir}"/* .
rm -rf "${src_dir}"
fi
rm "$boost_archive"
# ==============================================================================
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。