mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use the in-tree Rust compiler
This commit is contained in:
parent
8db859b7d2
commit
5e40aa6aa3
4 changed files with 80 additions and 27 deletions
77
configure
vendored
77
configure
vendored
|
@ -199,28 +199,65 @@ need_cmd sed
|
|||
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=linux
|
||||
CFG_OSTYPE=unknown-linux-gnu
|
||||
;;
|
||||
|
||||
FreeBSD)
|
||||
CFG_OSTYPE=freebsd
|
||||
CFG_OSTYPE=unknown-freebsd
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
CFG_OSTYPE=darwin
|
||||
CFG_OSTYPE=apple-darwin
|
||||
;;
|
||||
|
||||
MINGW32*)
|
||||
CFG_OSTYPE=mingw32
|
||||
CFG_OSTYPE=pc-mingw32
|
||||
;;
|
||||
|
||||
*)
|
||||
err "unknown OS type: $CFG_OSTYPE"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
case $CFG_CPUTYPE in
|
||||
|
||||
i386 | i486 | i686 | i786 | x86)
|
||||
CFG_CPUTYPE=i686
|
||||
;;
|
||||
|
||||
xscale | arm)
|
||||
CFG_CPUTYPE=arm
|
||||
;;
|
||||
|
||||
x86_64 | x86-64 | x64 | amd64)
|
||||
CFG_CPUTYPE=x86_64
|
||||
;;
|
||||
|
||||
*)
|
||||
err "unknown CPU type: $CFG_CPUTYPE"
|
||||
esac
|
||||
|
||||
DEFAULT_HOST_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"
|
||||
|
||||
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
|
||||
CFG_BUILD_DIR="$(pwd)/"
|
||||
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
|
||||
|
@ -271,7 +308,9 @@ if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
|
|||
then
|
||||
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
|
||||
then
|
||||
err "no local rust to use"
|
||||
msg "using in-tree rust compiler"
|
||||
# The Rust compiler we're going to build
|
||||
CFG_RUSTC="${CFG_BUILD_DIR}src/rust/${DEFAULT_HOST_TRIPLE}/stage2/bin/rustc"
|
||||
else
|
||||
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
||||
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
|
||||
|
@ -346,12 +385,12 @@ step_msg "running submodule autoconf scripts"
|
|||
|
||||
CFG_SUBMODULES="libwapcaplet rust-wapcaplet rust-harfbuzz rust-opengles skia rust-azure rust-cairo rust-stb-image rust-geom rust-glut rust-layers rust-http-client libparserutils libhubbub libcss rust-netsurfcss rust-css rust-hubbub sharegl rust-mozjs mozjs"
|
||||
|
||||
if [ $CFG_OSTYPE = "darwin" ]
|
||||
if [ $CFG_OSTYPE = "apple-darwin" ]
|
||||
then
|
||||
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
if [ $CFG_OSTYPE = "linux" ]
|
||||
if [ $CFG_OSTYPE = "unknown-linux-gnu" ]
|
||||
then
|
||||
CFG_SUBMODULES="rust-freetype rust-fontconfig rust-xlib ${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
@ -367,11 +406,33 @@ done
|
|||
|
||||
make_dir ${CFG_BUILD_DIR}src/servo-gfx
|
||||
make_dir src/test/ref
|
||||
make_dir src/rust
|
||||
|
||||
# TODO: don't run configure on submodules unless necessary. For an example,
|
||||
# see how Rust's configure script optionally reconfigures the LLVM module.
|
||||
step_msg "running submodule configure scripts"
|
||||
|
||||
# Only reconfigure Rust when it changes
|
||||
do_reconfigure=1
|
||||
index1="${CFG_SRC_DIR}.git/modules/src/rust/index"
|
||||
index2="${CFG_SRC_DIR}src/rust/.git/index"
|
||||
for index in ${index1} ${index2}
|
||||
do
|
||||
config_stamp="${CFG_BUILD_DIR}src/rust/config.stamp"
|
||||
if test -e ${index} -a -e ${config_stamp} -a ${config_stamp} -nt ${index}
|
||||
then
|
||||
msg "not reconfiguring Rust, config.stamp is fresh"
|
||||
do_reconfigure=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${do_reconfigure} -ne 0 ]
|
||||
then
|
||||
cd ${CFG_BUILD_DIR}src/rust
|
||||
${CFG_SRC_DIR}src/rust/configure
|
||||
cd ${CFG_BUILD_DIR}
|
||||
fi
|
||||
|
||||
for i in ${CFG_SUBMODULES}
|
||||
do
|
||||
if [ -d ${CFG_BUILD_DIR}src/${i} ]
|
||||
|
@ -398,6 +459,8 @@ done
|
|||
|
||||
step_msg "writing configuration"
|
||||
|
||||
putvar DEFAULT_HOST_TRIPLE
|
||||
putvar CFG_CPUTYPE
|
||||
putvar CFG_OSTYPE
|
||||
putvar CFG_SRC_DIR
|
||||
putvar CFG_BUILD_DIR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue