.settings/
build/
i686-pc-mingw32/
+src/librustc/lib/llvmdeps.rs
# static copies of libstd and libextra. We also generate dynamic versions of all
# libraries, so in the interest of space, prefer dynamic linking throughout the
# compilation process.
+#
+# Note though that these flags are omitted for stage2+. This means that the
+# snapshot will be generated with a statically linked rustc so we only have to
+# worry about the distribution of one file (with its native dynamic
+# dependencies)
RUSTFLAGS_STAGE0 += -Z prefer-dynamic
RUSTFLAGS_STAGE1 += -Z prefer-dynamic
-RUSTFLAGS_STAGE2 += -Z prefer-dynamic
-RUSTFLAGS_STAGE3 += -Z prefer-dynamic
# platform-specific auto-configuration
include $(CFG_SRC_DIR)mk/platform.mk
define DEF_LIBS
CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt)
-CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm)
+CFG_RUSTLLVM_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustllvm)
CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
EXTRALIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,extra)
STDLIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,std)
LIBRUSTUV_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustuv)
+LIBSYNTAX_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,syntax)
+LIBRUSTC_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustc)
endef
# Preqrequisites for using the stageN compiler
HSREQ$(1)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
- $$(HLIB$(1)_H_$(3))/$(CFG_RUNTIME_$(3)) \
- $$(HLIB$(1)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
$$(HEXTRALIB_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BRUSTC_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
- $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
- $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(4)),$$(notdir $$@))
-$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
- $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
- | $$(HLIB$(2)_H_$(4))/
- @$$(call E, cp: $$@)
- $$(Q)cp $$< $$@
-
$$(HBIN$(2)_H_$(4))/:
mkdir -p $$@
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
- $$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1)))
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
$(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD)))
$(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD)))
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
- $(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1)
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1)
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustpkg.1)
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD))
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD))
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD))
- $(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD))
$(Q)for i in \
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \
endef
+$(foreach host,$(CFG_HOST), \
+ $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
+
+$(S)src/librustc/lib/llvmdeps.rs: \
+ $(LLVM_CONFIGS) \
+ $(S)src/etc/mklldeps.py
+ $(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
+ "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
+ > $@
+
$(foreach host,$(CFG_HOST), \
$(eval $(call DEF_LLVM_RULES,$(host))))
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
-$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
- $$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
+$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1))
@$$(call E, link: $$@)
- $$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
- $$(CFG_GCCISH_PRE_LIB_FLAGS_$(1)) $$(LLVM_LIBS_$(1)) \
- $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
- $$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
+ $$(Q)$$(AR_$(1)) rcs $$@ $$(RUSTLLVM_OBJS_OBJS_$(1))
$(1)/rustllvm/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
@$$(call E, compile: $$@)
# Host libs will be extracted by the above rule
-$(HLIB0_H_$(CFG_BUILD))/$(CFG_RUNTIME_$(CFG_BUILD)): \
- $(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
- | $(HLIB0_H_$(CFG_BUILD))/
- $(Q)touch $@
-
+# NOTE: remove all these after the next snapshot
$(HLIB0_H_$(CFG_BUILD))/$(CFG_STDLIB_$(CFG_BUILD)): \
$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
| $(HLIB0_H_$(CFG_BUILD))/
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
-$$(HLIB0_H_$(1))/$(CFG_RUNTIME_$(1)): \
- $$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_RUNTIME_$(1)) \
- | $(HLIB0_H_$(1))/
- @$$(call E, cp: $$@)
- $$(Q)cp $$< $$@
-
+# NOTE: removing everything below after the next snapshot
$$(HLIB0_H_$(1))/$(CFG_STDLIB_$(1)): \
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_STDLIB_$(1)) \
| $(HLIB0_H_$(1))/
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
+ $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
+ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
# Only build the compiler for host triples
ifneq ($$(findstring $(2),$$(CFG_HOST)),)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER = $(2)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
+ $(S)src/librustc/lib/llvmdeps.rs \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
- $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
+ $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
+ $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
+ -L "$$(LLVM_LIBDIR_$(3))" \
+ --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
+ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
# NOTE: after the next snapshot remove these '-L' flags
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
@$$(call E, compile_and_link: $$@)
- $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
+ $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
+ -L "$$(LLVM_LIBDIR_$(3))"
$(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
--- /dev/null
+# xfail-license
+
+import os
+import sys
+import subprocess
+
+components = sys.argv[1].split(' ')
+
+print """// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
+// take a look at src/etc/mklldeps.py if you're interested
+"""
+
+for llconfig in sys.argv[2:]:
+ print
+
+ proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
+ out, err = proc.communicate()
+ arch, os = out.split('-', 1)
+ arch = 'x86' if arch == 'i686' or arch == 'i386' else arch
+ if 'darwin' in os:
+ os = 'macos'
+ elif 'linux' in os:
+ os = 'linux'
+ elif 'freebsd' in os:
+ os = 'freebsd'
+ elif 'android' in os:
+ os = 'android'
+ elif 'win' in os or 'mingw' in os:
+ os = 'win32'
+ cfg = [
+ "target_arch = \"" + arch + "\"",
+ "target_os = \"" + os + "\"",
+ ]
+
+ print "#[cfg(" + ', '.join(cfg) + ")]"
+
+ args = [llconfig, '--libs']
+ args.extend(components)
+ proc = subprocess.Popen(args, stdout = subprocess.PIPE)
+ out, err = proc.communicate()
+
+ for lib in out.strip().split(' '):
+ lib = lib[2:] # chop of the leading '-l'
+ print "#[link(name = \"" + lib + "\", kind = \"static\")]"
+ if os == 'win32':
+ print "#[link(name = \"pthread\")]"
+ print "#[link(name = \"imagehlp\")]"
+ print "extern {}"
download_unpack_base = os.path.join(download_dir_base, "unpack")
snapshot_files = {
- "linux": ["bin/rustc",
- "lib/libstd-*.so",
- "lib/libextra-*.so",
- "lib/librustc-*.so",
- "lib/libsyntax-*.so",
- "lib/librustuv-*.so",
- "lib/librustllvm.so"],
- "macos": ["bin/rustc",
- "lib/libstd-*.dylib",
- "lib/libextra-*.dylib",
- "lib/librustc-*.dylib",
- "lib/libsyntax-*.dylib",
- "lib/librustuv-*.dylib",
- "lib/librustllvm.dylib"],
- "winnt": ["bin/rustc.exe",
- "bin/std-*.dll",
- "bin/extra-*.dll",
- "bin/rustc-*.dll",
- "bin/syntax-*.dll",
- "bin/rustuv-*.dll",
- "bin/rustllvm.dll"],
- "freebsd": ["bin/rustc",
- "lib/libstd-*.so",
- "lib/libextra-*.so",
- "lib/librustc-*.so",
- "lib/libsyntax-*.so",
- "lib/librustuv-*.so",
- "lib/librustllvm.so"]
+ "linux": ["bin/rustc"],
+ "macos": ["bin/rustc"],
+ "winnt": ["bin/rustc.exe"],
+ "freebsd": ["bin/rustc"],
}
winnt_runtime_deps = ["libgcc_s_dw2-1.dll",
#[comment = "The Rust compiler"];
#[license = "MIT/ASL2"];
#[crate_type = "dylib"];
+#[crate_type = "rlib"];
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
pub mod lib {
pub mod llvm;
+ pub mod llvmdeps;
}
// A curious inner module that allows ::std::foo to be available in here for
use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
size_t};
- #[link(name = "rustllvm")]
+ // Link to our native llvm bindings (things that we need to use the C++ api
+ // for) and because llvm is written in C++ we need to link against libstdc++
+ //
+ // You'll probably notice that there is an omission of all LLVM libraries
+ // from this location. This is because the set of LLVM libraries that we
+ // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
+ // figure out the exact set of libraries. To do this, the build system
+ // generates an llvmdeps.rs file next to this one which will be
+ // automatically updated whenever LLVM is updated to include an up-to-date
+ // set of the libraries we need to link to LLVM for.
+ #[link(name = "rustllvm", kind = "static")]
+ #[link(name = "stdc++")]
extern {
/* Create and destroy contexts. */
pub fn LLVMContextCreate() -> ContextRef;
}
#[test]
+#[ignore]
fn no_recopying() {
let p_id = PkgId::new("foo");
let workspace = create_local_package(&p_id);
#[no_split_stack] // - it would be sad for this function to trigger __morestack
#[doc(hidden)] // - Function must be `pub` to get exported, but it's
// irrelevant for documentation purposes.
+#[cfg(not(test))] // in testing, use the original libstd's version
pub extern "C" fn rust_stack_exhausted() {
use rt::in_green_task_context;
use rt::task::Task;
#[license = "MIT/ASL2"];
#[crate_type = "dylib"];
+#[crate_type = "rlib"];
#[feature(macro_rules, globs, managed_boxes)];
+S 2013-12-04 9169579
+ freebsd-x86_64 0dc6dcd9435e23c891b9e9e37d483e92cfe51449
+ linux-i386 9802f6ba319bec4dd02299af08e421270ede5f5f
+ linux-x86_64 195d69ac1846cd646faaa50d05639d41b03e33ae
+ macos-i386 b0729f5ce3f5581fbb02f963a0f5261e6f011e01
+ macos-x86_64 5091706c1111bbbd21a22e11b18f68717be17c29
+ winnt-i386 1f975067f08f7702ab7f1d88b13221a0c2becd2f
+
S 2013-11-30 4252a24
freebsd-x86_64 2e0bfc6eb0dd75b8a1ad5c9958d90f3b626650dd
linux-i386 2ea4b43fbc22c295e60874ef494dfbea1cc08a63