diff --git a/Makefile.in b/Makefile.in index e96fac06955..e47d942b165 100644 --- a/Makefile.in +++ b/Makefile.in @@ -131,6 +131,8 @@ endif # their name already, while others don't. DONE_$(1) = $$(B)src/$$(PATH_$(1))/lib*.dummy DEPS_SUBMODULES += $$(PATH_$(1)) +DEPS_SUBMODULES += $$(PATH_$(1))/.libs +DEPS_SUBMODULES += $$(PATH_$(1))/src/.libs endef # these will get populated. @@ -157,7 +159,7 @@ endef define DEF_SUBMODULE_RULES ENV_RLDFLAGS_$(1) = -L $$(CFG_BUILD_HOME)workspace/lib/$$(CFG_TARGET_TRIPLES) -ENV_RLDFLAGS_$(1) += $$(foreach dep,$$(DEPS_$(1)),-L $$(B)src/$$(PATH_$$(dep))) +ENV_RLDFLAGS_$(1) += $$(foreach dep,$$(DEPS_$(1)),-L $$(B)src/$$(PATH_$$(dep)) -L $$(B)src/$$(PATH_$$(dep))/.libs -L $$(B)src/$$(PATH_$$(dep))/src/.libs) # variables that depend on dependency definitions from sub.mk! ENV_CFLAGS_$(1) = CFLAGS="$$(CFLAGS_$(1))" @@ -336,7 +338,8 @@ servo: $(DEPS_servo) else servo: $(DEPS_servo) @$(call E, compile: $@) - $(Q)$(RUSTC) $(RFLAGS_servo) -C gen-crate-map -o $@ $< --crate-type lib + $(Q)$(RUSTC) $(RFLAGS_servo) -C gen-crate-map $< -o libservo.so --crate-type dylib + touch servo endif # Darwin app packaging @@ -354,12 +357,11 @@ package: servo else ifeq ($(CFG_OSTYPE),linux-androideabi) package: servo mkdir -p sofile - -exec cp -f {} $(CFG_BUILD_HOME)sofile \; - find . ! \( \( -type d -path './sofile' -o -path './$(CFG_TARGET_TRIPLES)/src/compiler/rust' \) -prune \) -name '*.so' -type f | xargs cp -f -t $(CFG_BUILD_HOME)sofile - find $(CFG_RUST_HOME)/lib/rustc/$(CFG_TARGET_TRIPLES)/lib/ -name '*.so' -type f -size +1c | xargs cp -f -t $(CFG_BUILD_HOME)sofile + find . ! \( \( -type d -path './sofile' -o -path './$(CFG_TARGET_TRIPLES)/src/compiler/rust' \) -prune \) -name '*.so' -type f | xargs -I {} cp -f {} $(CFG_BUILD_HOME)sofile/ + find $(CFG_RUST_HOME)/lib/rustlib/$(CFG_TARGET_TRIPLES)/lib/ -name '*.so' -type f -size +1c | xargs -I {} cp -f {} $(CFG_BUILD_HOME)sofile/ cd $(S)src/platform/android/servo-android-glue && make with-libs cd $(CFG_BUILD_HOME) - cp $(S)src/platform/android/servo-android-glue/bin/ServoAndroid-debug.apk -t $(CFG_BUILD_HOME) + cp $(S)src/platform/android/servo-android-glue/bin/ServoAndroid-debug.apk $(CFG_BUILD_HOME) else diff --git a/src/compiler/rust b/src/compiler/rust index aa39d755e3f..d6811bc1bde 160000 --- a/src/compiler/rust +++ b/src/compiler/rust @@ -1 +1 @@ -Subproject commit aa39d755e3f9823b51cc57761c0c8c75759aca2e +Subproject commit d6811bc1bdeb66381af4b9bf3e4ff77b3cee27f6 diff --git a/src/components/gfx/gfx.rs b/src/components/gfx/gfx.rs index de02ece7fbd..1af989fbad1 100644 --- a/src/components/gfx/gfx.rs +++ b/src/components/gfx/gfx.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#gfx:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[feature(globs, managed_boxes, macro_rules, phase)]; diff --git a/src/components/main/layout/context.rs b/src/components/main/layout/context.rs index 1b13470ed30..041f6747abd 100644 --- a/src/components/main/layout/context.rs +++ b/src/components/main/layout/context.rs @@ -24,17 +24,32 @@ use style::{ComputedValues, Stylist}; use sync::{Arc, MutexArc}; use url::Url; +#[cfg(target_os="android")] +use std::local_data; + +#[cfg(not(target_os="android"))] #[thread_local] static mut FONT_CONTEXT: *mut FontContext = 0 as *mut FontContext; +#[cfg(target_os="android")] +local_data_key!(font_context: * mut FontContext) + +#[cfg(not(target_os="android"))] #[thread_local] static mut APPLICABLE_DECLARATIONS_CACHE: *mut ApplicableDeclarationsCache = 0 as *mut ApplicableDeclarationsCache; +#[cfg(target_os="android")] +local_data_key!(applicable_declarations_cache: * mut ApplicableDeclarationsCache) + +#[cfg(not(target_os="android"))] #[thread_local] static mut STYLE_SHARING_CANDIDATE_CACHE: *mut StyleSharingCandidateCache = 0 as *mut StyleSharingCandidateCache; +#[cfg(target_os="android")] +local_data_key!(style_sharing_candidate_cache: * mut StyleSharingCandidateCache) + /// Data shared by all layout workers. #[deriving(Clone)] pub struct LayoutContext { @@ -71,6 +86,7 @@ pub struct LayoutContext { opts: Opts, } +#[cfg(not(target_os="android"))] impl LayoutContext { pub fn font_context<'a>(&'a mut self) -> &'a mut FontContext { // Sanity check. @@ -139,3 +155,57 @@ impl LayoutContext { } } + +// On Android, we don't have the __tls_* functions emitted by rustc, so we +// need to use the slower local_data functions. +// Making matters worse, the local_data functions are very particular about +// enforcing the lifetimes associated with objects that they hold onto, +// which causes us some trouble we work around as below. +#[cfg(target_os="android")] +impl LayoutContext { + pub fn font_context<'a>(&'a mut self) -> &'a mut FontContext { + unsafe { + let opt = local_data::pop(font_context); + let mut context; + match opt { + Some(c) => context = cast::transmute(c), + None => { + context = cast::transmute(~FontContext::new(self.font_context_info.clone())) + } + } + local_data::set(font_context, context); + cast::transmute(context) + } + } + + pub fn applicable_declarations_cache<'a>(&'a self) -> &'a mut ApplicableDeclarationsCache { + unsafe { + let opt = local_data::pop(applicable_declarations_cache); + let mut cache; + match opt { + Some(c) => cache = cast::transmute(c), + None => { + cache = cast::transmute(~ApplicableDeclarationsCache::new()); + } + } + local_data::set(applicable_declarations_cache, cache); + cast::transmute(cache) + } + } + + pub fn style_sharing_candidate_cache<'a>(&'a self) -> &'a mut StyleSharingCandidateCache { + unsafe { + let opt = local_data::pop(style_sharing_candidate_cache); + let mut cache; + match opt { + Some(c) => cache = cast::transmute(c), + None => { + cache = cast::transmute(~StyleSharingCandidateCache::new()); + } + } + local_data::set(style_sharing_candidate_cache, cache); + cast::transmute(cache) + } + } +} + diff --git a/src/components/msg/msg.rs b/src/components/msg/msg.rs index 659de719d32..e0823328e53 100644 --- a/src/components/msg/msg.rs +++ b/src/components/msg/msg.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#msg:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[feature(managed_boxes)]; diff --git a/src/components/net/net.rs b/src/components/net/net.rs index 7f4b340cf84..f23803af0bd 100644 --- a/src/components/net/net.rs +++ b/src/components/net/net.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#net:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[feature(globs, managed_boxes)]; diff --git a/src/components/script/script.rs b/src/components/script/script.rs index 9ab4c2cc671..3a94e9f9657 100644 --- a/src/components/script/script.rs +++ b/src/components/script/script.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#script:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[comment = "The Servo Parallel Browser Project"]; #[license = "MPL"]; diff --git a/src/components/style/style.rs b/src/components/style/style.rs index c2659665063..b923b4cfa30 100644 --- a/src/components/style/style.rs +++ b/src/components/style/style.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#style:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[comment = "The Servo Parallel Browser Project"]; #[license = "MPL"]; diff --git a/src/components/util/util.rs b/src/components/util/util.rs index 78ff97a5e05..27796803913 100644 --- a/src/components/util/util.rs +++ b/src/components/util/util.rs @@ -4,6 +4,8 @@ #[crate_id = "github.com/mozilla/servo#util:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; #[feature(macro_rules, managed_boxes)]; diff --git a/src/platform/android/servo-android-glue b/src/platform/android/servo-android-glue index caf03d371cb..5196a2a5824 160000 --- a/src/platform/android/servo-android-glue +++ b/src/platform/android/servo-android-glue @@ -1 +1 @@ -Subproject commit caf03d371cb99c9c72a7127114d8f5365a02eb06 +Subproject commit 5196a2a58249ac5cfb0a24418dc628551883c807 diff --git a/src/support/egl/rust-egl b/src/support/egl/rust-egl index 38cc35371a8..700b07bd663 160000 --- a/src/support/egl/rust-egl +++ b/src/support/egl/rust-egl @@ -1 +1 @@ -Subproject commit 38cc35371a88f6240cd4b35205b2ec8b6703f13a +Subproject commit 700b07bd663c6559326ef7126886e200aa3b0ab1 diff --git a/src/support/glut/rust-glut b/src/support/glut/rust-glut index be49cbc2d54..6050ecb8e88 160000 --- a/src/support/glut/rust-glut +++ b/src/support/glut/rust-glut @@ -1 +1 @@ -Subproject commit be49cbc2d5455744c7951b07160f0d29fed23641 +Subproject commit 6050ecb8e884b4eba1155dacb29d1c9567886c23 diff --git a/src/support/harfbuzz/rust-harfbuzz b/src/support/harfbuzz/rust-harfbuzz index c422c3ca200..9c2a78f3c43 160000 --- a/src/support/harfbuzz/rust-harfbuzz +++ b/src/support/harfbuzz/rust-harfbuzz @@ -1 +1 @@ -Subproject commit c422c3ca200da371d73af2246b62e6d7c40125e2 +Subproject commit 9c2a78f3c43d3b52391b94aa43dc61d6bddab50b diff --git a/src/support/stb-image/rust-stb-image b/src/support/stb-image/rust-stb-image index 064e33d8217..b00422e9636 160000 --- a/src/support/stb-image/rust-stb-image +++ b/src/support/stb-image/rust-stb-image @@ -1 +1 @@ -Subproject commit 064e33d8217424a33636c8019b1f1f74a44ee2bb +Subproject commit b00422e963694f7e46fe551a089b198badea5e1f