summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-03-31 15:09:28 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-03-31 15:09:28 -0400
commit319e895cc28b4aade6fa843583e0fd2ea96cd7a0 (patch)
tree9728c6116f1241e8fcaaf7cb692a95c2e60d4612
parent8e7ff2c96fb626132581e9ff0a830ea2767190d5 (diff)
downloadmongo-319e895cc28b4aade6fa843583e0fd2ea96cd7a0.tar.gz
SERVER-17294 Boost 1.60 Import Script
-rwxr-xr-xsrc/third_party/scripts/boost_get_sources.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/third_party/scripts/boost_get_sources.sh b/src/third_party/scripts/boost_get_sources.sh
new file mode 100755
index 00000000000..5741b1eed6b
--- /dev/null
+++ b/src/third_party/scripts/boost_get_sources.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+# This script downloads and imports boost via the boost bcp utility.
+# It can be run on Linux or Mac OS X.
+# Actual integration into the build system is not done by this script.
+#
+# Turn on strict error checking, like perl use 'strict'
+set -euo pipefail
+IFS=$'\n\t'
+
+if [ "$#" -ne 0 ]; then
+ echo "This script does not take any arguments"
+ exit 1
+fi
+
+NAME=boost
+VERSION=1.60.0
+VERSION_UNDERSCORE=$(echo $VERSION | tr . _)
+SRC_ROOT=$(mktemp -d /tmp/boost.XXXXXX)
+trap "rm -rf $SRC_ROOT" EXIT
+TARBALL=${NAME}_${VERSION_UNDERSCORE}.tar.gz
+SRC=$SRC_ROOT/$NAME_$VERSION_UNDERSCORE
+DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/$DEST
+
+cd $SRC_ROOT
+
+if [ ! -f $TARBALL ]; then
+ wget http://downloads.sourceforge.net/project/boost/boost/$VERSION/$TARBALL
+fi
+
+if [ ! -d $SRC ]; then
+ tar -zxf $TARBALL
+fi
+
+# Build the bcp tool
+# The bcp tool is a boost specific tool that allows importing a subset of boost
+# The downside is that it copies a lot of unnecessary stuff in libs
+# and does not understand #ifdefs
+#
+cd $SRC
+
+./bootstrap.sh
+
+./b2 tools/bcp
+
+test -d $DEST_DIR || mkdir $DEST_DIR
+$SRC/dist/bin/bcp --boost=$SRC/ algorithm array asio bind chrono config container date_time filesystem function integer intrusive multi_index noncopyable optional program_options random smart_ptr static_assert thread unordered utility $DEST_DIR
+
+# Trim files
+cd $DEST_DIR
+
+rm -f Jamroot boost.png
+rm -rf doc
+
+# Trim misc directories from libs that bcp pulled in
+find libs -type d -name test -print0 | xargs -0 rm -rf
+find libs -type d -name doc -print0 | xargs -0 rm -rf
+find libs -type d -name build -print0 | xargs -0 rm -rf
+find libs -type d -name examples -print0 | xargs -0 rm -rf
+find libs -type d -name example -print0 | xargs -0 rm -rf
+find libs -type d -name meta -print0 | xargs -0 rm -rf
+find libs -type d -name tutorial -print0 | xargs -0 rm -rf
+find libs -type d -name performance -print0 | xargs -0 rm -rf
+find libs -type d -name bench -print0 | xargs -0 rm -rf
+find libs -type d -name perf -print0 | xargs -0 rm -rf
+find libs -type d -name proj -print0 | xargs -0 rm -rf
+find libs -type d -name xmldoc -print0 | xargs -0 rm -rf
+find libs -type d -name tools -print0 | xargs -0 rm -rf
+find libs -type d -name extra -print0 | xargs -0 rm -rf
+find libs -type d -name bug -print0 | xargs -0 rm -rf
+
+find libs -name "*.html" -print0 | xargs -0 rm -f
+find libs -name "*.htm" -print0 | xargs -0 rm -f
+find libs -name "*.zip" -print0 | xargs -0 rm -f
+find libs -name "*.gif" -print0 | xargs -0 rm -f
+
+# Full of unneeded code
+rm -rf libs/algorithm
+rm -rf libs/config
+rm -rf libs/static_assert
+
+# Trim the include directory for the stuff bcp dragged in and we do not need
+# since they are 1+ MB each
+rm -f boost/typeof/vector100.hpp
+rm -f boost/typeof/vector150.hpp
+rm -f boost/typeof/vector200.hpp
+
+# Remove compat files for compilers we do not support
+find boost -type d -name dmc -print0 | xargs -0 rm -rf
+find boost -type d -name "bcc*" -print0 | xargs -0 rm -rf
+find boost -type d -name mwcw -print0 | xargs -0 rm -rf
+find boost -type d -name msvc60 -print0 | xargs -0 rm -rf
+find boost -type d -name msvc70 -print0 | xargs -0 rm -rf
+
+find . -type d -empty -print0 | xargs -0 rmdir