Delete swaths of the configure script

This commit deletes swaths of the configure script related to the old build
system which are now no longer needed when using rustbuild.
This commit is contained in:
Alex Crichton 2017-01-23 15:47:43 -08:00
parent 9ab8090bd4
commit 9b0e6af110

858
configure vendored
View File

@ -993,191 +993,12 @@ then
putvar CFG_LOCAL_RUST_ROOT
fi
# Force bitrig to build with clang; gcc doesn't like us there
if [ $CFG_OSTYPE = unknown-bitrig ]
then
step_msg "on Bitrig, forcing use of clang"
CFG_ENABLE_CLANG=1
fi
# default gcc version under OpenBSD maybe too old, try using egcc, which is a
# gcc version from ports
if [ $CFG_OSTYPE = unknown-openbsd ]
then
if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
step_msg "older GCC found, try with egcc instead"
# probe again but using egcc
probe CFG_GCC egcc
# and use egcc/eg++ for CC/CXX too if it was found
# (but user setting has priority)
if [ -n "$CFG_GCC" ]; then
CC="${CC:-egcc}"
CXX="${CXX:-eg++}"
fi
fi
fi
# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
# system, so if we find that gcc is clang, we should just use clang directly.
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
then
CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
if [ $? -eq 0 ]
then
step_msg "on OS X >=10.9, forcing use of clang"
CFG_ENABLE_CLANG=1
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
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
# if so, this will create very strange build errors
# this last stanza is to detect some such problems and save the future rust
# contributor some time solving that issue.
# this detection could be generalized to other OSes aside from OS X
# but the issue seems most likely to happen on OS X
chk_cc () {
$1 --version 2> /dev/null | grep -q $2
}
# check that gcc, cc and g++ all point to the same compiler.
# note that for xcode 5, g++ points to clang, not clang++
if !((chk_cc gcc clang && chk_cc g++ clang) ||
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))); then
err "the gcc and g++ in your path point to different compilers.
Check which versions are in your path with gcc --version and g++ --version.
To resolve this problem, either fix your PATH or run configure with --enable-clang"
fi
fi
fi
fi
# If the clang isn't already enabled, check for GCC, and if it is missing, turn
# on clang as a backup.
if [ -z "$CFG_ENABLE_CLANG" ]
then
CFG_GCC_VERSION=$("$CFG_GCC" --version 2>&1)
if [ $? -ne 0 ]
then
step_msg "GCC not installed, will try using Clang"
CFG_ENABLE_CLANG=1
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 [ -n "$CFG_ENABLE_CLANG" ]
then
putvar CFG_ENABLE_CLANG
fi
if [ -z "$CFG_DISABLE_LIBCPP" -a -n "$CFG_ENABLE_CLANG" ]
then
CFG_USING_LIBCPP="1"
else
CFG_USING_LIBCPP="0"
fi
# Same with jemalloc. save the setting here.
if [ -n "$CFG_DISABLE_JEMALLOC" ]
then
putvar CFG_DISABLE_JEMALLOC
fi
if [ -n "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
then
step_msg "using custom LLVM at $CFG_LLVM_ROOT"
LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config"
LLVM_VERSION=$($LLVM_CONFIG --version)
case $LLVM_VERSION in
(3.[7-9]*)
msg "found ok version of LLVM: $LLVM_VERSION"
;;
(*)
err "bad LLVM version: $LLVM_VERSION, need >=3.7"
;;
esac
if "$CFG_LLVM_ROOT/bin/llvm-mc" -help | grep -- "-relocation-model"; then
msg "found older llvm-mc"
CFG_LLVM_MC_HAS_RELOCATION_MODEL=1
putvar CFG_LLVM_MC_HAS_RELOCATION_MODEL
fi
fi
# Even when the user overrides the choice of CC, still try to detect
# clang to disable some clang-specific warnings. We here draw a
# distinction between:
#
# CFG_ENABLE_CLANG : passed --enable-clang, or host "requires" clang,
# CFG_USING_CLANG : compiler (clang / gcc / $CC) looks like clang.
#
# This distinction is important because there are some safeguards we
# would prefer to skip when merely CFG_USING_CLANG is set; but when
# CFG_ENABLE_CLANG is set, that indicates that we are opting into
# running such safeguards.
if [ -n "$CC" ]
then
msg "skipping compiler inference steps; using provided CC=$CC"
CFG_CC="$CC"
CFG_OSX_CC_VERSION=$("$CFG_CC" --version 2>&1 | grep "clang")
if [ $? -eq 0 ]
then
step_msg "note, user-provided CC looks like clang; CC=$CC."
CFG_USING_CLANG=1
putvar CFG_USING_CLANG
fi
else
if [ -n "$CFG_ENABLE_CLANG" ]
then
if [ -z "$CFG_CLANG" ]
then
err "clang requested but not found"
fi
CFG_CC="$CFG_CLANG"
CFG_USING_CLANG=1
putvar CFG_USING_CLANG
else
CFG_CC="gcc"
fi
fi
if [ -n "$CFG_ENABLE_CLANG" ]
then
case "$CC" in
(''|*clang)
if [ -z "$CC" ]
then
CFG_CC="clang"
CFG_CXX="clang++"
fi
esac
fi
if [ -n "$CFG_ENABLE_CCACHE" ]
then
if [ -z "$CFG_CCACHE" ]
then
err "ccache requested but not found"
fi
CFG_CC="ccache $CFG_CC"
fi
if [ -z "$CC" -a -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
then
err "either clang or gcc is required"
fi
# All safeguards based on $CFG_ENABLE_CLANG should occur before this
# point in the script; after this point, script logic should inspect
# $CFG_USING_CLANG rather than $CFG_ENABLE_CLANG.
@ -1190,12 +1011,6 @@ envopt CFLAGS
envopt CXXFLAGS
envopt LDFLAGS
# stdc++ name in use
# used to manage non-standard name (on OpenBSD for example)
program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")
CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}")
putvar CFG_STDCPP_NAME
# a little post-processing of various config values
CFG_PREFIX=${CFG_PREFIX%/}
CFG_MANDIR=${CFG_MANDIR%/}
@ -1223,651 +1038,6 @@ do
done
CFG_TARGET=$V_TEMP
# check target-specific tool-chains
for i in $CFG_TARGET
do
L_CHECK=false
for j in $CFG_SUPPORTED_TARGET
do
if [ $i = $j ]
then
L_CHECK=true
fi
done
if [ $L_CHECK = false ]
then
err "unsupported target triples \"$i\" found"
fi
case $i in
*android*)
case $i in
armv7-linux-androideabi)
cmd_prefix="arm-linux-androideabi"
;;
*)
cmd_prefix=$i
;;
esac
upper_snake_target=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
eval ndk=\$"CFG_${upper_snake_target}_NDK"
if [ -z "$ndk" ]
then
ndk=$CFG_ANDROID_CROSS_PATH
eval "CFG_${upper_snake_target}_NDK"=$CFG_ANDROID_CROSS_PATH
warn "generic/default Android NDK option is deprecated (use --$i-ndk option instead)"
fi
# Perform a basic sanity check of the NDK
for android_ndk_tool in "$ndk/bin/$cmd_prefix-gcc" "$ndk/bin/$cmd_prefix-g++" "$ndk/bin/$cmd_prefix-ar"
do
if [ ! -f $android_ndk_tool ]
then
err "NDK tool $android_ndk_tool not found (bad or missing --$i-ndk option?)"
fi
done
;;
*-unknown-nacl)
if [ -z "$CFG_NACL_CROSS_PATH" ]
then
err "I need the NaCl SDK path! (use --nacl-cross-path)"
fi
;;
arm-apple-darwin)
if [ $CFG_OSTYPE != apple-darwin ]
then
err "The iOS target is only supported on Mac OS X"
fi
;;
*-msvc)
# 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.
if ! "$CFG_CMAKE" --help | sed -n '/^Generators/,$p' | grep 'Visual Studio' > /dev/null
then
err "
cmake does not support Visual Studio generators.
This is likely due to it being an msys/cygwin build of cmake, \
rather than the required windows version, built using MinGW \
or Visual Studio.
If you are building under msys2 try installing the mingw-w64-x86_64-cmake \
package instead of cmake:
$ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
"
fi
# Use the REG program to figure out where VS is installed
# We need to figure out where cl.exe and link.exe are, so we do some
# munging and some probing here. We also look for the default
# INCLUDE and LIB variables for MSVC so we can set those in the
# build system as well.
install=$(cmd //c reg QUERY \
'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \
-v InstallDir)
if [ -z "$install" ]; then
install=$(cmd //c reg QUERY \
'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
-v InstallDir)
fi
need_ok "couldn't find visual studio install root"
CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
putvar CFG_MSVC_ROOT
case $i in
x86_64-*)
bits=x86_64
msvc_part=amd64
;;
i*86-*)
bits=i386
msvc_part=
;;
*)
err "can only target x86 targets for MSVC"
;;
esac
bindir="${CFG_MSVC_ROOT}/VC/bin"
if [ -n "$msvc_part" ]; then
bindir="$bindir/$msvc_part"
fi
eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\""
eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\""
eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""
vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
include_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !INCLUDE!)
need_ok "failed to learn about MSVC's INCLUDE"
lib_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !LIB!)
need_ok "failed to learn about MSVC's LIB"
eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""
eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\""
putvar CFG_MSVC_BINDIR_${bits}
putvar CFG_MSVC_CL_${bits}
putvar CFG_MSVC_LIB_${bits}
putvar CFG_MSVC_LINK_${bits}
putvar CFG_MSVC_INCLUDE_PATH_${bits}
putvar CFG_MSVC_LIB_PATH_${bits}
;;
*)
;;
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'`
if [ -z "$HAVE_PERF_LOGFD" ];
then
CFG_PERF_WITH_LOGFD=1
putvar CFG_PERF_WITH_LOGFD
fi
fi
if [ -n "$CFG_DISABLE_RUSTBUILD" ]; then
step_msg "making directories"
for i in \
doc doc/std doc/extra \
dl tmp dist
do
make_dir $i
done
for t in $CFG_HOST
do
make_dir $t/llvm
done
for t in $CFG_HOST
do
make_dir $t/rustllvm
done
for t in $CFG_TARGET
do
make_dir $t/rt
for s in 0 1 2 3
do
make_dir $t/rt/stage$s
make_dir $t/rt/jemalloc
make_dir $t/rt/compiler-rt
for i in \
isaac sync test \
arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips arch/powerpc
do
make_dir $t/rt/stage$s/$i
done
done
done
for h in $CFG_HOST
do
for t in $CFG_TARGET
do
# host bin dir stage0
make_dir $h/stage0/bin
# host lib dir stage0
make_dir $h/stage0/lib
# host test dir stage0
make_dir $h/stage0/test
# target bin dir stage0
make_dir $h/stage0/lib/rustlib/$t/bin
# target lib dir stage0
make_dir $h/stage0/lib/rustlib/$t/lib
for i in 1 2 3
do
# host bin dir
make_dir $h/stage$i/bin
# host lib dir
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE
# host test dir
make_dir $h/stage$i/test
# target bin dir
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin
# target lib dir
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib
done
done
make_dir $h/test/run-pass
make_dir $h/test/run-pass-valgrind
make_dir $h/test/run-pass-fulldeps
make_dir $h/test/run-fail
make_dir $h/test/run-fail-fulldeps
make_dir $h/test/compile-fail
make_dir $h/test/parse-fail
make_dir $h/test/compile-fail-fulldeps
make_dir $h/test/bench
make_dir $h/test/perf
make_dir $h/test/pretty
make_dir $h/test/debuginfo-gdb
make_dir $h/test/debuginfo-lldb
make_dir $h/test/codegen
make_dir $h/test/codegen-units
make_dir $h/test/rustdoc
done
fi
# Configure submodules
step_msg "configuring submodules"
# Have to be in the top of src directory for this
if [ -z "$CFG_DISABLE_MANAGE_SUBMODULES" ] && [ -n "$CFG_DISABLE_RUSTBUILD" ]
then
cd ${CFG_SRC_DIR}
msg "git: submodule sync"
"${CFG_GIT}" submodule sync
msg "git: submodule init"
"${CFG_GIT}" submodule init
# Disable submodules that we're not using
if [ -n "${CFG_LLVM_ROOT}" ]; then
msg "git: submodule deinit src/llvm"
"${CFG_GIT}" submodule deinit src/llvm
fi
if [ -n "${CFG_JEMALLOC_ROOT}" ]; then
msg "git: submodule deinit src/jemalloc"
"${CFG_GIT}" submodule deinit src/jemalloc
fi
msg "git: submodule update"
"${CFG_GIT}" submodule update
need_ok "git failed"
msg "git: submodule foreach sync"
"${CFG_GIT}" submodule foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi'
need_ok "git failed"
msg "git: submodule foreach update"
"${CFG_GIT}" submodule update --recursive
need_ok "git failed"
# NB: this is just for the sake of getting the submodule SHA1 values
# and status written into the build log.
msg "git: submodule status"
"${CFG_GIT}" submodule status --recursive
msg "git: submodule clobber"
"${CFG_GIT}" submodule foreach --recursive git clean -dxf
need_ok "git failed"
"${CFG_GIT}" submodule foreach --recursive git checkout .
need_ok "git failed"
cd ${CFG_BUILD_DIR}
fi
# Do a sanity check that the submodule source exists. Because GitHub
# automatically publishes broken tarballs that can't be disabled, and
# people download them and try to use them.
if [ ! -e "${CFG_SRC_DIR}/src/liblibc" ]; then
err "some submodules are missing. Is this a broken tarball?
If you downloaded this tarball from the GitHub release pages at
https://github.com/rust-lang/rust/releases,
then please delete it and instead download the source from
https://www.rust-lang.org/downloads.html"
fi
# Configure llvm, only if necessary
step_msg "looking at LLVM"
CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
for t in $CFG_HOST
do
do_reconfigure=1
is_msvc=0
case "$t" in
(*-msvc)
is_msvc=1
;;
esac
if [ -z "$CFG_DISABLE_RUSTBUILD" ]
then
msg "not configuring LLVM, rustbuild in use"
do_reconfigure=0
elif [ -z "$CFG_LLVM_ROOT" ]
then
LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
LLVM_INST_DIR=$LLVM_BUILD_DIR
# For some weird reason the MSVC output dir is different than Unix
if [ ${is_msvc} -ne 0 ]; then
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]
then
# Just use LLVM straight from its build directory to
# avoid 'make install' time
LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug
else
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
fi
fi
else
msg "not reconfiguring LLVM, external LLVM root"
# The user is using their own LLVM
LLVM_BUILD_DIR=
LLVM_INST_DIR=$CFG_LLVM_ROOT
do_reconfigure=0
# Check that LLVm FileCheck is available. Needed for the tests
if [ -z "$CFG_DISABLE_CODEGEN_TESTS" ]; then
need_cmd $LLVM_INST_DIR/bin/FileCheck
fi
fi
if [ ${do_reconfigure} -ne 0 ]
then
# because git is hilarious, it might have put the module index
# in a couple places.
index1="${CFG_SRC_DIR}.git/modules/src/llvm/index"
index2="${CFG_SRC_DIR}src/llvm/.git/index"
for index in ${index1} ${index2}
do
config_status="${LLVM_BUILD_DIR}/config.status"
if test -e ${index} -a \
-e ${config_status} -a \
${config_status} -nt ${index}
then
msg "not reconfiguring LLVM, config.status is fresh"
do_reconfigure=0
fi
done
fi
# We need the generator later on for compiler-rt even if LLVM's not built
if [ -n "$CFG_NINJA" ]
then
generator="Ninja"
elif [ ${is_msvc} -ne 0 ]
then
case "$CFG_MSVC_ROOT" in
*14.0*)
generator="Visual Studio 14 2015"
;;
*12.0*)
generator="Visual Studio 12 2013"
;;
*)
err "can't determine generator for LLVM cmake"
;;
esac
case "$t" in
x86_64-*)
generator="$generator Win64"
;;
i686-*)
;;
*)
err "can only build LLVM for x86 platforms"
;;
esac
else
generator="Unix Makefiles"
fi
CFG_CMAKE_GENERATOR=$generator
putvar CFG_CMAKE_GENERATOR
msg "configuring LLVM for $t"
LLVM_CFLAGS_32=""
LLVM_CXXFLAGS_32=""
LLVM_LDFLAGS_32=""
LLVM_CFLAGS_64=""
LLVM_CXXFLAGS_64=""
LLVM_LDFLAGS_64=""
case "$CFG_CC" in
("ccache clang")
LLVM_CXX_32="ccache"
LLVM_CC_32="ccache"
LLVM_CXX_32_ARG1="clang++"
LLVM_CC_32_ARG1="clang"
LLVM_CFLAGS_32="-Qunused-arguments"
LLVM_CXXFLAGS_32="-Qunused-arguments"
LLVM_CXX_64="ccache"
LLVM_CC_64="ccache"
LLVM_CXX_64_ARG1="clang++"
LLVM_CC_64_ARG1="clang"
LLVM_CFLAGS_64="-Qunused-arguments"
LLVM_CXXFLAGS_64="-Qunused-arguments"
;;
("clang")
LLVM_CXX_32="clang++"
LLVM_CC_32="clang"
LLVM_CFLAGS_32="-Qunused-arguments"
LLVM_CXXFLAGS_32="-Qunused-arguments"
LLVM_CXX_64="clang++"
LLVM_CC_64="clang"
LLVM_CFLAGS_64="-Qunused-arguments"
LLVM_CXXFLAGS_64="-Qunused-arguments"
;;
("ccache gcc")
LLVM_CXX_32="ccache"
LLVM_CC_32="ccache"
LLVM_CXX_32_ARG1="g++"
LLVM_CC_32_ARG1="gcc"
LLVM_CXX_64="ccache"
LLVM_CC_64="ccache"
LLVM_CXX_64_ARG1="g++"
LLVM_CC_64_ARG1="gcc"
;;
("gcc")
if [ -z "$CFG_ENABLE_SCCACHE" ]; then
LLVM_CXX_32="g++"
LLVM_CC_32="gcc"
LLVM_CXX_64="g++"
LLVM_CC_64="gcc"
else
LLVM_CXX_32="sccache"
LLVM_CC_32="sccache"
LLVM_CXX_32_ARG1="g++"
LLVM_CC_32_ARG1="gcc"
LLVM_CXX_64="sccache"
LLVM_CC_64="sccache"
LLVM_CXX_64_ARG1="g++"
LLVM_CC_64_ARG1="gcc"
fi
;;
(*)
msg "inferring LLVM_CXX/CC from CXX/CC = $CXX/$CC"
if [ -n "$CFG_ENABLE_CCACHE" ]
then
if [ -z "$CFG_CCACHE" ]
then
err "ccache requested but not found"
fi
LLVM_CXX_32="ccache"
LLVM_CC_32="ccache"
LLVM_CXX_32_ARG1="$CXX"
LLVM_CC_32_ARG1="$CC"
LLVM_CXX_64="ccache"
LLVM_CC_64="ccache"
LLVM_CXX_64_ARG1="$CXX"
LLVM_CC_64_ARG1="$CC"
else
LLVM_CXX_32="$CXX"
LLVM_CC_32="$CC"
LLVM_CXX_64="$CXX"
LLVM_CC_64="$CC"
fi
;;
esac
case "$CFG_CPUTYPE" in
(x86*)
LLVM_CFLAGS_32="$LLVM_CFLAGS_32 -m32"
LLVM_CXXFLAGS_32="$LLVM_CXXFLAGS_32 -m32"
LLVM_LDFLAGS_32="$LLVM_LDFLAGS_32 -m32"
;;
esac
if echo $t | grep -q x86_64
then
LLVM_CXX=$LLVM_CXX_64
LLVM_CC=$LLVM_CC_64
LLVM_CXX_ARG1=$LLVM_CXX_64_ARG1
LLVM_CC_ARG1=$LLVM_CC_64_ARG1
LLVM_CFLAGS=$LLVM_CFLAGS_64
LLVM_CXXFLAGS=$LLVM_CXXFLAGS_64
LLVM_LDFLAGS=$LLVM_LDFLAGS_64
else
LLVM_CXX=$LLVM_CXX_32
LLVM_CC=$LLVM_CC_32
LLVM_CXX_ARG1=$LLVM_CXX_32_ARG1
LLVM_CC_ARG1=$LLVM_CC_32_ARG1
LLVM_CFLAGS=$LLVM_CFLAGS_32
LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32
LLVM_LDFLAGS=$LLVM_LDFLAGS_32
fi
if [ "$CFG_USING_LIBCPP" != "0" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBCXX=ON"
fi
# Turn off things we don't need
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_TESTS=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_EXAMPLES=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_DOCS=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ZLIB=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DWITH_POLY=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_TERMINFO=OFF"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBEDIT=OFF"
arch="$(echo "$t" | cut -d - -f 1)"
if [ "$arch" = i686 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_BUILD_32_BITS=ON"
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=$CFG_BUILD_DIR/$CFG_BUILD/llvm/bin/llvm-tblgen"
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=$t"
fi
# MSVC handles compiler business itself
if [ ${is_msvc} -eq 0 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$LLVM_CC"
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$LLVM_CXX"
CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_C_FLAGS=$LLVM_CFLAGS'"
CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_CXX_FLAGS=$LLVM_CXXFLAGS'"
if [ -n "$LLVM_CC_ARG1" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER_ARG1=$LLVM_CC_ARG1"
fi
if [ -n "$LLVM_CXX_ARG1" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=$LLVM_CXX_ARG1"
fi
# FIXME: What about LDFLAGS?
fi
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
elif [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=RelWithDebInfo"
else
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
fi
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
then
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
else
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
fi
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc'"
CMAKE_ARGS="$CMAKE_ARGS -G '$CFG_CMAKE_GENERATOR'"
CMAKE_ARGS="$CMAKE_ARGS $CFG_LLVM_SRC_DIR"
if [ ${do_reconfigure} -ne 0 ]
then
msg "configuring LLVM for $t with cmake"
msg "configuring LLVM with:"
msg "$CMAKE_ARGS"
(cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
need_ok "LLVM cmake configure failed"
fi
# Construct variables for LLVM build and install directories for
# each target. These will be named
# CFG_LLVM_BUILD_DIR_${target_triple} but all the hyphens in
# target_triple will be converted to underscore, because bash
# variables can't contain hyphens. The makefile will then have to
# convert back.
CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)
eval ${CFG_LLVM_BUILD_DIR}="'$LLVM_BUILD_DIR'"
eval ${CFG_LLVM_INST_DIR}="'$LLVM_INST_DIR'"
done
step_msg "writing configuration"
putvar CFG_SRC_DIR
@ -1915,15 +1085,8 @@ do
putvar $CFG_LLVM_INST_DIR
done
if [ -z "$CFG_DISABLE_RUSTBUILD" ]
then
INPUT_MAKEFILE=src/bootstrap/mk/Makefile.in
else
INPUT_MAKEFILE=Makefile.in
fi
msg
copy_if_changed ${CFG_SRC_DIR}${INPUT_MAKEFILE} ./Makefile
copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile
move_if_changed config.tmp config.mk
rm -f config.tmp
touch config.stamp
@ -1940,22 +1103,5 @@ else
X_PY=${CFG_SRC_DIR_RELATIVE}x.py
fi
if [ -z "$CFG_DISABLE_RUSTBUILD" ]; then
msg "NOTE you have now configured rust to use a rewritten build system"
msg " called rustbuild, and as a result this may have bugs that "
msg " you did not see before. If you experience any issues you can"
msg " go back to the old build system with --disable-rustbuild and"
msg " please feel free to report any bugs!"
msg ""
msg "run \`python ${X_PY} --help\`"
else
warn "the makefile-based build system is deprecated in favor of rustbuild"
msg ""
msg "It is recommended you avoid passing --disable-rustbuild to get your"
msg "build working as the makefiles will be deleted on 2017-02-02. If you"
msg "encounter bugs with rustbuild please file issues against rust-lang/rust"
msg ""
msg "run \`make help\`"
fi
msg "run \`python ${X_PY} --help\`"
msg