need_cmd file
need_cmd make
-msg "inspecting environment"
-
-CFG_OSTYPE=$(uname -s)
-CFG_CPUTYPE=$(uname -m)
-
-if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ]
-then
- # Darwin's `uname -s` lies and always returns i386. We have to use sysctl
- # instead.
- if sysctl hw.optional.x86_64 | grep -q ': 1'
- then
- CFG_CPUTYPE=x86_64
- fi
-fi
-
-# The goal here is to come up with the same triple as LLVM would,
-# at least for the subset of platforms we're willing to target.
-
-case $CFG_OSTYPE in
-
- Linux)
- CFG_OSTYPE=unknown-linux-gnu
- ;;
-
- FreeBSD)
- CFG_OSTYPE=unknown-freebsd
- ;;
-
- DragonFly)
- CFG_OSTYPE=unknown-dragonfly
- ;;
-
- Bitrig)
- CFG_OSTYPE=unknown-bitrig
- ;;
-
- OpenBSD)
- CFG_OSTYPE=unknown-openbsd
- ;;
-
- NetBSD)
- CFG_OSTYPE=unknown-netbsd
- ;;
-
- Darwin)
- CFG_OSTYPE=apple-darwin
- ;;
-
- SunOS)
- CFG_OSTYPE=sun-solaris
- CFG_CPUTYPE=$(isainfo -n)
- ;;
-
- Haiku)
- CFG_OSTYPE=unknown-haiku
- ;;
-
- MINGW*)
- # msys' `uname` does not print gcc configuration, but prints msys
- # configuration. so we cannot believe `uname -m`:
- # msys1 is always i686 and msys2 is always x86_64.
- # instead, msys defines $MSYSTEM which is MINGW32 on i686 and
- # MINGW64 on x86_64.
- CFG_CPUTYPE=i686
- CFG_OSTYPE=pc-windows-gnu
- if [ "$MSYSTEM" = MINGW64 ]
- then
- CFG_CPUTYPE=x86_64
- fi
- ;;
-
- MSYS*)
- CFG_OSTYPE=pc-windows-gnu
- ;;
-
-# Thad's Cygwin identifiers below
-
-# Vista 32 bit
- CYGWIN_NT-6.0)
- CFG_OSTYPE=pc-windows-gnu
- CFG_CPUTYPE=i686
- ;;
-
-# Vista 64 bit
- CYGWIN_NT-6.0-WOW64)
- CFG_OSTYPE=pc-windows-gnu
- CFG_CPUTYPE=x86_64
- ;;
-
-# Win 7 32 bit
- CYGWIN_NT-6.1)
- CFG_OSTYPE=pc-windows-gnu
- CFG_CPUTYPE=i686
- ;;
-
-# Win 7 64 bit
- CYGWIN_NT-6.1-WOW64)
- CFG_OSTYPE=pc-windows-gnu
- CFG_CPUTYPE=x86_64
- ;;
-
-# Win 8 # uname -s on 64-bit cygwin does not contain WOW64, so simply use uname -m to detect arch (works in my install)
- CYGWIN_NT-6.3)
- CFG_OSTYPE=pc-windows-gnu
- ;;
-# We do not detect other OS such as XP/2003 using 64 bit using uname.
-# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
- *)
- err "unknown OS type: $CFG_OSTYPE"
- ;;
-esac
-
-
-case $CFG_CPUTYPE in
-
- i386 | i486 | i686 | i786 | x86)
- CFG_CPUTYPE=i686
- ;;
-
- xscale | arm)
- CFG_CPUTYPE=arm
- ;;
-
- armv6l)
- CFG_CPUTYPE=arm
- CFG_OSTYPE="${CFG_OSTYPE}eabihf"
- ;;
-
- armv7l | armv8l)
- CFG_CPUTYPE=armv7
- CFG_OSTYPE="${CFG_OSTYPE}eabihf"
- ;;
-
- aarch64 | arm64)
- CFG_CPUTYPE=aarch64
- ;;
-
- powerpc | ppc)
- CFG_CPUTYPE=powerpc
- ;;
-
- powerpc64 | ppc64)
- CFG_CPUTYPE=powerpc64
- ;;
-
- powerpc64le | ppc64le)
- CFG_CPUTYPE=powerpc64le
- ;;
-
- s390x)
- CFG_CPUTYPE=s390x
- ;;
-
- x86_64 | x86-64 | x64 | amd64)
- CFG_CPUTYPE=x86_64
- ;;
-
- mips | mips64)
- if [ "$CFG_CPUTYPE" = "mips64" ]; then
- CFG_OSTYPE="${CFG_OSTYPE}abi64"
- fi
- ENDIAN=$(printf '\1' | od -dAn)
- if [ "$ENDIAN" -eq 1 ]; then
- CFG_CPUTYPE="${CFG_CPUTYPE}el"
- elif [ "$ENDIAN" -ne 256 ]; then
- err "unknown endianness: $ENDIAN (expecting 1 for little or 256 for big)"
- fi
- ;;
-
- BePC)
- CFG_CPUTYPE=i686
- ;;
-
- *)
- err "unknown CPU type: $CFG_CPUTYPE"
-esac
-
-# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
-if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
-then
- # $SHELL does not exist in standard 'sh', so probably only exists
- # if configure is running in an interactive bash shell. /usr/bin/env
- # exists *everywhere*.
- BIN_TO_PROBE="$SHELL"
- if [ ! -r "$BIN_TO_PROBE" ]; then
- if [ -r "/usr/bin/env" ]; then
- BIN_TO_PROBE="/usr/bin/env"
- else
- warn "Cannot check if the userland is i686 or x86_64"
- fi
- fi
- file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
- if [ $? != 0 ]; then
- msg "i686 userland on x86_64 Linux kernel"
- CFG_CPUTYPE=i686
- fi
-fi
-
-
-DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}"
-
CFG_SRC_DIR="$(abs_path $(dirname $0))/"
CFG_SRC_DIR_RELATIVE="$(dirname $0)/"
CFG_BUILD_DIR="$(pwd)/"
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 llvm-link-shared 0 "prefer shared linking to LLVM (llvm-config --link-shared)"
+opt llvm-clean-rebuild 0 "delete LLVM build directory on rebuild"
opt rpath 1 "build rpaths into rustc itself"
opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
# This is used by the automation to produce single-target nightlies
valopt llvm-root "" "set LLVM root"
valopt python "" "set path to python"
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
-valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
+valopt build "" "GNUs ./configure syntax LLVM build triple"
valopt android-cross-path "" "Android NDK standalone path (deprecated)"
valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
valopt armv7-linux-androideabi-ndk "" "armv7-linux-androideabi NDK standalone path"
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
+valopt x86_64-linux-android-ndk "" "x86_64-linux-android NDK standalone path"
valopt nacl-cross-path "" "NaCl SDK path (Pepper Canary is recommended). Must be absolute!"
valopt musl-root "/usr/local" "MUSL root installation directory (deprecated)"
valopt musl-root-x86_64 "" "x86_64-unknown-linux-musl install directory"
opt_nosave manage-submodules 1 "let the build manage the git submodules"
opt_nosave clang 0 "prefer clang to gcc for building the runtime"
opt_nosave jemalloc 1 "build liballoc with jemalloc"
-opt elf-tls 1 "elf thread local storage on platforms where supported"
opt full-bootstrap 0 "build three compilers instead of two"
opt extended 0 "build an extended rust tool set"
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install documentation in PATH"
+valopt_nosave bindir "${CFG_PREFIX}/bin" "install binaries"
# On Windows this determines root of the subtree for target libraries.
# Host runtime libs always go to 'bin'.
CFG_PREFIX=${CFG_PREFIX%/}
CFG_MANDIR=${CFG_MANDIR%/}
CFG_DOCDIR=${CFG_DOCDIR%/}
+CFG_BINDIR=${CFG_BINDIR%/}
CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
putvar CFG_ARMV7_LINUX_ANDROIDEABI_NDK
putvar CFG_I686_LINUX_ANDROID_NDK
+putvar CFG_X86_64_LINUX_ANDROID_NDK
putvar CFG_NACL_CROSS_PATH
putvar CFG_MANDIR
putvar CFG_DOCDIR
+putvar CFG_BINDIR
putvar CFG_USING_LIBCPP
-# Avoid spurious warnings from clang by feeding it original source on
-# ccache-miss rather than preprocessed input.
-if [ -n "$CFG_ENABLE_CCACHE" ] && [ -n "$CFG_USING_CLANG" ]
-then
- CFG_CCACHE_CPP2=1
- putvar CFG_CCACHE_CPP2
-fi
-
-if [ -n "$CFG_ENABLE_CCACHE" ]
-then
- CFG_CCACHE_BASEDIR=${CFG_SRC_DIR}
- putvar CFG_CCACHE_BASEDIR
-fi
-
-
-putvar CFG_LLVM_SRC_DIR
-
-for t in $CFG_HOST
-do
- CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
- CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)
- putvar $CFG_LLVM_BUILD_DIR
- putvar $CFG_LLVM_INST_DIR
-done
-
msg
copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile
move_if_changed config.tmp config.mk