1
Fork 0

build: Build libraries in the bin directory on win32

This commit is contained in:
Brian Anderson 2012-01-10 17:45:03 -08:00
parent 79d489cedf
commit c00ec5f9c9
5 changed files with 42 additions and 12 deletions

View file

@ -262,6 +262,7 @@ export CFG_HOST_TRIPLE
export CFG_LLVM_ROOT export CFG_LLVM_ROOT
export CFG_ENABLE_MINGW_CROSS export CFG_ENABLE_MINGW_CROSS
export CFG_PREFIX export CFG_PREFIX
export CFG_LIBDIR
###################################################################### ######################################################################
# Subprograms # Subprograms
@ -279,12 +280,22 @@ define SREQ
# Destinations of artifacts for the host compiler # Destinations of artifacts for the host compiler
HROOT$(1)_H_$(3) = $(3)/stage$(1) HROOT$(1)_H_$(3) = $(3)/stage$(1)
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
# FIXME: Temporary hack for moving win32 libs to the bin directory
ifeq ($(1),0)
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
else
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR)
endif
# Destinations of artifacts for target architectures # 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))/rustc/$(2)
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
# FIXME: Temporary hack for moving win32 libs to the bin directory
ifeq ($(1),0)
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
else
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/$$(CFG_LIBDIR)
endif
# The name of the core and standard libraries used by rustc # The name of the core and standard libraries used by rustc
ifdef CFG_DISABLE_SHAREDSTD ifdef CFG_DISABLE_SHAREDSTD

15
configure vendored
View file

@ -397,6 +397,14 @@ do
done done
done done
# On windows we just store the libraries in the bin directory because
# there's no rpath
CFG_LIBDIR=lib
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
then
CFG_LIBDIR=bin
fi
for h in $CFG_TARGET_TRIPLES for h in $CFG_TARGET_TRIPLES
do do
for t in $CFG_TARGET_TRIPLES for t in $CFG_TARGET_TRIPLES
@ -407,13 +415,13 @@ do
make_dir $h/stage$i/bin make_dir $h/stage$i/bin
# host lib dir # host lib dir
make_dir $h/stage$i/lib make_dir $h/stage$i/$CFG_LIBDIR
# target bin dir # target bin dir
make_dir $h/stage$i/lib/rustc/$t/bin make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/bin
# target lib dir # target lib dir
make_dir $h/stage$i/lib/rustc/$t/lib make_dir $h/stage$i/lib/$CFG_LIBDIR/$t/$CFG_LIBDIR
done done
done done
@ -582,6 +590,7 @@ putvar CFG_HOST_TRIPLE
putvar CFG_TARGET_TRIPLES putvar CFG_TARGET_TRIPLES
putvar CFG_C_COMPILER putvar CFG_C_COMPILER
putvar CFG_PREFIX putvar CFG_PREFIX
putvar CFG_LIBDIR
# Setting this again because it may have been changed # Setting this again because it may have been changed
if [ $CFG_DISABLE_MANAGE_SUBMODULES ] if [ $CFG_DISABLE_MANAGE_SUBMODULES ]

View file

@ -108,14 +108,14 @@ endif
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \ CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \
$(if $(findstring stage0,$(1)), \ $(if $(findstring stage0,$(1)), \
stage0/lib, \ stage0/$(CFG_LIBDIR), \
$(if $(findstring stage1,$(1)), \ $(if $(findstring stage1,$(1)), \
stage1/lib, \ stage1/$(CFG_LIBDIR), \
$(if $(findstring stage2,$(1)), \ $(if $(findstring stage2,$(1)), \
stage2/lib, \ stage2/$(CFG_LIBDIR), \
$(if $(findstring stage3,$(1)), \ $(if $(findstring stage3,$(1)), \
stage3/lib, \ stage3/$(CFG_LIBDIR), \
)))))/rustc/$(CFG_HOST_TRIPLE)/lib )))))/rustc/$(CFG_HOST_TRIPLE)/$(CFG_LIBDIR)
ifdef CFG_UNIXY ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment) CFG_INFO := $(info cfg: unix-y environment)

View file

@ -191,7 +191,6 @@ fn minimize_rpaths(rpaths: [str]) -> [str] {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
#[cfg(test)]
mod test { mod test {
#[test] #[test]
fn test_rpaths_to_flags() { fn test_rpaths_to_flags() {

View file

@ -16,6 +16,7 @@ export pick_file;
export search; export search;
export relative_target_lib_path; export relative_target_lib_path;
export get_cargo_root; export get_cargo_root;
export libdir;
type pick<T> = block(path: fs::path) -> option::t<T>; type pick<T> = block(path: fs::path) -> option::t<T>;
@ -80,7 +81,7 @@ fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> option::t<T> {
} }
fn relative_target_lib_path(target_triple: str) -> [fs::path] { fn relative_target_lib_path(target_triple: str) -> [fs::path] {
["lib", "rustc", target_triple, "lib"] [libdir(), "rustc", target_triple, libdir()]
} }
fn make_target_lib_path(sysroot: fs::path, fn make_target_lib_path(sysroot: fs::path,
@ -121,6 +122,16 @@ fn get_cargo_root() -> result::t<fs::path, str> {
fn get_cargo_lib_path() -> result::t<fs::path, str> { fn get_cargo_lib_path() -> result::t<fs::path, str> {
result::chain(get_cargo_root()) { |p| result::chain(get_cargo_root()) { |p|
result::ok(fs::connect(p, "lib")) result::ok(fs::connect(p, libdir()))
} }
} }
// The name of the directory rustc expects libraries to be located.
// On Unix should be "lib", on windows "bin"
fn libdir() -> str {
let libdir = #env("CFG_LIBDIR");
if str::is_empty(libdir) {
fail "rustc compiled without CFG_LIBDIR environment variable";
}
libdir
}