]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #18192 : jmesmon/rust/platform-generic, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 28 Oct 2014 05:46:53 +0000 (05:46 +0000)
committerbors <bors@rust-lang.org>
Tue, 28 Oct 2014 05:46:53 +0000 (05:46 +0000)
The goal here is to make it easier to add new platform definitions,
especially when the additions are programmatic (ie: in build scripts).

1  2 
configure

diff --combined configure
index 89b11daf93863831d9bd1aaf35e909ccd286aacb,05a78e068e2c4e085d59284fb8e2672141a1aef1..59e51356c6ca28504ec6b0bb0c7c336aff5fbc73
+++ b/configure
@@@ -151,22 -151,11 +151,22 @@@ validate_opt () 
      done
  }
  
 -valopt() {
 -    VAL_OPTIONS="$VAL_OPTIONS $1"
 +# `valopt OPTION_NAME DEFAULT DOC` extracts a string-valued option
 +# from command line, using provided default value for the option if
 +# not present, and saves it to the generated config.mk.
 +#
 +# `valopt_nosave` is much the same, except that it does not save the
 +# result to config.mk (instead the script should use `putvar` itself
 +# later on to save it).  `valopt_core` is the core upon which the
 +# other two are built.
  
 -    local OP=$1
 -    local DEFAULT=$2
 +valopt_core() {
 +    VAL_OPTIONS="$VAL_OPTIONS $2"
 +
 +    local SAVE=$1
 +    local OP=$2
 +    local DEFAULT=$3
 +    shift
      shift
      shift
      local DOC="$*"
                  eval $V=$val
              fi
          done
 -        putvar $V
 +        if [ "$SAVE" = "save" ]
 +        then
 +            putvar $V
 +        fi
      else
          if [ -z "$DEFAULT" ]
          then
      fi
  }
  
 -opt() {
 -    BOOL_OPTIONS="$BOOL_OPTIONS $1"
 +valopt_nosave() {
 +    valopt_core nosave "$@"
 +}
 +
 +valopt() {
 +    valopt_core save "$@"
 +}
  
 -    local OP=$1
 -    local DEFAULT=$2
 +# `opt OPTION_NAME DEFAULT DOC` extracts a boolean-valued option from
 +# command line, using the provided default value (0/1) for the option
 +# if not present, and saves it to the generated config.mk.
 +#
 +# `opt_nosave` is much the same, except that it does not save the
 +# result to config.mk (instead the script should use `putvar` itself
 +# later on to save it).  `opt_core` is the core upon which the other
 +# two are built.
 +
 +opt_core() {
 +    BOOL_OPTIONS="$BOOL_OPTIONS $2"
 +
 +    local SAVE=$1
 +    local OP=$2
 +    local DEFAULT=$3
 +    shift
      shift
      shift
      local DOC="$*"
                  FLAG=$(echo $FLAG | tr 'a-z' 'A-Z')
                  local V="CFG_${FLAG}_${OP}"
                  eval $V=1
 -                putvar $V
 +                if [ "$SAVE" = "save" ]
 +                then
 +                   putvar $V
 +                fi
              fi
          done
      else
       fi
  }
  
 +opt_nosave() {
 +    opt_core nosave "$@"
 +}
 +
 +opt() {
 +    opt_core save "$@"
 +}
 +
  envopt() {
      local NAME=$1
      local V="CFG_${NAME}"
@@@ -466,40 -422,38 +466,40 @@@ opt llvm-assertions 1 "build LLVM with 
  opt debug 1 "build with extra debug fun"
  opt ratchet-bench 0 "ratchet benchmarks"
  opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
 -opt manage-submodules 1 "let the build manage the git submodules"
  opt mingw-cross 0 "cross-compile for win32 using mingw"
 -opt clang 0 "prefer clang to gcc for building the runtime"
  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 inject-std-version 1 "inject the current compiler version of libstd into programs"
  opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
  opt rpath 0 "build rpaths into rustc itself"
  opt nightly 0 "build nightly packages"
  opt verify-install 1 "verify installed binaries work"
 -opt jemalloc 1 "build liballoc with jemalloc"
  # This is used by the automation to produce single-target nightlies
  opt dist-host-only 0 "only install bins for the host architecture"
 -valopt prefix "/usr/local" "set installation prefix"
 -valopt local-rust-root "/usr/local" "set prefix for local rust binary"
 -valopt llvm-root "" "set LLVM root"
 -valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
 -valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
 -valopt mingw32-cross-path "" "MinGW32 cross compiler path"
 -
 -valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
 -valopt host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
 -valopt target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
 +opt inject-std-version 1 "inject the current compiler version of libstd into programs"
 +opt jemalloc 1 "build liballoc with jemalloc"
  
  valopt localstatedir "/var/lib" "local state directory"
  valopt sysconfdir "/etc" "install system configuration files"
  
  valopt datadir "${CFG_PREFIX}/share" "install data"
  valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
 -valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
 +valopt llvm-root "" "set LLVM root"
 +valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
 +valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
 +valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
 +valopt mingw32-cross-path "" "MinGW32 cross compiler path"
 +
 +# Many of these are saved below during the "writing configuration" step
 +# (others are conditionally saved).
 +opt_nosave manage-submodules 1 "let the build manage the git submodules"
 +opt_nosave clang 0 "prefer clang to gcc for building the runtime"
  
 -valopt release-channel "dev" "the name of the release channel to build"
 +valopt_nosave prefix "/usr/local" "set installation prefix"
 +valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
 +valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
 +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 release-channel "dev" "the name of the release channel to build"
  
  # On windows we just store the libraries in the bin directory because
  # there's no rpath. This is where the build system itself puts libraries;
@@@ -537,8 -491,8 +537,8 @@@ esa
  if [ ! -z "$CFG_ENABLE_NIGHTLY" ]
  then
      CFG_RELEASE_CHANNEL=nightly
 -    putvar CFG_RELEASE_CHANNEL
  fi
 +putvar CFG_RELEASE_CHANNEL
  
  step_msg "looking for build programs"
  
@@@ -651,20 -605,9 +651,20 @@@ the
          err "no local rust to use"
      fi
  
 -    LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version`
 +    CMD="${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF}"
 +    LRV=`$CMD --version`
 +    if [ $? -ne 0 ]
 +    then
 +        step_msg "failure while running $CMD --version"
 +        exit 1
 +    fi
      step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
      putvar CFG_LOCAL_RUST_ROOT
 +else
 +    if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
 +    then
 +       warn "Use of --local-rust-root without --enable-local-rust"
 +    fi
  fi
  
  # Force freebsd to build with clang; gcc doesn't like us there
@@@ -672,6 -615,7 +672,6 @@@ if [ $CFG_OSTYPE = unknown-freebsd 
  then
      step_msg "on FreeBSD, forcing use of clang"
      CFG_ENABLE_CLANG=1
 -    putvar CFG_ENABLE_CLANG
  fi
  
  if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
@@@ -688,10 -632,12 +688,10 @@@ the
      then
          step_msg "on OS X 10.9, forcing use of clang"
          CFG_ENABLE_CLANG=1
 -        putvar CFG_ENABLE_CLANG
      else
          if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
              step_msg "older GCC found, using clang instead"
              CFG_ENABLE_CLANG=1
 -            putvar CFG_ENABLE_CLANG
          else
              # on OS X, with xcode 5 and newer, certain developers may have
              # cc, gcc and g++ point to a  mixture of clang and gcc
      fi
  fi
  
 +# Okay, at this point, we have made up our minds about whether we are
 +# going to force CFG_ENABLE_CLANG or not; save the setting if so.
 +if [ ! -z "$CFG_ENABLE_CLANG" ]
 +then
 +    putvar CFG_ENABLE_CLANG
 +fi
 +
  if [ ! -z "$CFG_LLVM_ROOT" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
  then
      step_msg "using custom LLVM at $CFG_LLVM_ROOT"
@@@ -842,7 -781,7 +842,7 @@@ CFG_PREFIX=${CFG_PREFIX%/
  CFG_MANDIR=${CFG_MANDIR%/}
  CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
  CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
- CFG_SUPPORTED_TARGET="$(grep ^CC_*=* ${CFG_SRC_DIR}mk/platform.mk | sed -e 's/^CC_//' -e 's/\([^=]*\).*/\1/' | xargs)"
+ CFG_SUPPORTED_TARGET="$(ls ${CFG_SRC_DIR}mk/cfg)"
  
  # copy host-triples to target-triples so that hosts are a subset of targets
  V_TEMP=""
@@@ -989,7 -928,6 +989,7 @@@ d
      make_dir $h/test/doc-guide-container
      make_dir $h/test/doc-guide-tasks
      make_dir $h/test/doc-guide-plugin
 +    make_dir $h/test/doc-guide-crates
      make_dir $h/test/doc-rust
  done
  
@@@ -1265,11 -1203,18 +1265,11 @@@ putvar CFG_OSTYP
  putvar CFG_CPUTYPE
  putvar CFG_CONFIGURE_ARGS
  putvar CFG_PREFIX
 -putvar CFG_BUILD
  putvar CFG_HOST
  putvar CFG_TARGET
 -putvar CFG_LIBDIR
  putvar CFG_LIBDIR_RELATIVE
  putvar CFG_DISABLE_MANAGE_SUBMODULES
 -putvar CFG_ANDROID_CROSS_PATH
 -putvar CFG_MINGW32_CROSS_PATH
  putvar CFG_MANDIR
 -putvar CFG_DISABLE_INJECT_STD_VERSION
 -putvar CFG_JEMALLOC_ROOT
 -putvar CFG_DISABLE_JEMALLOC
  
  # Avoid spurious warnings from clang by feeding it original source on
  # ccache-miss rather than preprocessed input.
@@@ -1292,6 -1237,7 +1292,6 @@@ the
      putvar CFG_PANDOC
  fi
  
 -putvar CFG_LLVM_ROOT
  putvar CFG_LLVM_SRC_DIR
  
  for t in $CFG_HOST