mirror of https://github.com/rust-lang/rust.git
Make rustc's own lib directory configurable and change the default to rustlib. Fixes #3319
This commit is contained in:
parent
ea4219f6e5
commit
6abe0ef32e
|
@ -33,7 +33,7 @@
|
|||
# stageN - this is the system root, corresponding to, e.g. /usr
|
||||
# bin - binaries compiled for the host
|
||||
# lib - libraries used by the host compiler
|
||||
# rustc - rustc's own place to organize libraries
|
||||
# rustlib - rustc's own place to organize libraries
|
||||
# $(target) - target-specific artifacts
|
||||
# bin - binaries for target architectures
|
||||
# lib - libraries for target architectures
|
||||
|
@ -415,6 +415,7 @@ export CFG_LLVM_ROOT
|
|||
export CFG_ENABLE_MINGW_CROSS
|
||||
export CFG_PREFIX
|
||||
export CFG_LIBDIR
|
||||
export CFG_RUSTLIBDIR
|
||||
|
||||
######################################################################
|
||||
# Subprograms
|
||||
|
@ -435,7 +436,7 @@ HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
|
|||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR)
|
||||
|
||||
# Destinations of artifacts for target architectures
|
||||
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustc/$(2)
|
||||
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
|
||||
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
|
||||
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/$$(CFG_LIBDIR)
|
||||
|
||||
|
|
|
@ -398,6 +398,7 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
|
|||
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
|
||||
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
||||
valopt libdir "${CFG_PREFIX}/lib" "install libraries"
|
||||
valopt rustlibdir "rustlib" "subdirectory name for rustc's libraries"
|
||||
|
||||
# Validate Options
|
||||
step_msg "validating $CFG_SELF args"
|
||||
|
@ -775,11 +776,16 @@ do
|
|||
make_dir $h/stage$i/test
|
||||
|
||||
# target bin dir
|
||||
make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/bin
|
||||
make_dir $h/stage$i/$CFG_LIBDIR/$CFG_RUSTLIBDIR/$t/bin
|
||||
|
||||
# target lib dir
|
||||
make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/$CFG_LIBDIR
|
||||
make_dir $h/stage$i/$CFG_LIBDIR/$CFG_RUSTLIBDIR/$t/$CFG_LIBDIR
|
||||
done
|
||||
|
||||
# Fix stage0:
|
||||
make_dir $h/stage0/$CFG_LIBDIR/rustc/$t/bin
|
||||
make_dir $h/stage0/$CFG_LIBDIR/rustc/$t/$CFG_LIBDIR
|
||||
|
||||
done
|
||||
|
||||
make_dir $h/test/run-pass
|
||||
|
@ -1031,6 +1037,7 @@ putvar CFG_HOST
|
|||
putvar CFG_TARGET
|
||||
putvar CFG_C_COMPILER
|
||||
putvar CFG_LIBDIR
|
||||
putvar CFG_RUSTLIBDIR
|
||||
putvar CFG_DISABLE_MANAGE_SUBMODULES
|
||||
putvar CFG_ANDROID_CROSS_PATH
|
||||
putvar CFG_MINGW32_CROSS_PATH
|
||||
|
|
|
@ -74,7 +74,7 @@ TB$(1)$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2))
|
|||
TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
|
||||
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
|
||||
PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
|
||||
PTR$(1)$(2) = $$(PREFIX_LIB)/$(CFG_RUSTLIBDIR)/$(1)
|
||||
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
|
||||
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ $(SNAPSHOT_RUSTC_POST_CLEANUP): \
|
|||
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
|
||||
# we generally only pass one argument to this script.
|
||||
ifdef CFG_ENABLE_LOCAL_RUST
|
||||
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT)
|
||||
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) $(CFG_RUSTLIBDIR)
|
||||
else
|
||||
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
|
||||
ifdef CFG_ENABLE_PAX_FLAGS
|
||||
|
|
20
mk/target.mk
20
mk/target.mk
|
@ -59,6 +59,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
|
|||
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
ifeq ($(1),0)
|
||||
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
||||
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
||||
endif
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_RGLOB_$(2)),$$(notdir $$@))
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
|
||||
|
@ -71,6 +75,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
|
|||
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
ifeq ($(1),0)
|
||||
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
||||
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
||||
endif
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_RGLOB_$(2)),$$(notdir $$@))
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
|
||||
|
@ -127,6 +135,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
|
|||
$$(TEXTRALIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
ifeq ($(1),0)
|
||||
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
||||
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
||||
endif
|
||||
$$(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 $$@
|
||||
|
@ -152,6 +164,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
|
|||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
ifeq ($(1),0)
|
||||
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
||||
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
||||
endif
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
|
||||
|
@ -166,6 +182,10 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
|
|||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
|
||||
| $$(TBIN$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
ifeq ($(1),0)
|
||||
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
||||
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
||||
endif
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
|
||||
ifdef CFG_ENABLE_PAX_FLAGS
|
||||
@$$(call E, apply PaX flags: $$@)
|
||||
|
|
|
@ -108,7 +108,7 @@ ifdef CFG_WINDOWSY_$(1)
|
|||
stage2/$$(CFG_LIBDIR), \
|
||||
$$(if $$(findstring stage3,$$(1)), \
|
||||
stage3/$$(CFG_LIBDIR), \
|
||||
)))))/rustc/$$(CFG_BUILD)/$$(CFG_LIBDIR)
|
||||
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/$$(CFG_LIBDIR)
|
||||
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
|
||||
endif
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
TARG_DIR=$1
|
||||
PREFIX=$2
|
||||
RUSTLIBDIR=$3
|
||||
|
||||
LIB_DIR=lib
|
||||
LIB_PREFIX=lib
|
||||
|
@ -43,7 +44,7 @@ if [ -z $TARG_DIR ]; then
|
|||
fi
|
||||
|
||||
cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
|
||||
cp ${PREFIX}/${LIB_DIR}/rustc/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
|
|
|
@ -185,6 +185,7 @@ mod test {
|
|||
use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
|
||||
use back::rpath::{minimize_rpaths, rpaths_to_flags, get_rpath_relative_to_output};
|
||||
use syntax::abi;
|
||||
use metadata::filesearch;
|
||||
|
||||
#[test]
|
||||
fn test_rpaths_to_flags() {
|
||||
|
@ -196,7 +197,9 @@ mod test {
|
|||
fn test_prefix_rpath() {
|
||||
let res = get_install_prefix_rpath("triple");
|
||||
let mut d = Path::new(env!("CFG_PREFIX"));
|
||||
d.push("lib/rustc/triple/lib");
|
||||
d.push("lib");
|
||||
d.push(filesearch::rustlibdir());
|
||||
d.push("triple/lib");
|
||||
debug!("test_prefix_path: {} vs. {}",
|
||||
res,
|
||||
d.display());
|
||||
|
|
|
@ -157,7 +157,7 @@ pub fn relative_target_lib_path(target_triple: &str) -> Path {
|
|||
let dir = libdir();
|
||||
let mut p = Path::new(dir.as_slice());
|
||||
assert!(p.is_relative());
|
||||
p.push("rustc");
|
||||
p.push(rustlibdir());
|
||||
p.push(target_triple);
|
||||
p.push(dir);
|
||||
p
|
||||
|
@ -247,3 +247,9 @@ pub fn rust_path() -> ~[Path] {
|
|||
pub fn libdir() -> ~str {
|
||||
(env!("CFG_LIBDIR")).to_owned()
|
||||
}
|
||||
|
||||
// The name of rustc's own place to organize libraries.
|
||||
// Used to be "rustc", now the default is "rustlib"
|
||||
pub fn rustlibdir() -> ~str {
|
||||
(env!("CFG_RUSTLIBDIR")).to_owned()
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
use extra::workcache;
|
||||
use rustc::driver::session;
|
||||
use rustc::metadata::filesearch::rustlibdir;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
|
||||
|
@ -168,13 +169,13 @@ impl Context {
|
|||
}
|
||||
}
|
||||
|
||||
/// We assume that if ../../rustc exists, then we're running
|
||||
/// We assume that if ../../rustlib exists, then we're running
|
||||
/// rustpkg from a Rust target directory. This is part of a
|
||||
/// kludgy hack used to adjust the sysroot.
|
||||
pub fn in_target(sysroot: &Path) -> bool {
|
||||
debug!("Checking whether {} is in target", sysroot.display());
|
||||
let mut p = sysroot.dir_path();
|
||||
p.set_filename("rustc");
|
||||
p.set_filename(rustlibdir());
|
||||
p.is_dir()
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ use path_util::{target_executable_in_workspace, target_test_in_workspace,
|
|||
built_library_in_workspace, built_executable_in_workspace, target_build_dir,
|
||||
chmod_read_only, platform_library_name};
|
||||
use rustc::back::link::get_cc_prog;
|
||||
use rustc::metadata::filesearch::rust_path;
|
||||
use rustc::metadata::filesearch::{rust_path, libdir, rustlibdir};
|
||||
use rustc::driver::session;
|
||||
use rustc::driver::driver::{build_session, build_session_options, host_triple, optgroups};
|
||||
use syntax::diagnostic;
|
||||
|
@ -220,7 +220,7 @@ fn test_sysroot() -> Path {
|
|||
fn rustpkg_exec() -> Path {
|
||||
// Ugh
|
||||
let first_try = test_sysroot().join_many(
|
||||
[~"lib", ~"rustc", host_triple(), ~"bin", ~"rustpkg"]);
|
||||
[libdir(), rustlibdir(), host_triple(), ~"bin", ~"rustpkg"]);
|
||||
if is_executable(&first_try) {
|
||||
first_try
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue