Index: utils/docker/scripts/build_install_llvm.sh =================================================================== --- utils/docker/scripts/build_install_llvm.sh +++ utils/docker/scripts/build_install_llvm.sh @@ -48,6 +48,7 @@ # We always checkout llvm LLVM_PROJECTS="llvm" CMAKE_LLVM_ENABLE_PROJECTS="" +CLANG_TOOLS_EXTRA_ENABLED=0 function contains_project() { local TARGET_PROJ="$1" @@ -60,6 +61,16 @@ return 1 } +function append_project() { + local PROJ="$1" + + LLVM_PROJECTS="$LLVM_PROJECTS $PROJ" + if [ "$CMAKE_LLVM_ENABLE_PROJECTS" != "" ]; then + CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLE_PROJECTS;" + fi + CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLED_PROJECTS$PROJ" +} + while [[ $# -gt 0 ]]; do case "$1" in -r|--revision) @@ -75,19 +86,27 @@ -p|--llvm-project) shift PROJ="$1" + shift + if [ "$PROJ" == "cfe" ]; then PROJ="clang" fi - if ! contains_project "$PROJ" ; then - LLVM_PROJECTS="$LLVM_PROJECTS $PROJ" - if [ "$CMAKE_LLVM_ENABLE_PROJECTS" != "" ]; then - CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLE_PROJECTS;" + + if [ "$PROJ" == "clang-tools-extra" ]; then + if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then + echo "Project 'clang-tools-extra' is already enabled, ignoring extra occurences." + else + CLANG_TOOLS_EXTRA_ENABLED=1 fi - CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLED_PROJECTS$PROJ" + + continue + fi + + if ! contains_project "$PROJ" ; then + append_project "$PROJ" else echo "Project '$PROJ' is already enabled, ignoring extra occurences." fi - shift ;; -i|--install-target) shift @@ -114,6 +133,15 @@ exit 1 fi +if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then + if ! contains_project "clang"; then + echo "Project 'clang-tools-extra' was enabled without 'clang'." + echo "Adding 'clang' to a list of projects." + + append_project "clang" + fi +fi + if [ "$LLVM_BRANCH" == "" ]; then LLVM_BRANCH="trunk" fi @@ -148,6 +176,16 @@ "$CLANG_BUILD_DIR/src/$LLVM_PROJECT" done +if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then + echo "Checking out https://llvm.org/svn/llvm-project/clang-tools-extra to $CLANG_BUILD_DIR/src/clang/tools/extra" + # FIXME: --trust-server-cert is required to workaround 'SSL issuer is not + # trusted' error. Using https seems preferable to http either way, + # albeit this is not secure. + svn co -q $SVN_REV_ARG --trust-server-cert \ + "https://llvm.org/svn/llvm-project/clang-tools-extra/$LLVM_BRANCH" \ + "$CLANG_BUILD_DIR/src/clang/tools/extra" +fi + mkdir "$CLANG_BUILD_DIR/build" pushd "$CLANG_BUILD_DIR/build"