From 23e0d16b5fd259dc252b220777f164f1e2eb9c30 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 10 Jan 2012 17:45:03 -0800 Subject: [PATCH 1/2] build: Build libraries in the bin directory on win32 --- Makefile.in | 10 ++++++++++ configure | 21 ++++++++++++++++++--- mk/platform.mk | 10 +++++----- src/comp/back/rpath.rs | 1 - src/comp/util/filesearch.rs | 17 ++++++++++++++--- src/etc/snapshot.py | 10 +++++----- 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index 34d5f59fdc6..804eb28309c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -262,6 +262,7 @@ export CFG_HOST_TRIPLE export CFG_LLVM_ROOT export CFG_ENABLE_MINGW_CROSS export CFG_PREFIX +export CFG_LIBDIR ###################################################################### # Subprograms @@ -279,12 +280,21 @@ define SREQ # Destinations of artifacts for the host compiler HROOT$(1)_H_$(3) = $(3)/stage$(1) 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 +else +HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR) +endif # Destinations of artifacts for target architectures 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 +ifeq ($(1),0) 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 ifdef CFG_DISABLE_SHAREDSTD diff --git a/configure b/configure index d0d86973377..815c3fdd0a8 100755 --- a/configure +++ b/configure @@ -397,6 +397,14 @@ do 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 do for t in $CFG_TARGET_TRIPLES @@ -407,13 +415,19 @@ do make_dir $h/stage$i/bin # host lib dir - make_dir $h/stage$i/lib + make_dir $h/stage$i/$CFG_LIBDIR + # FIXME: Transitional. remove + make_dir $h/stage$i/lib # target bin dir - make_dir $h/stage$i/lib/rustc/$t/bin + make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/bin + # FIXME: Transitional. remove + make_dir $h/stage$i/lib/rustc/$t/bin # target lib dir - make_dir $h/stage$i/lib/rustc/$t/lib + make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/$CFG_LIBDIR + # FIXME: Transitional. remove + make_dir $h/stage$i/lib/rustc/$t/lib done done @@ -582,6 +596,7 @@ putvar CFG_HOST_TRIPLE putvar CFG_TARGET_TRIPLES putvar CFG_C_COMPILER putvar CFG_PREFIX +putvar CFG_LIBDIR # Setting this again because it may have been changed if [ $CFG_DISABLE_MANAGE_SUBMODULES ] diff --git a/mk/platform.mk b/mk/platform.mk index 40a3dd8ebc6..3d070724abc 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -108,14 +108,14 @@ endif CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \ $(if $(findstring stage0,$(1)), \ - stage0/lib, \ + stage0/$(CFG_LIBDIR), \ $(if $(findstring stage1,$(1)), \ - stage1/lib, \ + stage1/$(CFG_LIBDIR), \ $(if $(findstring stage2,$(1)), \ - stage2/lib, \ + stage2/$(CFG_LIBDIR), \ $(if $(findstring stage3,$(1)), \ - stage3/lib, \ - )))))/rustc/$(CFG_HOST_TRIPLE)/lib + stage3/$(CFG_LIBDIR), \ + )))))/rustc/$(CFG_HOST_TRIPLE)/$(CFG_LIBDIR) ifdef CFG_UNIXY CFG_INFO := $(info cfg: unix-y environment) diff --git a/src/comp/back/rpath.rs b/src/comp/back/rpath.rs index 16b0c62bf05..417d553c36a 100644 --- a/src/comp/back/rpath.rs +++ b/src/comp/back/rpath.rs @@ -191,7 +191,6 @@ fn minimize_rpaths(rpaths: [str]) -> [str] { #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] -#[cfg(test)] mod test { #[test] fn test_rpaths_to_flags() { diff --git a/src/comp/util/filesearch.rs b/src/comp/util/filesearch.rs index e030ddeed40..d2dd2fc502c 100644 --- a/src/comp/util/filesearch.rs +++ b/src/comp/util/filesearch.rs @@ -16,6 +16,7 @@ export pick_file; export search; export relative_target_lib_path; export get_cargo_root; +export libdir; type pick = block(path: fs::path) -> option::t; @@ -80,7 +81,7 @@ fn search(filesearch: filesearch, pick: pick) -> option::t { } 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, @@ -121,6 +122,16 @@ fn get_cargo_root() -> result::t { fn get_cargo_lib_path() -> result::t { result::chain(get_cargo_root()) { |p| - result::ok(fs::connect(p, "lib")) + result::ok(fs::connect(p, libdir())) } -} \ No newline at end of file +} + +// 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 +} diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 673facfe70a..48e5e0bfd02 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -29,11 +29,11 @@ snapshot_files = { "lib/librustrt.dylib", "lib/librustllvm.dylib"], "winnt": ["bin/rustc.exe", - "lib/core-*.dll", - "lib/std-*.dll", - "lib/rustc-*.dll", - "lib/rustrt.dll", - "lib/rustllvm.dll"], + "bin/core-*.dll", + "bin/std-*.dll", + "bin/rustc-*.dll", + "bin/rustrt.dll", + "bin/rustllvm.dll"], "freebsd": ["bin/rustc", "lib/libcore-*.so", "lib/libstd-*.so", From 17d504e0a9bce9d341a85ebbf080b769887cb5c9 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 12 Jan 2012 17:16:31 -0800 Subject: [PATCH 2/2] Register snapshots --- Makefile.in | 9 --------- configure | 6 ------ src/snapshots.txt | 7 +++++++ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index 804eb28309c..593f04a2f9c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -280,21 +280,12 @@ define SREQ # Destinations of artifacts for the host compiler HROOT$(1)_H_$(3) = $(3)/stage$(1) 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 -else HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR) -endif # Destinations of artifacts for target architectures 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 -ifeq ($(1),0) -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 ifdef CFG_DISABLE_SHAREDSTD diff --git a/configure b/configure index 815c3fdd0a8..7717d07570b 100755 --- a/configure +++ b/configure @@ -416,18 +416,12 @@ do # host lib dir make_dir $h/stage$i/$CFG_LIBDIR - # FIXME: Transitional. remove - make_dir $h/stage$i/lib # target bin dir make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/bin - # FIXME: Transitional. remove - make_dir $h/stage$i/lib/rustc/$t/bin # target lib dir make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/$CFG_LIBDIR - # FIXME: Transitional. remove - make_dir $h/stage$i/lib/rustc/$t/lib done done diff --git a/src/snapshots.txt b/src/snapshots.txt index add74ee17b4..2849fec43be 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,10 @@ +S 2012-01-12 23e0d16 + winnt-i386 3d21b0cddbfd086afaf6632b2458d8457422ff62 + linux-i386 bb6b05e0e91ae51d696ebce299a45f89babccdee + macos-i386 9e835b370db42b480eafab4f8365028f1c5a5197 + linux-x86_64 e9372901737124fe6b776101f0877cc13c86252f + macos-x86_64 550d9a1b0fb30e5fc296a833682db15088a6c803 + S 2012-01-12 44352df winnt-i386 fcb87845b0c80b1fa8b798d319a1bd4aaeaa91d1 linux-x86_64 dc84514290cafab43d0e79387931d6c79129b5ac