From 3308bd54b2fa70080c523f7899140f335928ac83 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 10:21:16 -0800 Subject: [PATCH 1/7] configure: Remove git probing logic This is all in rustbuild already. --- configure | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/configure b/configure index d8861dacafac1..c084478b37582 100755 --- a/configure +++ b/configure @@ -821,17 +821,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then err "Found $python_version, but Python 2.7 is required" fi -# If we have no git directory then we are probably a tarball distribution -# and shouldn't attempt to load submodules -if [ ! -e ${CFG_SRC_DIR}.git ] -then - probe CFG_GIT git - msg "git: no git directory. disabling submodules" - CFG_DISABLE_MANAGE_SUBMODULES=1 -else - probe_need CFG_GIT git -fi - # Use `md5sum` on GNU platforms, or `md5 -q` on BSD probe CFG_MD5 md5 probe CFG_MD5SUM md5sum From b326bd31e516953d6434096755900f6dee7b3e48 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 10:21:41 -0800 Subject: [PATCH 2/7] configure: Remove md5 probing logic This is all not used any more --- configure | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/configure b/configure index c084478b37582..9c3c376951196 100755 --- a/configure +++ b/configure @@ -821,20 +821,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then err "Found $python_version, but Python 2.7 is required" fi -# Use `md5sum` on GNU platforms, or `md5 -q` on BSD -probe CFG_MD5 md5 -probe CFG_MD5SUM md5sum -if [ -n "$CFG_MD5" ] -then - CFG_HASH_COMMAND="$CFG_MD5 -q | cut -c 1-8" -elif [ -n "$CFG_MD5SUM" ] -then - CFG_HASH_COMMAND="$CFG_MD5SUM | cut -c 1-8" -else - err 'could not find one of: md5 md5sum' -fi -putvar CFG_HASH_COMMAND - probe CFG_CLANG clang++ probe CFG_CCACHE ccache probe CFG_GCC gcc From e019f133a00acd4775be589cec8ed7c99eb5025b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 10:23:09 -0800 Subject: [PATCH 3/7] configure: Remove miscellaneous program probes All of these should be handled by rustbuild in sanity.rs right now. --- configure | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/configure b/configure index 9c3c376951196..af8b733c7b3bb 100755 --- a/configure +++ b/configure @@ -821,51 +821,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then err "Found $python_version, but Python 2.7 is required" fi -probe CFG_CLANG clang++ -probe CFG_CCACHE ccache -probe CFG_GCC gcc -probe CFG_LD ld -probe CFG_VALGRIND valgrind -probe CFG_PERF perf -probe CFG_ISCC iscc -probe CFG_ANTLR4 antlr4 -probe CFG_GRUN grun -probe CFG_FLEX flex -probe CFG_BISON bison -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 -if [ -z "$CFG_LLVM_ROOT" ] -then - probe_need CFG_CMAKE cmake -fi - -# On MacOS X, invoking `javac` pops up a dialog if the JDK is not -# installed. Since `javac` is only used if `antlr4` is available, -# probe for it only in this case. -if [ -n "$CFG_ANTLR4" ] -then - CFG_ANTLR4_JAR="\"$(find /usr/ -name antlr-complete.jar 2>/dev/null | head -n 1)\"" - if [ "x" = "x$CFG_ANTLR4_JAR" ] - then - CFG_ANTLR4_JAR="\"$(find ~ -name antlr-complete.jar 2>/dev/null | head -n 1)\"" - fi - putvar CFG_ANTLR4_JAR $CFG_ANTLR4_JAR - probe CFG_JAVAC javac -fi - # the valgrind rpass tests will fail if you don't have a valgrind, but they're # only disabled if you opt out. if [ -z "$CFG_VALGRIND" ] @@ -927,10 +882,6 @@ if [ -n "$RUST_DIST_SERVER" -a -n "$ALLOW_NONZERO_RLIMIT_CORE" ]; then fi fi -step_msg "looking for target specific programs" - -probe CFG_ADB adb - BIN_SUF= if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] then From e82bcabf07df9518859dc30fe5620e16533a04d5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 10:25:32 -0800 Subject: [PATCH 4/7] configure: Remove some lldb-specific logic All of this should already be vendored in rustbuild if necessary or otherwise it's just not used. --- configure | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/configure b/configure index af8b733c7b3bb..6d9134619c531 100755 --- a/configure +++ b/configure @@ -835,41 +835,6 @@ then fi fi -if [ -n "$CFG_LLDB" ] -then - # Store LLDB's version - CFG_LLDB_VERSION=$($CFG_LLDB --version 2>/dev/null | head -1) - putvar CFG_LLDB_VERSION - - # If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from - # LLDB via the -P commandline options. - if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ] - then - CFG_LLDB_PYTHON_DIR=$($CFG_LLDB -P) - - # If CFG_LLDB_PYTHON_DIR is not a valid directory, set it to something more readable - if [ ! -d "$CFG_LLDB_PYTHON_DIR" ] - then - CFG_LLDB_PYTHON_DIR="LLDB_PYTHON_DIRECTORY_NOT_FOUND" - fi - - putvar CFG_LLDB_PYTHON_DIR - fi -fi - -# LLDB tests on OSX require /usr/bin/python, not something like Homebrew's -# /usr/local/bin/python. We're loading a compiled module for LLDB tests which is -# only compatible with the system. -case $CFG_BUILD in - *-apple-darwin) - CFG_LLDB_PYTHON=/usr/bin/python - ;; - *) - CFG_LLDB_PYTHON=$CFG_PYTHON - ;; -esac -putvar CFG_LLDB_PYTHON - # Do some sanity checks if running on buildbot # (these env vars are set by rust-buildbot) if [ -n "$RUST_DIST_SERVER" -a -n "$ALLOW_NONZERO_RLIMIT_CORE" ]; then From 748e2de7ccec95b22851fb8f1b565e7dd25b781a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 11:12:40 -0800 Subject: [PATCH 5/7] configure: Remove SUPPORTED_TARGET support This is not used any more --- configure | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configure b/configure index 6d9134619c531..92ee3436c5f67 100755 --- a/configure +++ b/configure @@ -912,10 +912,6 @@ CFG_MANDIR=${CFG_MANDIR%/} CFG_DOCDIR=${CFG_DOCDIR%/} CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')" CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')" -CFG_SUPPORTED_TARGET="" -for target_file in ${CFG_SRC_DIR}mk/cfg/*.mk; do - CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)" -done # copy build-triples to host-triples so that builds are a subset of hosts V_TEMP="" From 51a4238dccf39b34ea56cb02a5e01ae6dc06356e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 11:13:41 -0800 Subject: [PATCH 6/7] configure: Remove misc unused vars None of this is used by rustbuild any more --- configure | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/configure b/configure index 92ee3436c5f67..42e5d32cf8089 100755 --- a/configure +++ b/configure @@ -951,31 +951,6 @@ putvar CFG_MANDIR putvar CFG_DOCDIR 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 From f8ca805422db8ff5c5112526db0794603b259577 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 Feb 2017 11:27:39 -0800 Subject: [PATCH 7/7] configure: Remove --build detection This commit removes detection of CFG_OSTYPE and CFG_CPUTYPE from the configure script, which means that the default value of `--build` is no longer present in the configure script. All this logic is now available in rustbuild itself, so there's no need to duplicate it. --- configure | 203 +------------------------------------ src/bootstrap/bootstrap.py | 23 ++++- src/bootstrap/config.rs | 15 ++- 3 files changed, 27 insertions(+), 214 deletions(-) diff --git a/configure b/configure index 42e5d32cf8089..9b34e214214a5 100755 --- a/configure +++ b/configure @@ -384,207 +384,6 @@ need_cmd sed 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)/" @@ -673,7 +472,7 @@ valopt infodir "${CFG_PREFIX}/share/info" "install additional info" 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" diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 4f41d337592b3..b326f95e505fb 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -296,8 +296,10 @@ def get_toml(self, key): def get_mk(self, key): for line in iter(self.config_mk.splitlines()): - if line.startswith(key): - return line[line.find(':=') + 2:].strip() + if line.startswith(key + ' '): + var = line[line.find(':=') + 2:].strip() + if var != '': + return var return None def cargo(self): @@ -438,6 +440,8 @@ def build_triple(self): sys.exit(err) elif ostype == 'Darwin': ostype = 'apple-darwin' + elif ostype == 'Haiku': + ostype = 'unknown-haiku' elif ostype.startswith('MINGW'): # msys' `uname` does not print gcc configuration, but prints msys # configuration. so we cannot believe `uname -m`: @@ -465,9 +469,12 @@ def build_triple(self): cputype = 'i686' elif cputype in {'xscale', 'arm'}: cputype = 'arm' - elif cputype in {'armv7l', 'armv8l'}: + elif cputype in {'armv6l', 'armv7l', 'armv8l'}: cputype = 'arm' ostype += 'eabihf' + elif cputype == 'armv7l': + cputype = 'armv7' + ostype += 'eabihf' elif cputype == 'aarch64': cputype = 'aarch64' elif cputype == 'arm64': @@ -488,12 +495,20 @@ def build_triple(self): raise ValueError('unknown byteorder: ' + sys.byteorder) # only the n64 ABI is supported, indicate it ostype += 'abi64' - elif cputype in {'powerpc', 'ppc', 'ppc64'}: + elif cputype in {'powerpc', 'ppc'}: cputype = 'powerpc' + elif cputype in {'powerpc64', 'ppc64'}: + cputype = 'powerpc64' + elif cputype in {'powerpc64le', 'ppc64le'}: + cputype = 'powerpc64le' elif cputype == 'sparcv9': pass elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}: cputype = 'x86_64' + elif cputype == 's390x': + cputype = 's390x' + elif cputype == 'BePC': + cputype = 'i686' else: err = "unknown cpu type: " + cputype if self.verbose: diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 87c35e0502ce6..431d4a333d337 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -463,14 +463,13 @@ impl Config { } match key { - "CFG_BUILD" => self.build = value.to_string(), - "CFG_HOST" => { - self.host = value.split(" ").map(|s| s.to_string()) - .collect(); - } - "CFG_TARGET" => { - self.target = value.split(" ").map(|s| s.to_string()) - .collect(); + "CFG_BUILD" if value.len() > 0 => self.build = value.to_string(), + "CFG_HOST" if value.len() > 0 => { + self.host.extend(value.split(" ").map(|s| s.to_string())); + + } + "CFG_TARGET" if value.len() > 0 => { + self.target.extend(value.split(" ").map(|s| s.to_string())); } "CFG_MUSL_ROOT" if value.len() > 0 => { self.musl_root = Some(parse_configure_path(value));