Similarly to the previous commit, libuv is only used by this library, so there's
no need for it to be linked into librustrt and available to all crates by
default.
# new definitions), make sure definitions always precede their uses,
# especially for the dependency lists of recipes.
+include $(CFG_SRC_DIR)mk/rt.mk
include $(CFG_SRC_DIR)mk/target.mk
include $(CFG_SRC_DIR)mk/host.mk
include $(CFG_SRC_DIR)mk/stage0.mk
-include $(CFG_SRC_DIR)mk/rt.mk
include $(CFG_SRC_DIR)mk/rustllvm.mk
include $(CFG_SRC_DIR)mk/tools.mk
include $(CFG_SRC_DIR)mk/docs.mk
rt/sync/rust_thread.cpp \
rt/rust_builtin.cpp \
rt/rust_upcall.cpp \
- rt/rust_uv.cpp \
rt/miniz.cpp \
rt/rust_android_dummy.cpp \
rt/rust_test_helpers.cpp
RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1))
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
- -I $$(S)src/rt/arch/$$(HOST_$(1)) \
- -I $$(S)src/libuv/include
+ -I $$(S)src/rt/arch/$$(HOST_$(1))
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
$$(RUNTIME_S_$(1)_$(2):rt/%.S=$$(RT_BUILD_DIR_$(1)_$(2))/%.o)
$$(Q)$(AR_$(1)) rcs $$@ $$^
$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
- $$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1))
+ $$(RUNTIME_DEF_$(1)_$(2))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
- $$(LIBUV_LIB_$(1)) \
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))
# These could go in rt.mk or rustllvm.mk, they're needed for both.
V=$$(VERBOSE)
endif
+# libuv support functionality (extra C/C++ that we need to use libuv)
+
+UV_SUPPORT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),uv_support)
+UV_SUPPORT_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/uv_support
+UV_SUPPORT_LIB_$(1) := $$(UV_SUPPORT_DIR_$(1))/$$(UV_SUPPORT_NAME_$(1))
+UV_SUPPORT_CS_$(1) := rt/rust_uv.cpp
+UV_SUPPORT_OBJS_$(1) := $$(UV_SUPPORT_CS_$(1):rt/%.cpp=$$(UV_SUPPORT_DIR_$(1))/%.o)
+
+$$(UV_SUPPORT_DIR_$(1))/%.o: rt/%.cpp
+ @$$(call E, compile: $$@)
+ @mkdir -p $$(@D)
+ $$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, \
+ -I $$(S)src/libuv/include \
+ $$(RUNTIME_CFLAGS_$(1))) $$<
+
+$$(UV_SUPPORT_LIB_$(1)): $$(UV_SUPPORT_OBJS_$(1))
+ @$$(call E, link: $$@)
+ $$(Q)$$(AR_$(1)) rcs $$@ $$^
+
+# sundown markdown library (used by librustdoc)
+
SUNDOWN_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),sundown)
SUNDOWN_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/sundown
SUNDOWN_LIB_$(1) := $$(SUNDOWN_DIR_$(1))/$$(SUNDOWN_NAME_$(1))
$$(LIBRUSTUV_CRATE) $$(LIBRUSTUV_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
+ $$(LIBUV_LIB_$(2)) \
+ $$(UV_SUPPORT_LIB_$(2)) \
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(2)),$$(notdir $$@))
- $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
+ $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
+ -L $$(UV_SUPPORT_DIR_$(2)) \
+ -L $$(dir $$(LIBUV_LIB_$(2))) \
+ --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(2)),$$(notdir $$@))
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
+# NOTE: after the next snapshot remove these '-L' flags
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
$$(DRIVER_CRATE) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
| $$(TBIN$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
- $$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
+ $$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$< \
+ -L $$(UV_SUPPORT_DIR_$(2)) \
+ -L $$(dir $$(LIBUV_LIB_$(2)))
ifdef CFG_ENABLE_PAX_FLAGS
@$$(call E, apply PaX flags: $$@)
@"$(CFG_PAXCTL)" -cm "$$@"
$$(LIBRUSTUV_CRATE) $$(LIBRUSTUV_INPUTS) \
$$(STDTESTDEP_$(1)_$(2)_$(3))
@$$(call E, compile_and_link: $$@)
- $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
+ $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
+ -L $$(UV_SUPPORT_DIR_$(2)) \
+ -L $$(dir $$(LIBUV_LIB_$(2)))
$(3)/stage$(1)/test/syntaxtest-$(2)$$(X_$(2)): \
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
- $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
+ $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
+ -L $$(SUNDOWN_DIR_$(2))
endef
use super::debuginfo::*;
use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong};
- #[link_args = "-Lrustllvm -lrustllvm"]
- #[link_name = "rustllvm"]
+ #[link_args = "-lrustllvm"]
extern {
/* Create and destroy contexts. */
pub fn LLVMContextCreate() -> ContextRef;
err_msg: ~str,
}
+// uv_support is the result of compiling rust_uv.cpp
+#[link_args = "-luv_support -luv"]
extern {
fn rust_uv_handle_size(type_: uintptr_t) -> size_t;
signum: c_int) -> c_int;
fn rust_uv_signal_stop(handle: *uv_signal_t) -> c_int;
}
+
+// libuv requires various system libraries to successfully link on some
+// platforms
+#[cfg(target_os = "linux")]
+#[link_args = "-lpthread"]
+extern {}
+
+#[cfg(target_os = "win32")]
+#[link_args = "-lWs2_32 -lpsapi -liphlpapi"]
+extern {}
rust_win32_rand_release
upcall_rust_personality
upcall_reset_stack_limit
-rust_uv_loop_new
-rust_uv_loop_delete
-rust_uv_walk
-rust_uv_loop_set_data
-rust_uv_run
-rust_uv_close
-rust_uv_async_send
-rust_uv_async_init
-rust_uv_timer_init
-rust_uv_timer_start
-rust_uv_timer_stop
-rust_uv_tcp_init
-rust_uv_buf_init
-rust_uv_strerror
-rust_uv_err_name
-rust_uv_ip4_addr
-rust_uv_ip4_name
-rust_uv_ip6_addr
-rust_uv_ip6_name
-rust_uv_tcp_connect
-rust_uv_tcp_bind
-rust_uv_tcp_connect6
-rust_uv_tcp_bind6
-rust_uv_tcp_getsockname
-rust_uv_tcp_nodelay
-rust_uv_tcp_keepalive
-rust_uv_tcp_simultaneous_accepts
-rust_uv_udp_init
-rust_uv_udp_bind
-rust_uv_udp_bind6
-rust_uv_udp_send
-rust_uv_udp_send6
-rust_uv_udp_recv_start
-rust_uv_udp_recv_stop
-rust_uv_get_udp_handle_from_send_req
-rust_uv_udp_getsockname
-rust_uv_udp_set_membership
-rust_uv_udp_set_multicast_loop
-rust_uv_udp_set_multicast_ttl
-rust_uv_udp_set_ttl
-rust_uv_udp_set_broadcast
-rust_uv_is_ipv4_sockaddr
-rust_uv_is_ipv6_sockaddr
-rust_uv_malloc_sockaddr_storage
-rust_uv_free_sockaddr_storage
-rust_uv_listen
-rust_uv_accept
-rust_uv_write
-rust_uv_read_start
-rust_uv_read_stop
-rust_uv_is_ipv4_addrinfo
-rust_uv_is_ipv6_addrinfo
-rust_uv_get_next_addrinfo
-rust_uv_addrinfo_as_sockaddr_in
-rust_uv_addrinfo_as_sockaddr_in6
-rust_uv_get_stream_handle_from_connect_req
-rust_uv_get_stream_handle_from_write_req
-rust_uv_get_loop_for_uv_handle
-rust_uv_get_data_for_uv_loop
-rust_uv_set_data_for_uv_loop
-rust_uv_get_data_for_uv_handle
-rust_uv_set_data_for_uv_handle
-rust_uv_get_data_for_req
-rust_uv_set_data_for_req
-rust_uv_get_base_from_buf
-rust_uv_get_len_from_buf
-rust_uv_getaddrinfo
-rust_uv_freeaddrinfo
-rust_uv_idle_init
-rust_uv_idle_start
-rust_uv_idle_stop
-rust_uv_fs_open
-rust_uv_fs_unlink
-rust_uv_fs_write
-rust_uv_fs_read
-rust_uv_fs_close
-rust_uv_get_result_from_fs_req
-rust_uv_get_ptr_from_fs_req
-rust_uv_get_loop_from_fs_req
-rust_uv_fs_stat
-rust_uv_fs_fstat
-rust_uv_fs_req_cleanup
-rust_uv_populate_uv_stat
-rust_uv_fs_mkdir
-rust_uv_fs_rmdir
-rust_uv_fs_readdir
rust_dbg_lock_create
rust_dbg_lock_destroy
rust_dbg_lock_lock
rust_wait_little_lock
tdefl_compress_mem_to_heap
tinfl_decompress_mem_to_heap
-rust_uv_ip4_port
-rust_uv_ip6_port
-rust_uv_tcp_getpeername
rust_raw_thread_start
rust_raw_thread_join
rust_raw_thread_delete
rust_dbg_extern_return_TwoU64s
rust_dbg_extern_identity_double
rust_dbg_extern_identity_u8
-rust_uv_handle_size
-rust_uv_req_size
-rust_uv_handle_type_max
-rust_uv_req_type_max
-rust_uv_ip4_addrp
-rust_uv_ip6_addrp
-rust_uv_free_ip4_addr
-rust_uv_free_ip6_addr
rust_initialize_rt_tls_key
rust_dbg_next_port
rust_try
rust_take_global_args_lock
rust_drop_global_args_lock
rust_get_test_int
-rust_uv_get_loop_from_getaddrinfo_req
-rust_uv_spawn
-rust_uv_process_kill
-rust_set_stdio_container_flags
-rust_set_stdio_container_fd
-rust_set_stdio_container_stream
-rust_uv_process_pid
-rust_uv_pipe_init
-rust_uv_signal_init
-rust_uv_signal_start
-rust_uv_signal_stop
rust_take_dlerror_lock
rust_drop_dlerror_lock
-rust_uv_pipe_open
-rust_uv_pipe_bind
-rust_uv_pipe_connect
-rust_uv_tty_init
-rust_uv_tty_set_mode
-rust_uv_tty_get_winsize
-rust_uv_guess_handle