mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
auto merge of #1260 : metajack/servo/kmcallister-rustpkg, r=metajack,me
Rebased from @kmcallister's branch to fix mac platform issues.
This commit is contained in:
commit
d2cfb65127
26 changed files with 161 additions and 96 deletions
90
Makefile.in
90
Makefile.in
|
@ -116,11 +116,15 @@ rust: $(CFG_RUSTC)
|
|||
|
||||
# Strip off submodule paths to determine "raw" submodule names.
|
||||
SUBMODULES=$(shell echo $(CFG_SUBMODULES) | perl -p -e 's![A-Za-z0-9_-]+/!!g')
|
||||
SUBMODULES_RUSTPKG=$(shell echo $(CFG_SUBMODULES_RUSTPKG) | perl -p -e 's![A-Za-z0-9_-]+/!!g')
|
||||
|
||||
# Define e.g. PATH_rust-io-surface = platform/macos/rust-io-surface
|
||||
# Define e.g. PATH_skia = support/skia/skia
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval PATH_$(shell echo $(submodule) | perl -p -e 's![A-Za-z0-9_-]+/!!g') = $(submodule)))
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES_RUSTPKG),\
|
||||
$(eval PATH_$(shell echo $(submodule) | perl -p -e 's![A-Za-z0-9_-]+/!!g') = $(submodule)))
|
||||
|
||||
define DEF_SUBMODULE_VARS
|
||||
|
||||
#defaults
|
||||
|
@ -128,7 +132,7 @@ DEPS_$(1) =
|
|||
CFLAGS_$(1) = -O2
|
||||
|
||||
#if global cflags set, inherit that
|
||||
ifneq ($$(CFLAGS),)
|
||||
ifdef CFLAGS
|
||||
CFLAGS_$(1) = $$(CFLAGS)
|
||||
endif
|
||||
|
||||
|
@ -142,37 +146,49 @@ DEPS_SUBMODULES += $$(PATH_$(1))/.libs
|
|||
DEPS_SUBMODULES += $$(PATH_$(1))/src/.libs
|
||||
endef
|
||||
|
||||
DEPS_RUSTPKG = $(CFG_BUILD_HOME)workspace/lib/$(CFG_TARGET_TRIPLES)
|
||||
|
||||
# these will get populated.
|
||||
DEPS_SUBMODULES =
|
||||
|
||||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_VARS,$(submodule))))
|
||||
|
||||
$(foreach submodule,$(SUBMODULES_RUSTPKG),\
|
||||
$(eval DONE_$(submodule) = $(DEPS_RUSTPKG)/lib$(submodule)*))
|
||||
|
||||
# Handle rust submodule vars specially
|
||||
DONE_rust = $(CFG_RUSTC)
|
||||
|
||||
# include submodule dependencies configuration
|
||||
include $(S)mk/sub.mk
|
||||
|
||||
# Define how to compute approximate submodule dependencies.
|
||||
# TODO: this may be a bit brutish, but is there a better way?
|
||||
define DEF_SUBMODULE_DEPS
|
||||
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$$(PATH_$(1)),*h *c *cpp *rs *rc)
|
||||
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
|
||||
# the main target for a submodule
|
||||
endef
|
||||
|
||||
# Define how to make submodule targets
|
||||
define DEF_SUBMODULE_RULES
|
||||
|
||||
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)
|
||||
ENV_RLDFLAGS_$(1) = -L $$(CFG_BUILD_HOME)workspace/lib/$$(CFG_TARGET_TRIPLES)
|
||||
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))"
|
||||
ENV_RFLAGS_$(1) = RUSTFLAGS="$$(strip $$(CFG_RUSTC_FLAGS)) $$(ENV_RLDFLAGS_$(1))"
|
||||
|
||||
# use a rough approximation of submodule dependencies to trigger calling submodule make
|
||||
# whenever a submodule changes
|
||||
# TODO: this may be a bit brutish, but is there a better way?
|
||||
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$$(PATH_$(1)),*h *c *cpp *rs *rc)
|
||||
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
|
||||
# the main target for a submodule
|
||||
# --
|
||||
|
||||
# Native builds do not depend on the rust compiler, so we can build them in parallel with rustc
|
||||
RUSTC_DEP_$(1)=
|
||||
ifneq "$$(filter $(1),$$(NATIVE_BUILDS))" "$(1)"
|
||||
RUSTC_DEP_$(1)=$$(CFG_RUSTC)
|
||||
endif
|
||||
|
||||
$(eval $(call DEF_SUBMODULE_DEPS,$(1)))
|
||||
|
||||
$$(DONE_$(1)) : $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1)) $$(RUSTC_DEP_$(1))
|
||||
# @$$(call E, make: $(1))
|
||||
# @$$(call E, $(1) deps= $$(DEPS_$(1)))
|
||||
|
@ -180,7 +196,6 @@ $$(DONE_$(1)) : $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1)) $$(RUSTC_DEP_$(1))
|
|||
# @$$(call E, $(1) cflags= $$(ENV_CFLAGS_$(1)))
|
||||
# @$$(call E, $(1) cxxflags= $$(ENV_CXXFLAGS_$(1)))
|
||||
# @$$(call E, $(1) rflags= $$(ENV_RFLAGS_$(1)))
|
||||
|
||||
$$(Q) \
|
||||
$$(ENV_CFLAGS_$(1)) \
|
||||
$$(ENV_CXXFLAGS_$(1)) \
|
||||
|
@ -195,46 +210,53 @@ endef
|
|||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_RULES,$(submodule))))
|
||||
|
||||
DONE_SUBMODULES = $(foreach submodule,$(SUBMODULES),$(DONE_$(submodule)))
|
||||
# include rustpkg rules
|
||||
include $(S)mk/rustpkg.mk
|
||||
|
||||
RFLAGS_util = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
|
||||
$(foreach submodule,$(SUBMODULES_RUSTPKG),\
|
||||
$(eval $(call DEF_SUBMODULE_RUSTPKG_RULES,$(submodule))))
|
||||
|
||||
DONE_SUBMODULES = $(foreach submodule,$(SUBMODULES),$(DONE_$(submodule)))
|
||||
DONE_SUBMODULES_RUSTPKG = $(foreach submodule,$(SUBMODULES_RUSTPKG),$(DONE_$(submodule)))
|
||||
|
||||
RFLAGS_util = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(DEPS_RUSTPKG)
|
||||
SRC_util = $(call rwildcard,$(S)src/components/util/,*.rs)
|
||||
CRATE_util = $(S)src/components/util/util.rc
|
||||
DONE_util = $(B)src/components/util/libutil.dummy
|
||||
|
||||
DEPS_util = $(CRATE_util) $(SRC_util) $(DONE_SUBMODULES)
|
||||
DEPS_util = $(CRATE_util) $(SRC_util) $(DONE_SUBMODULES) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_net = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util
|
||||
RFLAGS_net = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(DEPS_RUSTPKG)
|
||||
SRC_net = $(call rwildcard,$(S)src/components/net/,*.rs)
|
||||
CRATE_net = $(S)src/components/net/net.rc
|
||||
DONE_net = $(B)src/components/net/libnet.dummy
|
||||
|
||||
DEPS_net = $(CRATE_net) $(SRC_net) $(DONE_SUBMODULES) $(DONE_util)
|
||||
DEPS_net = $(CRATE_net) $(SRC_net) $(DONE_SUBMODULES) $(DONE_util) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_msg = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
|
||||
RFLAGS_msg = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(DEPS_RUSTPKG)
|
||||
SRC_msg = $(call rwildcard,$(S)src/components/msg/,*.rs)
|
||||
CRATE_msg = $(S)src/components/msg/msg.rc
|
||||
DONE_msg = $(B)src/components/msg/libmsg.dummy
|
||||
|
||||
DEPS_msg = $(CRATE_msg) $(SRC_msg) $(DONE_SUBMODULES)
|
||||
DEPS_msg = $(CRATE_msg) $(SRC_msg) $(DONE_SUBMODULES) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_gfx = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg
|
||||
RFLAGS_gfx = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg -L $(DEPS_RUSTPKG)
|
||||
SRC_gfx = $(call rwildcard,$(S)src/components/gfx/,*.rs)
|
||||
CRATE_gfx = $(S)src/components/gfx/gfx.rc
|
||||
DONE_gfx = $(B)src/components/gfx/libgfx.dummy
|
||||
|
||||
DEPS_gfx = $(CRATE_gfx) $(SRC_gfx) $(DONE_SUBMODULES) $(DONE_util) $(DONE_style) $(DONE_net) $(DONE_msg)
|
||||
DEPS_gfx = $(CRATE_gfx) $(SRC_gfx) $(DONE_SUBMODULES) $(DONE_util) $(DONE_style) $(DONE_net) $(DONE_msg) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_script = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg
|
||||
RFLAGS_script = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg -L $(DEPS_RUSTPKG)
|
||||
WEBIDL_script = $(call rwildcard,$(S)src/components/script/,*.webidl)
|
||||
AUTOGEN_SRC_script = $(patsubst %.webidl, %Binding.rs, $(WEBIDL_script))
|
||||
SRC_script = $(call rwildcard,$(S)src/components/script/,*.rs) $(AUTOGEN_SRC_script)
|
||||
CRATE_script = $(S)src/components/script/script.rc
|
||||
DONE_script = $(B)src/components/script/libscript.dummy
|
||||
|
||||
DEPS_script = $(CRATE_script) $(SRC_script) $(DONE_SUBMODULES) $(DONE_util) $(DONE_style) $(DONE_net) $(DONE_msg)
|
||||
DEPS_script = $(CRATE_script) $(SRC_script) $(DONE_SUBMODULES) $(DONE_util) $(DONE_style) $(DONE_net) $(DONE_msg) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_style = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util
|
||||
RFLAGS_style = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(DEPS_RUSTPKG)
|
||||
MAKO_ZIP = $(S)src/components/style/Mako-0.8.1.zip
|
||||
MAKO_style = $(S)src/components/style/properties.rs
|
||||
MAKO_SRC_style = $(MAKO_style).mako
|
||||
|
@ -242,14 +264,21 @@ SRC_style = $(call rwildcard,$(S)src/components/style/,*.rs) $(MAKO_style)
|
|||
CRATE_style = $(S)src/components/style/style.rc
|
||||
DONE_style = $(B)src/components/style/libstyle.dummy
|
||||
|
||||
DEPS_style = $(CRATE_style) $(SRC_style) $(DONE_SUBMODULES) $(DONE_util)
|
||||
DEPS_style = $(CRATE_style) $(SRC_style) $(DONE_SUBMODULES) $(DONE_util) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg
|
||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg -L $(DEPS_RUSTPKG)
|
||||
|
||||
SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs)
|
||||
CRATE_servo = $(S)src/components/main/servo.rc
|
||||
|
||||
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_style) $(DONE_net) $(DONE_msg)
|
||||
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_SUBMODULES_RUSTPKG) | $(SUBMODULES_RUSTPKG)
|
||||
|
||||
SERVO_LIB_CRATES = util net msg gfx script style
|
||||
|
||||
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
|
||||
# and SERVO_LIB_CRATES
|
||||
include $(S)mk/check.mk
|
||||
include $(S)mk/clean.mk
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
.PHONY: all
|
||||
|
@ -257,8 +286,6 @@ all: servo
|
|||
|
||||
# Servo helper libraries
|
||||
|
||||
SERVO_LIB_CRATES = util net msg gfx script style
|
||||
|
||||
define DEF_LIB_CRATE_RULES
|
||||
$$(DONE_$(1)): $$(DEPS_$(1))
|
||||
@$$(call E, compile: $$@)
|
||||
|
@ -268,11 +295,6 @@ endef
|
|||
$(foreach lib_crate,$(SERVO_LIB_CRATES),\
|
||||
$(eval $(call DEF_LIB_CRATE_RULES,$(lib_crate))))
|
||||
|
||||
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
|
||||
# and SERVO_LIB_CRATES
|
||||
include $(S)mk/check.mk
|
||||
include $(S)mk/clean.mk
|
||||
|
||||
BINDINGS_SRC = $(S)/src/components/script/dom/bindings/codegen
|
||||
|
||||
CACHE_DIR = $(BINDINGS_SRC)/_cache
|
||||
|
|
29
configure
vendored
29
configure
vendored
|
@ -399,6 +399,7 @@ probe CFG_CLANG clang++
|
|||
|
||||
CFG_BUILD_DIR="${CFG_BUILD_HOME}${CFG_TARGET_TRIPLES}/"
|
||||
make_dir "${CFG_BUILD_DIR}"
|
||||
make_dir "${CFG_BUILD_HOME}/workspace/src"
|
||||
|
||||
if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
|
||||
then
|
||||
|
@ -407,6 +408,7 @@ then
|
|||
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
||||
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
|
||||
CFG_RUSTC=${CFG_LOCAL_RUST_ROOT}/bin/rustc
|
||||
CFG_RUSTPKG=${CFG_LOCAL_RUST_ROOT}/bin/rustpkg
|
||||
CFG_RUST_HOME=${CFG_LOCAL_RUST_ROOT}
|
||||
CFG_LOCAL_RUSTC=1
|
||||
else
|
||||
|
@ -416,6 +418,7 @@ else
|
|||
step_msg "using in-tree rust compiler"
|
||||
# The Rust compiler we're going to build
|
||||
CFG_RUSTC="${CFG_BUILD_DIR}src/compiler/rust/${DEFAULT_TARGET_TRIPLE}/stage2/bin/rustc"
|
||||
CFG_RUSTPKG="${CFG_BUILD_DIR}src/compiler/rust/${DEFAULT_TARGET_TRIPLE}/stage2/bin/rustpkg"
|
||||
CFG_RUST_HOME="${CFG_BUILD_DIR}src/compiler/rust/${DEFAULT_TARGET_TRIPLE}/stage2"
|
||||
fi
|
||||
|
||||
|
@ -482,21 +485,23 @@ then
|
|||
done
|
||||
fi
|
||||
|
||||
CFG_SUBMODULES_RUSTPKG="\
|
||||
support/geom/rust-geom \
|
||||
support/layers/rust-layers \
|
||||
support/opengles/rust-opengles \
|
||||
support/sharegl/sharegl"
|
||||
|
||||
CFG_SUBMODULES="\
|
||||
support/alert/rust-alert \
|
||||
support/azure/rust-azure \
|
||||
support/css/rust-cssparser \
|
||||
support/geom/rust-geom \
|
||||
support/harfbuzz/rust-harfbuzz \
|
||||
support/http/rust-http \
|
||||
support/hubbub/libhubbub \
|
||||
support/hubbub/rust-hubbub \
|
||||
support/layers/rust-layers \
|
||||
support/libparserutils/libparserutils \
|
||||
support/nss/nspr \
|
||||
support/nss/nss \
|
||||
support/opengles/rust-opengles \
|
||||
support/sharegl/sharegl \
|
||||
support/skia/skia \
|
||||
support/spidermonkey/mozjs \
|
||||
support/spidermonkey/rust-mozjs \
|
||||
|
@ -506,25 +511,29 @@ CFG_SUBMODULES="\
|
|||
|
||||
if [ $CFG_OSTYPE = "apple-darwin" ]
|
||||
then
|
||||
CFG_SUBMODULES="\
|
||||
support/glfw/glfw \
|
||||
support/glfw/glfw-rs \
|
||||
platform/macos/rust-cocoa \
|
||||
CFG_SUBMODULES_RUSTPKG="\
|
||||
platform/macos/rust-core-foundation \
|
||||
platform/macos/rust-core-graphics \
|
||||
platform/macos/rust-core-text \
|
||||
platform/macos/rust-io-surface \
|
||||
${CFG_SUBMODULES_RUSTPKG}"
|
||||
CFG_SUBMODULES="\
|
||||
support/glfw/glfw \
|
||||
support/glfw/glfw-rs \
|
||||
platform/macos/rust-cocoa \
|
||||
${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
if [ $CFG_OSTYPE = "unknown-linux-gnu" ]
|
||||
then
|
||||
CFG_SUBMODULES_RUSTPKG="\
|
||||
platform/linux/rust-xlib \
|
||||
${CFG_SUBMODULES_RUSTPKG}"
|
||||
CFG_SUBMODULES="\
|
||||
support/glfw/glfw \
|
||||
support/glfw/glfw-rs \
|
||||
platform/linux/rust-fontconfig \
|
||||
platform/linux/rust-freetype \
|
||||
platform/linux/rust-xlib \
|
||||
${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
|
@ -550,8 +559,10 @@ putvar CFG_BUILD_HOME
|
|||
putvar CFG_BUILD_DIR
|
||||
putvar CFG_CONFIGURE_ARGS
|
||||
putvar CFG_SUBMODULES
|
||||
putvar CFG_SUBMODULES_RUSTPKG
|
||||
putvar CFG_DISABLE_MANAGE_SUBMODULES
|
||||
putvar CFG_RUSTC
|
||||
putvar CFG_RUSTPKG
|
||||
putvar CFG_RUSTC_FLAGS
|
||||
putvar CFG_RUST_HOME
|
||||
putvar CFG_PATH
|
||||
|
|
|
@ -49,7 +49,7 @@ clean-style:
|
|||
@$(call E, "cleaning style")
|
||||
$(Q)cd $(B)/src/components/style/ && rm -rf libstyle*.dylib libstyle*.dSYM libstyle*.so $(DONE_style)
|
||||
|
||||
clean-servo: clean-gfx clean-util clean-net clean-script clean-msg
|
||||
clean-servo: clean-gfx clean-util clean-net clean-script clean-msg clean-style
|
||||
@$(call E, "cleaning servo")
|
||||
$(Q)rm -f servo servo-test $(foreach lib_crate,$(SERVO_LIB_CRATES),servo-test-$(lib_crate)) libservo*.so
|
||||
$(Q)cd $(BINDINGS_SRC) && rm -f *.pkl
|
||||
|
|
36
mk/rustpkg.mk
Normal file
36
mk/rustpkg.mk
Normal file
|
@ -0,0 +1,36 @@
|
|||
EMPTY=
|
||||
SPACE=$(EMPTY) $(EMPTY)
|
||||
|
||||
define DEF_SUBMODULE_RUSTPKG_RULES
|
||||
|
||||
$(eval $(call DEF_SUBMODULE_DEPS,$(1)))
|
||||
|
||||
$(1) : $$(DONE_$(1))
|
||||
.PHONY : $(1)
|
||||
|
||||
DO_CLEAN_$(1) = rm -rf $$(DONE_$(1)) $(CFG_BUILD_HOME)/workspace/build/$(CFG_TARGET_TRIPLES)/$(1)
|
||||
|
||||
EXTRA_RFLAGS_$(1) =
|
||||
|
||||
ifeq ($(shell uname -s),Darwin)
|
||||
ifeq ($(shell sw_vers | grep -c 10.6),1)
|
||||
EXTRA_RFLAGS_$(1) += --cfg mac_10_6
|
||||
endif
|
||||
ifeq ($(shell sw_vers | grep -c 10.7),1)
|
||||
EXTRA_RFLAGS_$(1) += --cfg mac_10_7
|
||||
endif
|
||||
else
|
||||
endif
|
||||
|
||||
clean-$(1) :
|
||||
$$(Q) $$(DO_CLEAN_$(1))
|
||||
.PHONY : clean-$(1)
|
||||
|
||||
# Need to clean otherwise rustpkg won't rebuild.
|
||||
$$(DONE_$(1)) : $$(DONE_rust) $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1))
|
||||
$$(Q) $$(DO_CLEAN_$(1))
|
||||
$$(Q) RUST_PATH=$(CFG_BUILD_HOME)workspace:$(subst $(SPACE),:,$(foreach submodule,$(strip $(CFG_SUBMODULES_RUSTPKG)),$(S)src/$(submodule))) \
|
||||
$(CFG_RUSTPKG) --rust-path-hack install $(CFG_RUSTC_FLAGS) $$(EXTRA_RFLAGS_$(1)) $(1)
|
||||
|
||||
endef
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
extern mod azure;
|
||||
extern mod extra;
|
||||
extern mod geom;
|
||||
extern mod layers;
|
||||
extern mod geom = "rust-geom";
|
||||
extern mod layers = "rust-layers";
|
||||
extern mod stb_image;
|
||||
extern mod servo_net (name = "net");
|
||||
extern mod servo_util (name = "util");
|
||||
|
@ -29,9 +29,9 @@ extern mod harfbuzz;
|
|||
#[cfg(target_os="linux")] #[cfg(target_os="android")] extern mod freetype;
|
||||
|
||||
// Mac OS-specific library dependencies
|
||||
#[cfg(target_os="macos")] extern mod core_foundation;
|
||||
#[cfg(target_os="macos")] extern mod core_graphics;
|
||||
#[cfg(target_os="macos")] extern mod core_text;
|
||||
#[cfg(target_os="macos")] extern mod core_foundation = "rust-core-foundation";
|
||||
#[cfg(target_os="macos")] extern mod core_graphics = "rust-core-graphics";
|
||||
#[cfg(target_os="macos")] extern mod core_text = "rust-core-text";
|
||||
|
||||
pub use gfx_font = font;
|
||||
pub use gfx_font_context = font_context;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
/// Implementation of Quartz (CoreGraphics) fonts.
|
||||
|
||||
extern mod core_foundation;
|
||||
extern mod core_graphics;
|
||||
extern mod core_text;
|
||||
extern mod core_foundation = "rust-core-foundation";
|
||||
extern mod core_graphics = "rust-core-graphics";
|
||||
extern mod core_text = "rust-core-text";
|
||||
|
||||
use font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTableMethods};
|
||||
use font::{FontTableTag, FontWeight100, FontWeight200, FontWeight300, FontWeight400};
|
||||
|
@ -23,13 +23,13 @@ use core_foundation::string::UniChar;
|
|||
use core_graphics::data_provider::CGDataProvider;
|
||||
use core_graphics::font::{CGFont, CGGlyph};
|
||||
use core_graphics::geometry::CGRect;
|
||||
use core_graphics;
|
||||
use core_text::font::{CTFont, CTFontMethods, CTFontMethodsPrivate};
|
||||
use core_text::font::CTFont;
|
||||
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
|
||||
use core_text::font_descriptor::{kCTFontDefaultOrientation};
|
||||
use core_text;
|
||||
|
||||
use std::ptr;
|
||||
use std::vec;
|
||||
|
||||
pub struct FontTable {
|
||||
data: CFData,
|
||||
|
@ -48,7 +48,7 @@ impl FontTable {
|
|||
|
||||
impl FontTableMethods for FontTable {
|
||||
fn with_buffer(&self, blk: &fn(*u8, uint)) {
|
||||
blk(self.data.bytes(), self.data.len());
|
||||
blk(vec::raw::to_ptr(self.data.bytes()), self.data.len() as uint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,11 +80,8 @@ impl FontHandle {
|
|||
impl FontHandleMethods for FontHandle {
|
||||
fn new_from_buffer(_: &FontContextHandle, buf: ~[u8], style: &SpecifiedFontStyle)
|
||||
-> Result<FontHandle, ()> {
|
||||
let fontprov : CGDataProvider = do buf.as_imm_buf |cbuf, len| {
|
||||
core_graphics::data_provider::new_from_buffer(cbuf, len)
|
||||
};
|
||||
|
||||
let cgfont = core_graphics::font::create_with_data_provider(&fontprov);
|
||||
let fontprov = CGDataProvider::from_buffer(buf);
|
||||
let cgfont = CGFont::from_data_provider(fontprov);
|
||||
let ctfont = core_text::font::new_from_CGFont(&cgfont, style.pt_size);
|
||||
|
||||
let result = Ok(FontHandle {
|
||||
|
|
|
@ -8,12 +8,12 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap};
|
|||
use platform::macos::font::FontHandle;
|
||||
use platform::macos::font_context::FontContextHandle;
|
||||
|
||||
use core_foundation::array::CFArray;
|
||||
use core_foundation::base::CFWrapper;
|
||||
use core_foundation::base::TCFType;
|
||||
use core_foundation::string::{CFString, CFStringRef};
|
||||
use core_text::font_collection::CTFontCollectionMethods;
|
||||
use core_text;
|
||||
use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef};
|
||||
|
||||
use std::cast;
|
||||
use std::hashmap::HashMap;
|
||||
|
||||
pub struct FontListHandle {
|
||||
|
@ -28,10 +28,12 @@ impl FontListHandle {
|
|||
}
|
||||
|
||||
pub fn get_available_families(&self) -> FontFamilyMap {
|
||||
let family_names: CFArray<CFStringRef> = core_text::font_collection::get_family_names();
|
||||
let family_names = core_text::font_collection::get_family_names();
|
||||
let mut family_map: FontFamilyMap = HashMap::new();
|
||||
for strref in family_names.iter() {
|
||||
let family_name = CFString::wrap_shared(strref).to_str();
|
||||
let family_name_ref: CFStringRef = unsafe { cast::transmute(strref) };
|
||||
let family_name_cf: CFString = unsafe { TCFType::wrap_under_get_rule(family_name_ref) };
|
||||
let family_name = family_name_cf.to_str();
|
||||
debug!("Creating new FontFamily for family: {:s}", family_name);
|
||||
|
||||
let new_family = @mut FontFamily::new(family_name);
|
||||
|
@ -46,7 +48,8 @@ impl FontListHandle {
|
|||
let family_collection = core_text::font_collection::create_for_family(family.family_name);
|
||||
let family_descriptors = family_collection.get_descriptors();
|
||||
for descref in family_descriptors.iter() {
|
||||
let desc = CFWrapper::wrap_shared(descref);
|
||||
let descref: CTFontDescriptorRef = unsafe { cast::transmute(descref) };
|
||||
let desc: CTFontDescriptor = unsafe { TCFType::wrap_under_get_rule(descref) };
|
||||
let font = core_text::font::new_from_descriptor(&desc, 0.0);
|
||||
let handle = FontHandle::new_from_CTFont(&self.fctx, font).unwrap();
|
||||
|
||||
|
|
|
@ -15,16 +15,15 @@
|
|||
|
||||
extern mod alert;
|
||||
extern mod azure;
|
||||
extern mod geom;
|
||||
extern mod geom = "rust-geom";
|
||||
extern mod gfx (name = "gfx");
|
||||
#[cfg(not(target_os="android"))]
|
||||
extern mod glfw;
|
||||
//extern mod http_client;
|
||||
#[cfg(target_os="android")]
|
||||
extern mod glut;
|
||||
extern mod js;
|
||||
extern mod layers;
|
||||
extern mod opengles;
|
||||
extern mod layers = "rust-layers";
|
||||
extern mod opengles = "rust-opengles";
|
||||
extern mod png;
|
||||
extern mod script;
|
||||
extern mod servo_net (name = "net");
|
||||
|
@ -36,11 +35,9 @@ extern mod stb_image;
|
|||
extern mod extra;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
extern mod core_graphics;
|
||||
extern mod core_graphics = "rust-core-graphics";
|
||||
#[cfg(target_os="macos")]
|
||||
extern mod core_text;
|
||||
#[cfg(target_os="macos")]
|
||||
extern mod io_surface;
|
||||
extern mod core_text = "rust-core-text";
|
||||
|
||||
use compositing::{CompositorChan, CompositorTask};
|
||||
use constellation::Constellation;
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
extern mod azure;
|
||||
extern mod extra;
|
||||
extern mod geom;
|
||||
extern mod layers;
|
||||
extern mod geom = "rust-geom";
|
||||
extern mod layers = "rust-layers";
|
||||
extern mod std;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
extern mod core_foundation;
|
||||
extern mod core_foundation = "rust-core-foundation";
|
||||
#[cfg(target_os="macos")]
|
||||
extern mod io_surface;
|
||||
extern mod io_surface = "rust-io-surface";
|
||||
|
||||
pub mod compositor_msg;
|
||||
pub mod constellation_msg;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use platform::surface::NativeSurfaceAzureMethods;
|
||||
|
||||
use azure::AzSkiaGrGLSharedSurfaceRef;
|
||||
use core_foundation::base::CFWrapper;
|
||||
use io_surface::IOSurface;
|
||||
use layers::platform::surface::NativeSurface;
|
||||
use std::cast;
|
||||
|
@ -17,7 +16,7 @@ impl NativeSurfaceAzureMethods for NativeSurface {
|
|||
fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
|
||||
unsafe {
|
||||
let io_surface = IOSurface {
|
||||
contents: CFWrapper::wrap_owned(cast::transmute(surface)),
|
||||
obj: cast::transmute(surface),
|
||||
};
|
||||
NativeSurface::from_io_surface(io_surface)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#[feature(globs, managed_boxes)];
|
||||
|
||||
extern mod geom;
|
||||
extern mod geom = "rust-geom";
|
||||
extern mod http;
|
||||
extern mod servo_util (name = "util");
|
||||
extern mod stb_image;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
|
||||
|
||||
extern mod geom;
|
||||
extern mod geom = "rust-geom";
|
||||
extern mod hubbub;
|
||||
extern mod js;
|
||||
extern mod servo_net (name = "net");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#[feature(macro_rules, managed_boxes)];
|
||||
|
||||
extern mod extra;
|
||||
extern mod geom;
|
||||
extern mod geom = "rust-geom";
|
||||
|
||||
pub mod cache;
|
||||
pub mod geometry;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 71ca7ff52c7f342c95608c00bb0823aa8f39cd34
|
||||
Subproject commit 4466b6fb89ffd45222176d9381c19aa474ef8a33
|
|
@ -1 +1 @@
|
|||
Subproject commit aeb2040fa5f7f1ca8bafdf88df253693ba18415b
|
||||
Subproject commit 809e031c6c423655e3731c15295fb5f6eead53b2
|
|
@ -1 +1 @@
|
|||
Subproject commit b5ddb54271a9f783dce5c966cc2a39f0e52b1e68
|
||||
Subproject commit b41b972fbd67f2fba966753d67e735c0431d1cf2
|
|
@ -1 +1 @@
|
|||
Subproject commit 747fb760771f07038267ae842a6fa1cb35586429
|
||||
Subproject commit 5439c904951dcb9435e9c52fb0e53a1d853c5850
|
|
@ -1 +1 @@
|
|||
Subproject commit 63982184a34edfbf70d436cc6a37b325b4c7a827
|
||||
Subproject commit c046cbbd346cc5abead05d17b0f1669110c1cb3e
|
|
@ -1 +1 @@
|
|||
Subproject commit a4bd491ddfd5d17bdcb228cf515cce776e2b8239
|
||||
Subproject commit 1cb5c9274291d97d87648ced60510f30c54f94a1
|
|
@ -1 +1 @@
|
|||
Subproject commit 78a250ecd133d65c9ac46650fe68aab0dc75e467
|
||||
Subproject commit a9fd3aa3ca7eba68f4bcd8906e281f27b78fda38
|
|
@ -1 +1 @@
|
|||
Subproject commit 10aee62cc9f7b47b57fb56acc760af93e4e48005
|
||||
Subproject commit 13fbdbeddfccbc3e451fa9ae47f334f4f626a051
|
|
@ -1 +1 @@
|
|||
Subproject commit 7fa173a07414f4e1bcf3419079d5b812195acc2d
|
||||
Subproject commit 83f47c9b3129fed40ae9680d84dade478f331745
|
|
@ -1 +1 @@
|
|||
Subproject commit 2550ff84238a9b063a920eb41766f84062593b56
|
||||
Subproject commit 3626d203319a4d12ac68fecee11e18850e180e78
|
|
@ -1 +1 @@
|
|||
Subproject commit d2cde75d928572e665942732f0cad4a35faf4182
|
||||
Subproject commit c86eaa809c906d70aef4f3af0ac9f7377cc8e8ca
|
|
@ -1 +1 @@
|
|||
Subproject commit 90152e93e0277106e7a21dd2c5cc287efe0da053
|
||||
Subproject commit 0d47098172620e4e10d1639732c9755eb9956e0f
|
|
@ -1 +1 @@
|
|||
Subproject commit 1867a2b938f459815935c099d3aa88eac594fd30
|
||||
Subproject commit b80b6cd976a75a329abbed72a0c999797a20f5a9
|
Loading…
Add table
Add a link
Reference in a new issue