opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
-opt local-rebuild 0 "use an installed rustc matching the current version, for rebuilds"
+opt local-rebuild 0 "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version"
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
opt rpath 1 "build rpaths into rustc itself"
opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
opt orbit 0 "get MIR where it belongs - everywhere; most importantly, in orbit"
opt codegen-tests 1 "run the src/test/codegen tests"
opt option-checking 1 "complain about unrecognized options in this configure script"
+opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
# Optimization and debugging options. These may be overridden by the release channel, etc.
opt_nosave optimize 1 "build optimized rust code"
valopt armv7-linux-androideabi-ndk "" "armv7-linux-androideabi NDK standalone path"
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
valopt nacl-cross-path "" "NaCl SDK path (Pepper Canary is recommended). Must be absolute!"
-valopt release-channel "dev" "the name of the release channel to build"
valopt musl-root "/usr/local" "MUSL root installation directory"
valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
+if [ -e ${CFG_SRC_DIR}.git ]
+then
+ valopt release-channel "dev" "the name of the release channel to build"
+else
+ # If we have no git directory then we are probably a tarball distribution
+ # and should default to stable channel - Issue 28322
+ probe CFG_GIT git
+ msg "git: no git directory. Changing default release channel to stable"
+ valopt release-channel "stable" "the name of the release channel to build"
+fi
+
# Used on systems where "cc" and "ar" are unavailable
valopt default-linker "cc" "the default linker"
valopt default-ar "ar" "the default ar"
probe CFG_GDB gdb
probe CFG_LLDB lldb
+if [ -n "$CFG_ENABLE_NINJA" ]
+then
+ probe CFG_NINJA ninja
+ if [ -z "$CFG_NINJA" ]
+ then
+ # On Debian and Fedora, the `ninja` binary is an IRC bot, so the build tool was
+ # renamed. Handle this case.
+ probe CFG_NINJA ninja-build
+ fi
+fi
+
# For building LLVM
probe_need CFG_CMAKE cmake
;;
*-msvc)
- # There are some MSYS python builds which will auto-translate
- # windows-style paths to MSYS-style paths in Python itself.
- # Unfortunately this breaks LLVM's build system as somewhere along
- # the line LLVM prints a path into a file from Python and then CMake
- # later tries to interpret that path. If Python prints a MSYS path
- # and CMake tries to use it as a Windows path, you're gonna have a
- # Bad Time.
- #
- # Consequently here we try to detect when that happens and print an
- # error if it does.
- if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
- then
- err "
-
-python is silently translating windows paths to MSYS paths \
-and the build will fail if this python is used.
-
-Either an official python install must be used or an \
-alternative python package in MinGW must be used.
-
-If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
-package instead of python2:
-
-$ pacman -R python2 && pacman -S mingw-w64-x86_64-python2
-"
- fi
-
# There are three builds of cmake on windows: MSVC, MinGW and Cygwin
# The Cygwin build does not have generators for Visual Studio, so
# detect that here and error.
esac
done
+if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
+then
+ # There are some MSYS python builds which will auto-translate
+ # windows-style paths to MSYS-style paths in Python itself.
+ # Unfortunately this breaks LLVM's build system as somewhere along
+ # the line LLVM prints a path into a file from Python and then CMake
+ # later tries to interpret that path. If Python prints a MSYS path
+ # and CMake tries to use it as a Windows path, you're gonna have a
+ # Bad Time.
+ #
+ # Consequently here we try to detect when that happens and print an
+ # error if it does.
+ if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
+ then
+ err "
+
+python is silently translating windows paths to MSYS paths \
+and the build will fail if this python is used.
+
+Either an official python install must be used or an \
+alternative python package in MinGW must be used.
+
+If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
+package instead of python2:
+
+$ pacman -S mingw-w64-x86_64-python2
+"
+ fi
+fi
+
if [ -n "$CFG_PERF" ]
then
HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
fi
# We need the generator later on for compiler-rt even if LLVM's not built
- if [ ${is_msvc} -ne 0 ]
+ if [ -n "$CFG_NINJA" ]
+ then
+ generator="Ninja"
+ elif [ ${is_msvc} -ne 0 ]
then
case "$CFG_MSVC_ROOT" in
*14.0*)
fi
if [ "$t" != "$CFG_BUILD" ]; then
+ # see http://llvm.org/docs/HowToCrossCompileLLVM.html
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CROSSCOMPILING=True"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGET_ARCH=$arch"
- CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TABLEGEN=$LLVM_INST_DIR/bin/llvm-tablegen"
+ CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TABLEGEN=$CFG_BUILD_DIR/$CFG_BUILD/llvm/bin/llvm-tblgen"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=$t"
fi
msg "configuring LLVM with:"
msg "$CMAKE_ARGS"
- (cd $LLVM_BUILD_DIR && eval "$CFG_CMAKE" $CMAKE_ARGS)
+ (cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
need_ok "LLVM cmake configure failed"
fi