aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhelpers/llvm-projs142
-rwxr-xr-xhelpers/llvm-sync58
2 files changed, 151 insertions, 49 deletions
diff --git a/helpers/llvm-projs b/helpers/llvm-projs
index ac20999..f9cc706 100755
--- a/helpers/llvm-projs
+++ b/helpers/llvm-projs
@@ -8,9 +8,26 @@
prog=`basename $0`
syntax() {
- echo "Syntax: $prog {+/-}[clang|cextra|rt|libs|tools|test]"
- echo " noarg: list linked projects"
- echo " {+/-}: link / unlik projects (default: link)"
+ echo "Syntax: $prog [clang|lldb|lld|rt|libs|all|none] {+/-}[c|x|r|k|d|l|a|u|t]"
+ echo " no args: List linked projects"
+ echo " clang: Clang + Clang Tools Extra"
+ echo " lldb: Clang + lldb"
+ echo " lld: Clang + lld"
+ echo " rt: Clang + compiler-rt"
+ echo " libs: Clang + libcxx + libcxxabi + libunwind"
+ echo " all: Link all projects"
+ echo " none: Unlink all projects"
+ echo " {+/-}: link / unlink projects (default: link)"
+ echo " c Clang"
+ echo " x Clang Tools Extra"
+ echo " r Compiler-rt"
+ echo " k lld"
+ echo " d lldb"
+ echo " l libcxx"
+ echo " a libcxxabi"
+ echo " u libunwind"
+ echo " t test-suite"
+ echo " Long options unlink everything before proceeding. Use the short options for fine-tuning"
}
# Dirs and links into LLVM
@@ -76,6 +93,19 @@ list_all() {
echo
}
+need_all() {
+ need=$1
+ clang=$need
+ clang_extra=$need
+ rt=$need
+ libcxx=$need
+ libcxxabi=$need
+ libunwind=$need
+ lld=$need
+ lldb=$need
+ tests=$need
+}
+
# No args, list
if [ "$1" = "" ]; then
echo "Use $prog -h for options"
@@ -95,56 +125,120 @@ lld=`init $lld_link`
lldb=`init $lldb_link`
tests=`init $tests_link`
-# Check all needed projects
+# See if the first option is one of the long options
+opt=$1
+case $opt in
+ clang)
+ need_all false
+ clang=true
+ clang_extra=true
+ shift
+ ;;
+ lldb)
+ need_all false
+ clang=true
+ lldb=true
+ shift
+ ;;
+ lld)
+ need_all false
+ clang=true
+ lld=true
+ shift
+ ;;
+ rt)
+ need_all false
+ clang=true
+ rt=true
+ shift
+ ;;
+ libs)
+ need_all false
+ clang=true
+ libcxx=true
+ libcxxabi=true
+ libunwind=true
+ shift
+ ;;
+ all)
+ need_all true
+ shift
+ ;;
+ none)
+ need_all false
+ shift
+ ;;
+ list)
+ list_all
+ exit
+ ;;
+ -h)
+ syntax
+ exit
+ ;;
+esac
+
+# Parse short options, if any
while ! test -z $1; do
opt=$1
+
sign=${opt:0:1}
flag=true
if [ "$sign" = "-" ]; then
flag=false
opt=${opt:1}
- fi
- if [ "$sign" = "+" ]; then
+ elif [ "$sign" = "+" ]; then
opt=${opt:1}
+ else
+ # Doesn't look like one of our short options
+ syntax
+ exit
fi
case $opt in
- clang)
+ c)
clang=$flag
;;
- cextra)
+ x)
clang_extra=$flag
;;
- rt)
+ r)
rt=$flag
;;
- libs)
- libcxx=$flag
- libcxxabi=$flag
- libunwind=$flag
- ;;
- tools)
+ k)
lld=$flag
+ ;;
+ d)
lldb=$flag
;;
- test)
- tests=$flag
+ l)
+ libcxx=$flag
;;
- list)
- list_all
- exit
+ a)
+ libcxxabi=$flag
;;
- -h)
- syntax
- exit
+ u)
+ libunwind=$flag
+ ;;
+ t)
+ tests=$flag
;;
*)
syntax
- exit 1
+ exit
esac
shift
done
+# clang and clang-tools-extra have a special relationship: we can't enable
+# clang-tools-extra without enabling clang, and we also can't disable clang
+# without also disabling clang-tools-extra
+if [ "$clang_extra" = true -a "$clang" = false ]; then
+ echo "Can't have Clang Tools Extra without Clang! Try to add +c or -x"
+ exit
+fi
+
+
# Update links
update $tests_dir $tests_link $tests
update $lldb_dir $lldb_link $lldb
diff --git a/helpers/llvm-sync b/helpers/llvm-sync
index 5d5cb27..0374221 100755
--- a/helpers/llvm-sync
+++ b/helpers/llvm-sync
@@ -19,48 +19,47 @@ function repo_sync () {
}
prog=`basename $0`
-syntax="Syntax: $prog [-clang-tools-e(x)tra] [-compiler(r)T] [-(l)ibs] [-Lin(k)er] [-(d)ebugger] [-(t)ests] [-(w)eb pages] [-(a)ll]"
+clang=false
cextra=false
rt=false
-libs=false
+libcxx=false
+libcxxabi=false
+libunwind=false
linker=false
debug=false
tests=false
web=false
+if [ -d $LLVM_SRC/tools/clang ]; then clang=true; fi
+if [ -d $LLVM_SRC/tools/clang/tools/extra ]; then cextra=true; fi
+if [ -d $LLVM_SRC/projects/compiler-rt ]; then rt=true; fi
+if [ -d $LLVM_SRC/projects/libcxx ]; then libcxx=true; fi
+if [ -d $LLVM_SRC/projects/libcxxabi ]; then libcxxabi=true; fi
+if [ -d $LLVM_SRC/projects/libunwind ]; then libunwind=true; fi
+if [ -d $LLVM_SRC/tools/lld ]; then linker=true; fi
+if [ -d $LLVM_SRC/tools/lldb ]; then debug=true; fi
+if [ -d $LLVM_SRC/projects/test-suite ]; then tests=true; fi
-while getopts "xrlkdtwa" opt; do
+while getopts "wa" opt; do
case $opt in
- x)
- cextra=true
- ;;
- r)
- rt=true
- ;;
- l)
- libs=true
- ;;
- k)
- linker=true
- ;;
- d)
- debug=true
- ;;
- t)
- tests=true
- ;;
w)
web=true
;;
a)
+ clang=true
cextra=true
rt=true
- libs=true
+ libcxx=true
+ libcxxabi=true
+ libunwind=true
linker=true
debug=true
tests=true
;;
*)
- echo $syntax
+ echo "Syntax: $prog [-(w)eb pages] [-(a)ll]"
+ echo "Syncs the repos that are currently linked into the llvm source tree"
+ echo "-w forces sync for the web repos (which are never linked)"
+ echo "-a forces sync for non-web repos that are not linked"
exit 1
;;
esac
@@ -68,7 +67,10 @@ done
# Compulsory updates
repo_sync LLVM $LLVM_SRC
-repo_sync Clang $LLVM_SRC/../clang
+
+if $clang; then
+ repo_sync Clang $LLVM_SRC/../clang
+fi
# Optional updates
if $cextra; then
@@ -79,9 +81,15 @@ if $rt; then
repo_sync RT $LLVM_SRC/../compiler-rt
fi
-if $libs; then
+if $libcxx; then
repo_sync LibC++ $LLVM_SRC/../libcxx
+fi
+
+if $libcxxabi; then
repo_sync LibC++ABI $LLVM_SRC/../libcxxabi
+fi
+
+if $libunwind; then
repo_sync LibUnwind $LLVM_SRC/../libunwind
fi