Bug 1400533: Pickup $TOOLTOOL_DIR to figure out where compilers are. draft
authorTom Prince <mozilla@hocat.ca>
Thu, 21 Sep 2017 18:26:47 -0600
changeset 22681 441c362ed667d4e0206a0d7bea635dcafcea47c8
parent 22680 8f431a95645cdf312393eac5f0a2ad5a57839706
child 22682 f090f57511eeed5e5bad0ff3dd3a98f7b20000ce
push id103
push userbmo:mozilla@hocat.ca
push dateWed, 27 Sep 2017 18:29:34 +0000
bugs1400533
Bug 1400533: Pickup $TOOLTOOL_DIR to figure out where compilers are. MozReview-Commit-ID: 9wG6Y0c3E9O
build/macosx/local-mozconfig.common
--- a/build/macosx/local-mozconfig.common
+++ b/build/macosx/local-mozconfig.common
@@ -4,36 +4,37 @@
 
 if [ "x$IS_NIGHTLY" = "xyes" ]; then
   # Some nightlies (eg: Mulet) don't want these set.
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
 fi
 . "$topsrcdir/build/mozconfig.common"
 
-if [ -d "$topsrcdir/clang" ]; then
+if [ -d $TOOLTOOL_DIR/clang ]; then
+    true
+elif [ -d "$topsrcdir/clang" ]; then
     # mozilla-central based build
-    export CC=$topsrcdir/clang/bin/clang
-    export CXX=$topsrcdir/clang/bin/clang++
-    export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
-    export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
+    TOOLTOOL_DIR=$topsrcdir
+elif [ -d "$topsrcdir/../clang" ]; then
+    TOOLTOOL_DIR=$topsrcdir/..
+else
+    echo "Don't know where we are; can't find clang. topsrcdir: $topsrcdir"
+fi
+
+if [ -d $TOOLTOOL_DIR ]; then
+    export CC="$TOOLTOOL_DIR/clang/bin/clang"
+    export CXX="$TOOLTOOL_DIR/clang/bin/clang++"
+    export CPP="$TOOLTOOL_DIR/clang/bin/clang -E"
+    export LLVMCONFIG=$TOOLTOOL_DIR/clang/bin/llvm-config
+    export DSYMUTIL=$TOOLTOOL_DIR/clang/bin/llvm-dsymutil
     # Use an updated linker.
-    ldflags="-B$topsrcdir/cctools/bin"
-    export AR=$topsrcdir/cctools/bin/ar
-    export RANLIB=$topsrcdir/cctools/bin/ranlib
-elif [ -d "$topsrcdir/../clang" ]; then
-    # comm-central based build
-    export CC=$topsrcdir/../clang/bin/clang
-    export CXX=$topsrcdir/../clang/bin/clang++
-    export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
-    export DSYMUTIL=$topsrcdir/../clang/bin/llvm-dsymutil
-    # Use an updated linker.
-    ldflags="-B$topsrcdir/../cctools/bin"
-    export AR=$topsrcdir/../cctools/bin/ar
-    export RANLIB=$topsrcdir/../cctools/bin/ranlib
+    ldflags="-B$TOOLTOOL_DIR/cctools/bin "
+    export AR=$TOOLTOOL_DIR/cctools/bin/ar
+    export RANLIB=$TOOLTOOL_DIR/cctools/bin/ranlib
 fi
 
 # Ensure the updated linker doesn't generate things our older build tools
 # don't understand.
 ldflags="$ldflags -Wl,-no_data_in_code_info"
 export LDFLAGS="$ldflags"
 
 # If not set use the system default clang