mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +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
|
@ -46,7 +46,6 @@ else
|
||||||
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
|
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
export CFG_RUSTC
|
export CFG_RUSTC
|
||||||
export CFG_RUSTC_FLAGS
|
export CFG_RUSTC_FLAGS
|
||||||
export RUSTC=$(CFG_RUSTC)
|
export RUSTC=$(CFG_RUSTC)
|
||||||
|
@ -75,6 +74,9 @@ $(S)config.stamp : $(S)configure $(S)Makefile.in
|
||||||
@$(call E, cfg: reconfiguring)
|
@$(call E, cfg: reconfiguring)
|
||||||
$(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
|
$(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
|
||||||
|
|
||||||
|
# Build the compiler
|
||||||
|
$(CFG_RUSTC):
|
||||||
|
$(MAKE) -C "$(CFG_BUILD_DIR)src/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS=""
|
||||||
|
|
||||||
define DEF_SUBMODULE_VARS
|
define DEF_SUBMODULE_VARS
|
||||||
DEPS_$(1) =
|
DEPS_$(1) =
|
||||||
|
@ -109,7 +111,7 @@ ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$(1),*h *c *cpp *rs *rc)
|
||||||
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
|
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
|
||||||
# the main target for a submodule
|
# the main target for a submodule
|
||||||
# --
|
# --
|
||||||
$$(DONE_$(1)) : $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1))
|
$$(DONE_$(1)) : $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1)) $$(CFG_RUSTC)
|
||||||
# @$$(call E, make: $(1))
|
# @$$(call E, make: $(1))
|
||||||
# @$$(call E, $(1) deps= $$(DEPS_$(1)))
|
# @$$(call E, $(1) deps= $$(DEPS_$(1)))
|
||||||
# @$$(call E, $(1) done_deps= $$(DONE_DEPS_$(1)))
|
# @$$(call E, $(1) done_deps= $$(DONE_DEPS_$(1)))
|
||||||
|
@ -165,7 +167,7 @@ servo: $(DEPS_servo)
|
||||||
|
|
||||||
# Darwin app packaging
|
# Darwin app packaging
|
||||||
|
|
||||||
ifeq ($(OSTYPE),darwin)
|
ifeq ($(OSTYPE),apple-darwin)
|
||||||
|
|
||||||
package: servo
|
package: servo
|
||||||
mkdir -p Servo.app/Contents/MacOS/src/rust-cocoa
|
mkdir -p Servo.app/Contents/MacOS/src/rust-cocoa
|
||||||
|
|
18
README.md
18
README.md
|
@ -3,20 +3,8 @@
|
||||||
Servo is a prototype web browser engine written in the [Rust]
|
Servo is a prototype web browser engine written in the [Rust]
|
||||||
language. It is currently developed on OS X and Linux.
|
language. It is currently developed on OS X and Linux.
|
||||||
|
|
||||||
**Note:** Servo always requires a specific version of Rust - building
|
|
||||||
against a released version of Rust will not work, nor will the Rust
|
|
||||||
'master' branch. The commit below will *probably* work. If it does not
|
|
||||||
then the topic in #servo might know better.
|
|
||||||
|
|
||||||
* Last known-good Rust commit: 3ee1d3ebb81de199fc630a86933ac18c0a869482
|
|
||||||
|
|
||||||
[rust]: http://www.rust-lang.org
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
First, you need the Rust compiler, built from the exact commit listed
|
|
||||||
above.
|
|
||||||
|
|
||||||
On OS X (homebrew):
|
On OS X (homebrew):
|
||||||
|
|
||||||
brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb
|
brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb
|
||||||
|
@ -30,6 +18,9 @@ On Debian-based Linuxes:
|
||||||
|
|
||||||
sudo apt-get install libcairo2-dev libpango1.0-dev autoconf2.13 freeglut3-dev
|
sudo apt-get install libcairo2-dev libpango1.0-dev autoconf2.13 freeglut3-dev
|
||||||
|
|
||||||
|
Servo builds its own copy of Rust, so there is no need to provide a Rust
|
||||||
|
compiler.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
git clone git://github.com/mozilla/servo.git
|
git clone git://github.com/mozilla/servo.git
|
||||||
|
@ -39,9 +30,6 @@ On Debian-based Linuxes:
|
||||||
make check-servo && make
|
make check-servo && make
|
||||||
./servo ../src/test/hello.html
|
./servo ../src/test/hello.html
|
||||||
|
|
||||||
If `rustc` is not installed then add `RUSTC=/path/to/rustc` to your
|
|
||||||
`make` commands.
|
|
||||||
|
|
||||||
|
|
||||||
## Build Workarounds
|
## Build Workarounds
|
||||||
|
|
||||||
|
|
77
configure
vendored
77
configure
vendored
|
@ -199,28 +199,65 @@ need_cmd sed
|
||||||
msg "inspecting environment"
|
msg "inspecting environment"
|
||||||
|
|
||||||
CFG_OSTYPE=$(uname -s)
|
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
|
case $CFG_OSTYPE in
|
||||||
|
|
||||||
Linux)
|
Linux)
|
||||||
CFG_OSTYPE=linux
|
CFG_OSTYPE=unknown-linux-gnu
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FreeBSD)
|
FreeBSD)
|
||||||
CFG_OSTYPE=freebsd
|
CFG_OSTYPE=unknown-freebsd
|
||||||
;;
|
;;
|
||||||
|
|
||||||
Darwin)
|
Darwin)
|
||||||
CFG_OSTYPE=darwin
|
CFG_OSTYPE=apple-darwin
|
||||||
;;
|
;;
|
||||||
|
|
||||||
MINGW32*)
|
MINGW32*)
|
||||||
CFG_OSTYPE=mingw32
|
CFG_OSTYPE=pc-mingw32
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
err "unknown OS type: $CFG_OSTYPE"
|
err "unknown OS type: $CFG_OSTYPE"
|
||||||
;;
|
;;
|
||||||
esac
|
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_SRC_DIR="$(cd $(dirname $0) && pwd)/"
|
||||||
CFG_BUILD_DIR="$(pwd)/"
|
CFG_BUILD_DIR="$(pwd)/"
|
||||||
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
|
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
|
||||||
|
@ -271,7 +308,9 @@ if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
|
||||||
then
|
then
|
||||||
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
|
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
|
||||||
then
|
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
|
else
|
||||||
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
||||||
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
|
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"
|
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
|
then
|
||||||
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $CFG_OSTYPE = "linux" ]
|
if [ $CFG_OSTYPE = "unknown-linux-gnu" ]
|
||||||
then
|
then
|
||||||
CFG_SUBMODULES="rust-freetype rust-fontconfig rust-xlib ${CFG_SUBMODULES}"
|
CFG_SUBMODULES="rust-freetype rust-fontconfig rust-xlib ${CFG_SUBMODULES}"
|
||||||
fi
|
fi
|
||||||
|
@ -367,11 +406,33 @@ done
|
||||||
|
|
||||||
make_dir ${CFG_BUILD_DIR}src/servo-gfx
|
make_dir ${CFG_BUILD_DIR}src/servo-gfx
|
||||||
make_dir src/test/ref
|
make_dir src/test/ref
|
||||||
|
make_dir src/rust
|
||||||
|
|
||||||
# TODO: don't run configure on submodules unless necessary. For an example,
|
# TODO: don't run configure on submodules unless necessary. For an example,
|
||||||
# see how Rust's configure script optionally reconfigures the LLVM module.
|
# see how Rust's configure script optionally reconfigures the LLVM module.
|
||||||
step_msg "running submodule configure scripts"
|
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}
|
for i in ${CFG_SUBMODULES}
|
||||||
do
|
do
|
||||||
if [ -d ${CFG_BUILD_DIR}src/${i} ]
|
if [ -d ${CFG_BUILD_DIR}src/${i} ]
|
||||||
|
@ -398,6 +459,8 @@ done
|
||||||
|
|
||||||
step_msg "writing configuration"
|
step_msg "writing configuration"
|
||||||
|
|
||||||
|
putvar DEFAULT_HOST_TRIPLE
|
||||||
|
putvar CFG_CPUTYPE
|
||||||
putvar CFG_OSTYPE
|
putvar CFG_OSTYPE
|
||||||
putvar CFG_SRC_DIR
|
putvar CFG_SRC_DIR
|
||||||
putvar CFG_BUILD_DIR
|
putvar CFG_BUILD_DIR
|
||||||
|
|
|
@ -82,7 +82,7 @@ DEPS_libcss += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Platform-specific dependencies
|
# Platform-specific dependencies
|
||||||
ifeq ($(CFG_OSTYPE),darwin)
|
ifeq ($(CFG_OSTYPE),apple-darwin)
|
||||||
DEPS_rust-azure += \
|
DEPS_rust-azure += \
|
||||||
rust-core-graphics \
|
rust-core-graphics \
|
||||||
rust-core-text \
|
rust-core-text \
|
||||||
|
@ -121,7 +121,7 @@ DEPS_rust-layers += \
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CFG_OSTYPE),linux)
|
ifeq ($(CFG_OSTYPE),unknown-linux-gnu)
|
||||||
|
|
||||||
DEPS_rust-cairo += \
|
DEPS_rust-cairo += \
|
||||||
rust-freetype \
|
rust-freetype \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue