update rust, refresh patches

This commit is contained in:
Cody P Schafer
2014-11-24 13:24:26 -05:00
parent 11458ff390
commit 20c591806e
22 changed files with 536 additions and 1911 deletions
@@ -1,14 +1,14 @@
From fead6879b81ca4a15116a572ae286a6cb0b071c0 Mon Sep 17 00:00:00 2001 From 6f38f72d23da25ef620e8042735fb7e2913d7d8f Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com> From: Cody P Schafer <dev@codyps.com>
Date: Sat, 15 Nov 2014 20:12:48 -0500 Date: Sat, 15 Nov 2014 20:12:48 -0500
Subject: [PATCH] platform.mk: avoid choking on i586 Subject: [PATCH 1/8] platform.mk: avoid choking on i586
--- ---
mk/platform.mk | 4 +++- mk/platform.mk | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-) 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mk/platform.mk b/mk/platform.mk diff --git a/mk/platform.mk b/mk/platform.mk
index 6da01ef..ee83f66 100644 index 7ca2473..cc69851 100644
--- a/mk/platform.mk --- a/mk/platform.mk
+++ b/mk/platform.mk +++ b/mk/platform.mk
@@ -14,7 +14,9 @@ @@ -14,7 +14,9 @@
@@ -23,5 +23,5 @@ index 6da01ef..ee83f66 100644
$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t)))) $(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t))))
$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t)))) $(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t))))
-- --
2.0.4 2.1.3
@@ -1,14 +1,15 @@
From 00dc8106736c6533410fdec0ff0d06fae6ecb18b Mon Sep 17 00:00:00 2001 From 3eee2b4c16d34809e106f352d1773e8c3640c8e7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com> From: Cody P Schafer <dev@codyps.com>
Date: Mon, 17 Nov 2014 16:14:15 -0500 Date: Mon, 17 Nov 2014 16:14:15 -0500
Subject: [PATCH] mk/rt/compiler_rt: pass LDFLAGS from CFG_GCCISH_LINK_FLAGS Subject: [PATCH 2/8] mk/rt/compiler_rt: pass LDFLAGS from
CFG_GCCISH_LINK_FLAGS
--- ---
mk/rt.mk | 1 + mk/rt.mk | 1 +
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
diff --git a/mk/rt.mk b/mk/rt.mk diff --git a/mk/rt.mk b/mk/rt.mk
index 7204808..0ef0786 100644 index 38aec83..fefb7da 100644
--- a/mk/rt.mk --- a/mk/rt.mk
+++ b/mk/rt.mk +++ b/mk/rt.mk
@@ -231,6 +231,7 @@ $$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS) @@ -231,6 +231,7 @@ $$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
@@ -1,7 +1,8 @@
From 302d94ff44c5a6bda5a40fa02304d583cc1a73b5 Mon Sep 17 00:00:00 2001 From 1a42cfe068a84c0bfcd4638146999d73cf16e447 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com> From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 01:40:21 -0500 Date: Tue, 18 Nov 2014 01:40:21 -0500
Subject: [PATCH] Target: add default target.json path: $libdir/rust/targets Subject: [PATCH 3/8] Target: add default target.json path:
$libdir/rust/targets
--- ---
src/librustc/session/config.rs | 4 ++-- src/librustc/session/config.rs | 4 ++--
@@ -42,7 +43,7 @@ index 72a9f23..d6ccae7 100644
let default_sysroot = match sopts.maybe_sysroot { let default_sysroot = match sopts.maybe_sysroot {
Some(_) => None, Some(_) => None,
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index d7b4285..af9d7b1 100644 index 68a80ed..f94a802 100644
--- a/src/librustc_back/target/mod.rs --- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs
@@ -291,7 +291,7 @@ impl Target { @@ -291,7 +291,7 @@ impl Target {
@@ -66,5 +67,5 @@ index d7b4285..af9d7b1 100644
for dir in paths.iter() { for dir in paths.iter() {
let p = dir.join(path.clone()); let p = dir.join(path.clone());
-- --
2.0.4 2.1.3
@@ -1,39 +1,36 @@
From 1cac153be4b71e97ec61c894c3681e803a17f985 Mon Sep 17 00:00:00 2001 From ccc6d1e9039f99e818a9396fc9cf178ba3e9f241 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com> From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:52:56 -0500 Date: Tue, 18 Nov 2014 14:52:56 -0500
Subject: [PATCH 56/62] mk: always use bin as bindir for stage0 CFG_BUILD and Subject: [PATCH 4/8] mk: for stage0, use RUSTFLAGS to override target libs dir
pass it an -L to the TLIB dir
We can't trust stage0 rustc to actually know where our libdir is, so we Setting HLIB specially for stage0 (and even more specially for windows)
need to pass it the location explicitly. also affects the location we place TLIB. To keep the TLIBs we build in
the place requested by configure, use '-L' and '--sysroot' to point
bin is always used as the bindir because that is where it is extracted stage0-rustc at the appropriate location.
to by the downloader (could be changed in the future if we're inclined)
--- ---
mk/main.mk | 19 +++++++++++++++++++ mk/main.mk | 19 +++++++++++--------
1 file changed, 19 insertions(+) 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk diff --git a/mk/main.mk b/mk/main.mk
index 0fb6f5f..2e6c6c8 100644 index a9a99f1..d81a804 100644
--- a/mk/main.mk --- a/mk/main.mk
+++ b/mk/main.mk +++ b/mk/main.mk
@@ -333,7 +333,15 @@ define SREQ @@ -335,21 +335,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
+ifeq ($(1)-$(3),0-$$(CFG_BUILD)) -ifeq ($$(CFG_WINDOWSY_$(3)),1)
+# stage0 relative paths are fixed so we can bootstrap from snapshots -HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
+# (downloaded snapshots drop their rustc in HROOT/bin) -else
+# libdir discrepancy is worked around with RUSTFLAGS below. -ifeq ($(1),0)
+HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin -HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
+else -else
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE)
+endif
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
-endif
-endif
# Destinations of artifacts for target architectures # Destinations of artifacts for target architectures
@@ -341,6 +349,15 @@ TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(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
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
@@ -49,7 +46,7 @@ index 0fb6f5f..2e6c6c8 100644
# Preqrequisites for using the stageN compiler # Preqrequisites for using the stageN compiler
ifeq ($(1),0) ifeq ($(1),0)
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
@@ -450,6 +467,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \ @@ -459,6 +460,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
@@ -57,7 +54,7 @@ index 0fb6f5f..2e6c6c8 100644
$$(RUSTC_FLAGS_$(2)) $$(RUSTC_FLAGS_$(2))
PERF_STAGE$(1)_T_$(2)_H_$(3) := \ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
@@ -458,6 +476,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \ @@ -467,6 +469,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
@@ -66,5 +63,5 @@ index 0fb6f5f..2e6c6c8 100644
endef endef
-- --
2.0.4 2.1.3
@@ -1,14 +1,14 @@
From 6c66b1d90457ef8cf6b6ef73301c5f74f1e41d7d Mon Sep 17 00:00:00 2001 From c6d434f21555bb954ed309227a07356ecab6d013 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com> From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:48:14 -0500 Date: Tue, 18 Nov 2014 13:48:14 -0500
Subject: [PATCH 53/62] mk: add missing CFG_LIBDIR_RELATIVE Subject: [PATCH 5/8] mk: add missing CFG_LIBDIR_RELATIVE
--- ---
mk/grammar.mk | 4 ++-- mk/grammar.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mk/grammar.mk b/mk/grammar.mk diff --git a/mk/grammar.mk b/mk/grammar.mk
index 12190fb..dcebabf 100644 index a9f4590..d254941 100644
--- a/mk/grammar.mk --- a/mk/grammar.mk
+++ b/mk/grammar.mk +++ b/mk/grammar.mk
@@ -11,8 +11,8 @@ @@ -11,8 +11,8 @@
@@ -23,5 +23,5 @@ index 12190fb..dcebabf 100644
# Run the reference lexer against libsyntax and compare the tokens and spans. # Run the reference lexer against libsyntax and compare the tokens and spans.
-- --
2.0.4 2.1.3
@@ -0,0 +1,424 @@
From 8b13875744911f55b46d2ded522c3644d773fc2c Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 24 Nov 2014 13:10:15 -0500
Subject: [PATCH 6/8] configure: support --bindir, and extend libdir to
non-blessed dirs
Adds --bindir, and:
Allows --bindir and --libdir to have multiple elements in their paths
relative to sysroot, and allows libdir to end in an arbitrary directory
(previously it was limited to lib, lib32, and lib64).
Note that this adds the requirement of the 'realpath' tool
---
configure | 10 +++++
mk/host.mk | 6 ++-
mk/install.mk | 4 +-
mk/main.mk | 11 ++++++
mk/perf.mk | 4 +-
mk/prepare.mk | 4 +-
src/etc/install.sh | 29 +++++++++++---
src/librustc/metadata/filesearch.rs | 78 ++++++++++++++-----------------------
src/librustc_trans/back/link.rs | 3 +-
9 files changed, 85 insertions(+), 64 deletions(-)
diff --git a/configure b/configure
index 5ac3982..4176631 100755
--- a/configure
+++ b/configure
@@ -340,6 +340,7 @@ need_cmd date
need_cmd tr
need_cmd sed
need_cmd file
+need_cmd realpath
msg "inspecting environment"
@@ -568,12 +569,20 @@ if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] && [ "$CFG_LIBDIR_RELATIVE" != "bin" ];
err "libdir on windows should be set to 'bin'"
fi
+CFG_BINDIR_RELATIVE=bin
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
+
if [ $HELP -eq 1 ]
then
echo
exit 0
fi
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+
# Validate Options
step_msg "validating $CFG_SELF args"
validate_opt
@@ -1334,6 +1343,7 @@ putvar CFG_PREFIX
putvar CFG_HOST
putvar CFG_TARGET
putvar CFG_LIBDIR_RELATIVE
+putvar CFG_BINDIR_RELATIVE
putvar CFG_DISABLE_MANAGE_SUBMODULES
putvar CFG_ANDROID_CROSS_PATH
putvar CFG_MANDIR
diff --git a/mk/host.mk b/mk/host.mk
index 59a0095..b8e8345 100644
--- a/mk/host.mk
+++ b/mk/host.mk
@@ -59,9 +59,13 @@ endef
# $(4) - the host triple (same as $(3))
define CP_HOST_STAGE_N
-ifneq ($(CFG_LIBDIR_RELATIVE),bin)
$$(HLIB$(2)_H_$(4))/:
@mkdir -p $$@
+
+# Avoid redefinition warnings if libdir==bindir
+ifneq ($(HBIN$(2)_H_$(4)),$(HLIB$(2)_H_$(4)))
+$$(HBIN$(2)_H_$(4))/:
+ @mkdir -p $$@
endif
endef
diff --git a/mk/install.mk b/mk/install.mk
index 88b451f..0fba6ee 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -21,7 +21,7 @@ ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
else
$(Q)$(MAKE) prepare_install
endif
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --bindir="$(DESTDIR)$(CFG_BINDIR)" "$(MAYBE_DISABLE_VERIFY)"
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -34,7 +34,7 @@ ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
else
$(Q)$(MAKE) prepare_uninstall
endif
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --bindir="$(DESTDIR)$(CFG_BINDIR)"
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
diff --git a/mk/main.mk b/mk/main.mk
index d81a804..128f956 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -318,7 +318,9 @@ export CFG_BUILD
export CFG_LLVM_ROOT
export CFG_PREFIX
export CFG_LIBDIR
+export CFG_BINDIR
export CFG_LIBDIR_RELATIVE
+export CFG_BINDIR_RELATIVE
export CFG_DISABLE_INJECT_STD_VERSION
######################################################################
@@ -334,7 +336,16 @@ define SREQ
# Destinations of artifacts for the host compiler
HROOT$(1)_H_$(3) = $(3)/stage$(1)
+
+ifeq ($(1)-$(3),0-$$(CFG_BUILD))
+# stage0 relative paths are fixed so we can bootstrap from snapshots
+# (downloaded snapshots drop their rustc in HROOT/bin)
+# libdir discrepancy is worked around with RUSTFLAGS below.
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
+else
+HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE)
+endif
+
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
# Destinations of artifacts for target architectures
diff --git a/mk/perf.mk b/mk/perf.mk
index 16cbaab..f8a354c 100644
--- a/mk/perf.mk
+++ b/mk/perf.mk
@@ -10,13 +10,13 @@
ifdef CFG_PERF_TOOL
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
@$(call E, perf compile: $@)
$(PERF_STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
-o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1
$(Q)rm -f $(LIBRUSTC_GLOB)
else
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
$(Q)touch $@
endif
diff --git a/mk/prepare.mk b/mk/prepare.mk
index 7df2489..842078f 100644
--- a/mk/prepare.mk
+++ b/mk/prepare.mk
@@ -147,10 +147,10 @@ endef
define DEF_PREPARE
prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
-prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/bin
+prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_BINDIR_RELATIVE)
prepare-base-$(1): PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_SOURCE_MAN_DIR=$$(S)/man
-prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
+prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_BINDIR_RELATIVE)
prepare-base-$(1): PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
prepare-base-$(1): prepare-everything-$(1)
diff --git a/src/etc/install.sh b/src/etc/install.sh
index 8bc48fc..e524510 100644
--- a/src/etc/install.sh
+++ b/src/etc/install.sh
@@ -213,6 +213,7 @@ need_cmd grep
need_cmd uname
need_cmd tr
need_cmd sed
+need_cmd realpath
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)"
CFG_SELF="$0"
@@ -285,6 +286,8 @@ then
CFG_LIBDIR_RELATIVE=bin
fi
+CFG_BINDIR_RELATIVE=bin
+
if [ "$CFG_OSTYPE" = "pc-mingw32" ] || [ "$CFG_OSTYPE" = "w64-mingw32" ]
then
CFG_LD_PATH_VAR=PATH
@@ -311,6 +314,7 @@ case "$CFG_LIBDIR" in
esac
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
if [ $HELP -eq 1 ]
@@ -319,6 +323,11 @@ then
exit 0
fi
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+
step_msg "validating $CFG_SELF args"
validate_opt
@@ -332,8 +341,8 @@ then
if [ -z "${CFG_UNINSTALL}" ]
then
msg "verifying platform can run binaries"
- export $CFG_LD_PATH_VAR="${CFG_SRC_DIR}/lib:$CFG_OLD_LD_PATH_VAR"
- "${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
+ export $CFG_LD_PATH_VAR="${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}:$CFG_OLD_LD_PATH_VAR"
+ "${CFG_SRC_DIR}/${CFG_BINDIR_RELATIVE}/rustc" --version > /dev/null
if [ $? -ne 0 ]
then
err "can't execute rustc binary on this platform"
@@ -431,6 +440,7 @@ need_ok "failed to create installed manifest"
# Now install, iterate through the new manifest and copy files
while read p; do
+ is_bin=false
# Decide the destination of the file
FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
@@ -441,6 +451,13 @@ while read p; do
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
fi
+ if echo "$p" | grep "^${CFG_BINDIR_RELATIVE}/" > /dev/null
+ then
+ is_bin=true
+ pp=`echo $p | sed 's;^'${CFG_BINDIR_RELATIVE}'/;;'`
+ FILE_INSTALL_PATH="${CFG_BINDIR}/$pp"
+ fi
+
if echo "$p" | grep "^share/man/" > /dev/null
then
pp=`echo $p | sed 's/^share\/man\///'`
@@ -458,7 +475,7 @@ while read p; do
# Install the file
msg "${FILE_INSTALL_PATH}"
- if echo "$p" | grep "^bin/" > /dev/null
+ if $is_bin
then
install -m755 "${CFG_SRC_DIR}/$p" "${FILE_INSTALL_PATH}"
else
@@ -493,11 +510,11 @@ fi
if [ -z "${CFG_DISABLE_VERIFY}" ]
then
msg "verifying installed binaries are executable"
- "${CFG_PREFIX}/bin/rustc" --version 2> /dev/null 1> /dev/null
+ "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}/rustc" --version 2> /dev/null 1> /dev/null
if [ $? -ne 0 ]
then
- export $CFG_LD_PATH_VAR="${CFG_PREFIX}/lib:$CFG_OLD_LD_PATH_VAR"
- "${CFG_PREFIX}/bin/rustc" --version > /dev/null
+ export $CFG_LD_PATH_VAR="${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}:$CFG_OLD_LD_PATH_VAR"
+ "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}/rustc" --version > /dev/null
if [ $? -ne 0 ]
then
ERR="can't execute installed rustc binary. "
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 89f3343..b626308 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -66,8 +66,7 @@ impl<'a> FileSearch<'a> {
if !found {
let rustpath = rust_path();
for path in rustpath.iter() {
- let tlib_path = make_rustpkg_lib_path(
- self.sysroot, path, self.triple);
+ let tlib_path = make_rustpkg_lib_path(path, self.triple);
debug!("is {} in visited_dirs? {}", tlib_path.display(),
visited_dirs.contains(&tlib_path.as_vec().to_vec()));
@@ -149,7 +148,7 @@ impl<'a> FileSearch<'a> {
// Returns a list of directories where target-specific tool binaries are located.
pub fn get_tools_search_paths(&self) -> Vec<Path> {
let mut p = Path::new(self.sysroot);
- p.push(find_libdir(self.sysroot));
+ p.push(libdir_str());
p.push(rustlibdir());
p.push(self.triple);
p.push("bin");
@@ -157,8 +156,8 @@ impl<'a> FileSearch<'a> {
}
}
-pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> Path {
- let mut p = Path::new(find_libdir(sysroot));
+pub fn relative_target_lib_path(target_triple: &str) -> Path {
+ let mut p = Path::new(libdir_str());
assert!(p.is_relative());
p.push(rustlibdir());
p.push(target_triple);
@@ -168,17 +167,24 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> Path {
fn make_target_lib_path(sysroot: &Path,
target_triple: &str) -> Path {
- sysroot.join(&relative_target_lib_path(sysroot, target_triple))
+ sysroot.join(&relative_target_lib_path(target_triple))
}
-fn make_rustpkg_lib_path(sysroot: &Path,
- dir: &Path,
+fn make_rustpkg_lib_path(dir: &Path,
triple: &str) -> Path {
- let mut p = dir.join(find_libdir(sysroot));
+ let mut p = dir.join(libdir_str());
p.push(triple);
p
}
+pub fn bindir_relative_str() -> &'static str {
+ env!("CFG_BINDIR_RELATIVE")
+}
+
+pub fn bindir_relative_path() -> Path {
+ Path::new(bindir_relative_str())
+}
+
pub fn get_or_default_sysroot() -> Path {
// Follow symlinks. If the resolved path is relative, make it absolute.
fn canonicalize(path: Option<Path>) -> Option<Path> {
@@ -190,7 +196,17 @@ pub fn get_or_default_sysroot() -> Path {
}
match canonicalize(os::self_exe_name()) {
- Some(mut p) => { p.pop(); p.pop(); p }
+ Some(mut p) => {
+ // Remove the exe name
+ p.pop();
+ let mut rel = bindir_relative_path();
+ // Remove a number of elements equal to the number of elements in the bindir relative
+ // path
+ while rel.pop() {
+ p.pop();
+ }
+ p
+ }
None => panic!("can't determine value for sysroot")
}
}
@@ -248,45 +264,9 @@ pub fn rust_path() -> Vec<Path> {
env_rust_path
}
-// The name of the directory rustc expects libraries to be located.
-// On Unix should be "lib", on windows "bin"
-#[cfg(unix)]
-fn find_libdir(sysroot: &Path) -> String {
- // FIXME: This is a quick hack to make the rustc binary able to locate
- // Rust libraries in Linux environments where libraries might be installed
- // to lib64/lib32. This would be more foolproof by basing the sysroot off
- // of the directory where librustc is located, rather than where the rustc
- // binary is.
- //If --libdir is set during configuration to the value other than
- // "lib" (i.e. non-default), this value is used (see issue #16552).
-
- match option_env!("CFG_LIBDIR_RELATIVE") {
- Some(libdir) if libdir != "lib" => return libdir.to_string(),
- _ => if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() {
- return primary_libdir_name();
- } else {
- return secondary_libdir_name();
- }
- }
-
- #[cfg(target_word_size = "64")]
- fn primary_libdir_name() -> String {
- "lib64".to_string()
- }
-
- #[cfg(target_word_size = "32")]
- fn primary_libdir_name() -> String {
- "lib32".to_string()
- }
-
- fn secondary_libdir_name() -> String {
- "lib".to_string()
- }
-}
-
-#[cfg(windows)]
-fn find_libdir(_sysroot: &Path) -> String {
- "bin".to_string()
+// The name of the directory rustc expects libraries to be located, relative to the sysroot
+fn libdir_str() -> &'static str {
+ env!("CFG_LIBDIR_RELATIVE")
}
// The name of rustc's own place to organize libraries.
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 3715256..efa7ed4 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -1014,11 +1014,10 @@ fn link_args(cmd: &mut Command,
// where extern libraries might live, based on the
// addl_lib_search_paths
if sess.opts.cg.rpath {
- let sysroot = sess.sysroot();
let target_triple = sess.opts.target_triple.as_slice();
let get_install_prefix_lib_path = || {
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
- let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
+ let tlib = filesearch::relative_target_lib_path(target_triple);
let mut path = Path::new(install_prefix);
path.push(&tlib);
--
2.1.3
@@ -0,0 +1,32 @@
From 4be83a87f1cfe8a23b84216d5282bf8fb075c07d Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 24 Nov 2014 13:20:57 -0500
Subject: [PATCH 7/8] XXX: remove conflicting realpath hack
---
configure | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/configure b/configure
index 4176631..0b3486e 100755
--- a/configure
+++ b/configure
@@ -556,15 +556,6 @@ fi
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)"
-case "$CFG_LIBDIR" in
- "$CFG_PREFIX"/*) CAT_INC=2;;
- "$CFG_PREFIX"*) CAT_INC=1;;
- *)
- err "libdir must begin with the prefix. Use --prefix to set it accordingly.";;
-esac
-
-CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
-
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then
err "libdir on windows should be set to 'bin'"
fi
--
2.1.3
@@ -0,0 +1,27 @@
From f8b2de1317f15f72b52f4b8e265b20df05081b9a Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 24 Nov 2014 13:22:43 -0500
Subject: [PATCH 8/8] XXX: configure: unneeded windows check
---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 0b3486e..931c1bf 100755
--- a/configure
+++ b/configure
@@ -556,8 +556,8 @@ fi
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)"
-if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then
- err "libdir on windows should be set to 'bin'"
+if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] && [ "$CFG_LIBDIR_RELATIVE" != "$CFG_BINDIR_RELATIVE" ]; then
+ err "Windows builds currently require that LIBDIR == BINDIR (we have libdir{$CFG_LIBDIR_RELATIVE} != bindir{$CFG_BINDIR_RELATIVE} )"
fi
CFG_BINDIR_RELATIVE=bin
--
2.1.3
@@ -1,125 +0,0 @@
From 7059bccadb5cdf560f1c060ed3f785fe935ad68d Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 17 Nov 2014 19:44:58 -0500
Subject: [PATCH 50/62] Support --bindir
---
configure | 4 ++++
mk/install.mk | 4 ++--
mk/main.mk | 2 ++
src/etc/install.sh | 13 ++++++++++++-
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 7790025..bdfeedd 100755
--- a/configure
+++ b/configure
@@ -554,6 +554,9 @@ fi
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
+CFG_BINDIR_RELATIVE=bin
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
+
if [ $HELP -eq 1 ]
then
echo
@@ -1312,6 +1315,7 @@ putvar CFG_PREFIX
putvar CFG_HOST
putvar CFG_TARGET
putvar CFG_LIBDIR_RELATIVE
+putvar CFG_BINDIR_RELATIVE
putvar CFG_DISABLE_MANAGE_SUBMODULES
putvar CFG_ANDROID_CROSS_PATH
putvar CFG_MANDIR
diff --git a/mk/install.mk b/mk/install.mk
index 88b451f..4588e83 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -21,7 +21,7 @@ ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
else
$(Q)$(MAKE) prepare_install
endif
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --bindir="$(DESTDIR)$(CFG_BINDIR)"
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -34,7 +34,7 @@ ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
else
$(Q)$(MAKE) prepare_uninstall
endif
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --bindir="$(DESTDIR)$(CFG_BINDIR)"
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
diff --git a/mk/main.mk b/mk/main.mk
index 3df4d3b..36f0e58 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -315,7 +315,9 @@ export CFG_BUILD
export CFG_LLVM_ROOT
export CFG_PREFIX
export CFG_LIBDIR
+export CFG_BINDIR
export CFG_LIBDIR_RELATIVE
+export CFG_BINDIR_RELATIVE
export CFG_DISABLE_INJECT_STD_VERSION
######################################################################
diff --git a/src/etc/install.sh b/src/etc/install.sh
index 4f43b1e..add1c26 100644
--- a/src/etc/install.sh
+++ b/src/etc/install.sh
@@ -285,6 +285,8 @@ then
CFG_LIBDIR_RELATIVE=bin
fi
+CFG_BINDIR_RELATIVE=bin
+
if [ "$CFG_OSTYPE" = "pc-mingw32" ] || [ "$CFG_OSTYPE" = "w64-mingw32" ]
then
CFG_LD_PATH_VAR=PATH
@@ -304,6 +306,7 @@ valopt prefix "/usr/local" "set installation prefix"
# NB This isn't quite the same definition as in `configure`.
# just using 'lib' instead of CFG_LIBDIR_RELATIVE
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
if [ $HELP -eq 1 ]
@@ -424,6 +427,7 @@ need_ok "failed to create installed manifest"
# Now install, iterate through the new manifest and copy files
while read p; do
+ is_bin=false
# Decide the destination of the file
FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
@@ -434,6 +438,13 @@ while read p; do
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
fi
+ if echo "$p" | grep "^bin/" > /dev/null
+ then
+ is_bin=true
+ pp=`echo $p | sed 's/^bin\///'`
+ FILE_INSTALL_PATH="${CFG_BINDIR}/$pp"
+ fi
+
if echo "$p" | grep "^share/man/" > /dev/null
then
pp=`echo $p | sed 's/^share\/man\///'`
@@ -451,7 +462,7 @@ while read p; do
# Install the file
msg "${FILE_INSTALL_PATH}"
- if echo "$p" | grep "^bin/" > /dev/null
+ if $is_bin
then
install -m755 "${CFG_SRC_DIR}/$p" "${FILE_INSTALL_PATH}"
else
--
2.0.4
@@ -1,195 +0,0 @@
From 21379cee1db605007e5eb2b28b1d55ac24c04a5b Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 17 Nov 2014 20:10:42 -0500
Subject: [PATCH 51/62] Remember relative libdir and bindir from build time
---
configure | 6 +++
mk/install.mk | 2 +-
src/librustc/metadata/filesearch.rs | 73 +++++++++++++++----------------------
src/librustc_trans/back/link.rs | 3 +-
4 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/configure b/configure
index bdfeedd..c9bec44 100755
--- a/configure
+++ b/configure
@@ -340,6 +340,7 @@ need_cmd date
need_cmd tr
need_cmd sed
need_cmd file
+need_cmd realpath
msg "inspecting environment"
@@ -563,6 +564,11 @@ then
exit 0
fi
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+
# Validate Options
step_msg "validating $CFG_SELF args"
validate_opt
diff --git a/mk/install.mk b/mk/install.mk
index 4588e83..0fba6ee 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -21,7 +21,7 @@ ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
else
$(Q)$(MAKE) prepare_install
endif
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --bindir="$(DESTDIR)$(CFG_BINDIR)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --bindir="$(DESTDIR)$(CFG_BINDIR)" "$(MAYBE_DISABLE_VERIFY)"
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index fee289d..b626308 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -66,8 +66,7 @@ impl<'a> FileSearch<'a> {
if !found {
let rustpath = rust_path();
for path in rustpath.iter() {
- let tlib_path = make_rustpkg_lib_path(
- self.sysroot, path, self.triple);
+ let tlib_path = make_rustpkg_lib_path(path, self.triple);
debug!("is {} in visited_dirs? {}", tlib_path.display(),
visited_dirs.contains(&tlib_path.as_vec().to_vec()));
@@ -149,7 +148,7 @@ impl<'a> FileSearch<'a> {
// Returns a list of directories where target-specific tool binaries are located.
pub fn get_tools_search_paths(&self) -> Vec<Path> {
let mut p = Path::new(self.sysroot);
- p.push(find_libdir(self.sysroot));
+ p.push(libdir_str());
p.push(rustlibdir());
p.push(self.triple);
p.push("bin");
@@ -157,8 +156,8 @@ impl<'a> FileSearch<'a> {
}
}
-pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> Path {
- let mut p = Path::new(find_libdir(sysroot));
+pub fn relative_target_lib_path(target_triple: &str) -> Path {
+ let mut p = Path::new(libdir_str());
assert!(p.is_relative());
p.push(rustlibdir());
p.push(target_triple);
@@ -168,17 +167,24 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> Path {
fn make_target_lib_path(sysroot: &Path,
target_triple: &str) -> Path {
- sysroot.join(&relative_target_lib_path(sysroot, target_triple))
+ sysroot.join(&relative_target_lib_path(target_triple))
}
-fn make_rustpkg_lib_path(sysroot: &Path,
- dir: &Path,
+fn make_rustpkg_lib_path(dir: &Path,
triple: &str) -> Path {
- let mut p = dir.join(find_libdir(sysroot));
+ let mut p = dir.join(libdir_str());
p.push(triple);
p
}
+pub fn bindir_relative_str() -> &'static str {
+ env!("CFG_BINDIR_RELATIVE")
+}
+
+pub fn bindir_relative_path() -> Path {
+ Path::new(bindir_relative_str())
+}
+
pub fn get_or_default_sysroot() -> Path {
// Follow symlinks. If the resolved path is relative, make it absolute.
fn canonicalize(path: Option<Path>) -> Option<Path> {
@@ -190,7 +196,17 @@ pub fn get_or_default_sysroot() -> Path {
}
match canonicalize(os::self_exe_name()) {
- Some(mut p) => { p.pop(); p.pop(); p }
+ Some(mut p) => {
+ // Remove the exe name
+ p.pop();
+ let mut rel = bindir_relative_path();
+ // Remove a number of elements equal to the number of elements in the bindir relative
+ // path
+ while rel.pop() {
+ p.pop();
+ }
+ p
+ }
None => panic!("can't determine value for sysroot")
}
}
@@ -248,40 +264,9 @@ pub fn rust_path() -> Vec<Path> {
env_rust_path
}
-// The name of the directory rustc expects libraries to be located.
-// On Unix should be "lib", on windows "bin"
-#[cfg(unix)]
-fn find_libdir(sysroot: &Path) -> String {
- // FIXME: This is a quick hack to make the rustc binary able to locate
- // Rust libraries in Linux environments where libraries might be installed
- // to lib64/lib32. This would be more foolproof by basing the sysroot off
- // of the directory where librustc is located, rather than where the rustc
- // binary is.
-
- if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() {
- return primary_libdir_name();
- } else {
- return secondary_libdir_name();
- }
-
- #[cfg(target_word_size = "64")]
- fn primary_libdir_name() -> String {
- "lib64".to_string()
- }
-
- #[cfg(target_word_size = "32")]
- fn primary_libdir_name() -> String {
- "lib32".to_string()
- }
-
- fn secondary_libdir_name() -> String {
- "lib".to_string()
- }
-}
-
-#[cfg(windows)]
-fn find_libdir(_sysroot: &Path) -> String {
- "bin".to_string()
+// The name of the directory rustc expects libraries to be located, relative to the sysroot
+fn libdir_str() -> &'static str {
+ env!("CFG_LIBDIR_RELATIVE")
}
// The name of rustc's own place to organize libraries.
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index d27a338..2e1138e 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -1015,11 +1015,10 @@ fn link_args(cmd: &mut Command,
// where extern libraries might live, based on the
// addl_lib_search_paths
if sess.opts.cg.rpath {
- let sysroot = sess.sysroot();
let target_triple = sess.opts.target_triple.as_slice();
let get_install_prefix_lib_path = || {
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
- let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
+ let tlib = filesearch::relative_target_lib_path(target_triple);
let mut path = Path::new(install_prefix);
path.push(&tlib);
--
2.0.4
@@ -1,64 +0,0 @@
From 44d01c0ca3e2d1f6d6432ce6cef5a6430aade4f2 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:44:13 -0500
Subject: [PATCH 52/62] mk: add missing CFG_BINDIR_RELATIVE uses
---
mk/main.mk | 2 +-
mk/perf.mk | 4 ++--
mk/prepare.mk | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk
index 36f0e58..0fb6f5f 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -333,7 +333,7 @@ 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
+HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE)
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
# Destinations of artifacts for target architectures
diff --git a/mk/perf.mk b/mk/perf.mk
index 16cbaab..f8a354c 100644
--- a/mk/perf.mk
+++ b/mk/perf.mk
@@ -10,13 +10,13 @@
ifdef CFG_PERF_TOOL
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
@$(call E, perf compile: $@)
$(PERF_STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
-o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1
$(Q)rm -f $(LIBRUSTC_GLOB)
else
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
$(Q)touch $@
endif
diff --git a/mk/prepare.mk b/mk/prepare.mk
index 7df2489..842078f 100644
--- a/mk/prepare.mk
+++ b/mk/prepare.mk
@@ -147,10 +147,10 @@ endef
define DEF_PREPARE
prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
-prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/bin
+prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_BINDIR_RELATIVE)
prepare-base-$(1): PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_SOURCE_MAN_DIR=$$(S)/man
-prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
+prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_BINDIR_RELATIVE)
prepare-base-$(1): PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
prepare-base-$(1): prepare-everything-$(1)
--
2.0.4
@@ -1,27 +0,0 @@
From 9c4d2a42ecae5908e4864352422d5e28457307b3 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:02:36 -0500
Subject: [PATCH 54/62] configure: CFG_*DIR_RELATIVE: avoid requiring existence
---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index c9bec44..7914601 100755
--- a/configure
+++ b/configure
@@ -566,8 +566,8 @@ fi
# Determine libdir and bindir relative to prefix
step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
-CFG_BINDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
-CFG_LIBDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
# Validate Options
step_msg "validating $CFG_SELF args"
--
2.0.4
@@ -1,32 +0,0 @@
From 58a621bdfafd3dfb7aa5e9dc7e9df177fe8977eb Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:07:37 -0500
Subject: [PATCH 55/62] mk: add rule to create bindir
Without this make fails due to not finding a way to create the bindir target.
---
mk/host.mk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mk/host.mk b/mk/host.mk
index 59a0095..b8e8345 100644
--- a/mk/host.mk
+++ b/mk/host.mk
@@ -59,9 +59,13 @@ endef
# $(4) - the host triple (same as $(3))
define CP_HOST_STAGE_N
-ifneq ($(CFG_LIBDIR_RELATIVE),bin)
$$(HLIB$(2)_H_$(4))/:
@mkdir -p $$@
+
+# Avoid redefinition warnings if libdir==bindir
+ifneq ($(HBIN$(2)_H_$(4)),$(HLIB$(2)_H_$(4)))
+$$(HBIN$(2)_H_$(4))/:
+ @mkdir -p $$@
endif
endef
--
2.0.4
@@ -1,28 +0,0 @@
From 70cbf9f2285349700fd1fce8b3e4d2ca25ca53c7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:53:39 -0500
Subject: [PATCH 57/62] mk/stage0: complain instead of creating an empty file
If the expected rustc snapshot is not where we expect it to be,
complain and fail at that point rather than creating a empty rustc file
and continuing until we try to run it.
---
mk/stage0.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/stage0.mk b/mk/stage0.mk
index e028bba..460a4a7 100644
--- a/mk/stage0.mk
+++ b/mk/stage0.mk
@@ -22,7 +22,7 @@ ifdef CFG_ENABLE_LOCAL_RUST
else
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
endif
- $(Q)touch $@
+ $(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi
# For other targets, let the host build the target:
--
2.0.4
@@ -1,29 +0,0 @@
From 3cee7291722137195a9cc6f6556609ecac75fb8a Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 16:32:03 -0500
Subject: [PATCH 58/62] mk/target: fix typo so we depend on the correct
directory
Without this, if we we're using a non-standard host libdir, the target
bindir would not exist (and rustc would fail to write to the
non-existent directory).
---
mk/target.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/target.mk b/mk/target.mk
index ed7d8bb..acdf780 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -116,7 +116,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
$$(foreach dep,$$(TOOL_DEPS_$(4)), \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
- | $$(TBIN$(1)_T_$(4)_H_$(3))/
+ | $$(TBIN$(1)_T_$(2)_H_$(3))/
@$$(call E, rustc: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --cfg $(4)
--
2.0.4
@@ -1,34 +0,0 @@
From c70d53d795de0d361cdb2220fc348993336be850 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 18:56:12 -0500
Subject: [PATCH 59/62] rustdoc: avoid supplying a bad default sysroot so the
librustc code can calculate it properly
---
src/librustdoc/core.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 21242e6..b040a4b 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -18,7 +18,6 @@ use rustc_trans::back::link;
use syntax::{ast, ast_map, codemap, diagnostic};
use std::cell::RefCell;
-use std::os;
use std::collections::{HashMap, HashSet};
use arena::TypedArena;
@@ -89,7 +88,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
let warning_lint = lint::builtin::WARNINGS.name_lower();
let sessopts = config::Options {
- maybe_sysroot: Some(os::self_exe_path().unwrap().dir_path()),
+ maybe_sysroot: None,
addl_lib_search_paths: RefCell::new(libs),
crate_types: vec!(config::CrateTypeRlib),
lint_opts: vec!((warning_lint, lint::Allow)),
--
2.0.4
@@ -1,75 +0,0 @@
From 573101145b8d5a666b7b45c557838e4f1a8837e7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 19 Nov 2014 19:30:06 -0500
Subject: [PATCH 60/62] src/etc/install.sh: use LIBDIR and BINDIR RELATIVE
---
src/etc/install.sh | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/etc/install.sh b/src/etc/install.sh
index add1c26..021dc31 100644
--- a/src/etc/install.sh
+++ b/src/etc/install.sh
@@ -315,6 +315,11 @@ then
exit 0
fi
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+
step_msg "validating $CFG_SELF args"
validate_opt
@@ -328,8 +333,8 @@ then
if [ -z "${CFG_UNINSTALL}" ]
then
msg "verifying platform can run binaries"
- export $CFG_LD_PATH_VAR="${CFG_SRC_DIR}/lib:$CFG_OLD_LD_PATH_VAR"
- "${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
+ export $CFG_LD_PATH_VAR="${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}:$CFG_OLD_LD_PATH_VAR"
+ "${CFG_SRC_DIR}/${CFG_BINDIR_RELATIVE}/rustc" --version > /dev/null
if [ $? -ne 0 ]
then
err "can't execute rustc binary on this platform"
@@ -432,16 +437,16 @@ while read p; do
# Decide the destination of the file
FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
- if echo "$p" | grep "^lib/" > /dev/null
+ if echo "$p" | grep "^${CFG_LIBDIR_RELATIVE}/" > /dev/null
then
- pp=`echo $p | sed 's/^lib\///'`
+ pp=`echo $p | sed 's;^'${CFG_LIBDIR_RELATIVE}'/;;'`
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
fi
- if echo "$p" | grep "^bin/" > /dev/null
+ if echo "$p" | grep "^${CFG_BINDIR_RELATIVE}/" > /dev/null
then
is_bin=true
- pp=`echo $p | sed 's/^bin\///'`
+ pp=`echo $p | sed 's;^'${CFG_BINDIR_RELATIVE}'/;;'`
FILE_INSTALL_PATH="${CFG_BINDIR}/$pp"
fi
@@ -497,11 +502,11 @@ fi
if [ -z "${CFG_DISABLE_VERIFY}" ]
then
msg "verifying installed binaries are executable"
- "${CFG_PREFIX}/bin/rustc" --version 2> /dev/null 1> /dev/null
+ "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}/rustc" --version 2> /dev/null 1> /dev/null
if [ $? -ne 0 ]
then
- export $CFG_LD_PATH_VAR="${CFG_PREFIX}/lib:$CFG_OLD_LD_PATH_VAR"
- "${CFG_PREFIX}/bin/rustc" --version > /dev/null
+ export $CFG_LD_PATH_VAR="${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}:$CFG_OLD_LD_PATH_VAR"
+ "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}/rustc" --version > /dev/null
if [ $? -ne 0 ]
then
ERR="can't execute installed rustc binary. "
--
2.0.4
@@ -1,32 +0,0 @@
From 67cd20cddb82e4f09d8963e6398f36c200d8991a Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 19 Nov 2014 19:54:24 -0500
Subject: [PATCH 61/62] configure: silence warning about LOCAL_RUST_ROOT being
set
We have a default value for this ('/usr/local'), so this warning is
printed ALL the time unless one does --enable-local-rust. As a result,
it doesn't really help at all.
---
configure | 5 -----
1 file changed, 5 deletions(-)
diff --git a/configure b/configure
index 7914601..a5c6aa8 100755
--- a/configure
+++ b/configure
@@ -710,11 +710,6 @@ then
fi
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
putvar CFG_LOCAL_RUST_ROOT
-else
- if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
- then
- warn "Use of --local-rust-root without --enable-local-rust"
- fi
fi
# Force freebsd to build with clang; gcc doesn't like us there
--
2.0.4
@@ -1,53 +0,0 @@
From 12749fc8ec3f110d3fb8057b955c7fab98f85730 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Thu, 20 Nov 2014 15:56:58 -0500
Subject: [PATCH] mk/rt: use CFG_LLVM_TARGET instead of plain target when
calling llc
We add CFG_LLVM_TARGET_$(target) (which can be defined in any of the
mk/cfg/* files) and supply a default to the plain target name
CFG_LLVM_TARGET mirrors the value of llvm_target (aka llvm-target) in
the librustc_back runtime target specification.
---
mk/main.mk | 7 +++++--
mk/rt.mk | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk
index 3df4d3b..2e759a1 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -190,11 +190,14 @@ endif
# Target-and-rule "utility variables"
######################################################################
-define DEF_X
+define DEF_FOR_TARGET
X_$(1) := $(CFG_EXE_SUFFIX_$(1))
+ifndef CFG_LLVM_TARGET_$(1)
+CFG_LLVM_TARGET_$(1) := $(1)
+endif
endef
$(foreach target,$(CFG_TARGET), \
- $(eval $(call DEF_X,$(target))))
+ $(eval $(call DEF_FOR_TARGET,$(target))))
# "Source" files we generate in builddir along the way.
GENERATED :=
diff --git a/mk/rt.mk b/mk/rt.mk
index a7d6a6e..38aec83 100644
--- a/mk/rt.mk
+++ b/mk/rt.mk
@@ -75,7 +75,7 @@ $$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.ll $$(MKFILE_DEPS) \
@mkdir -p $$(@D)
@$$(call E, compile: $$@)
$$(Q)$$(LLC_$$(CFG_BUILD)) $$(CFG_LLC_FLAGS_$(1)) \
- -filetype=obj -mtriple=$(1) -relocation-model=pic -o $$@ $$<
+ -filetype=obj -mtriple=$$(CFG_LLVM_TARGET_$(1)) -relocation-model=pic -o $$@ $$<
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
@mkdir -p $$(@D)
--
2.1.3
-22
View File
@@ -1,22 +0,0 @@
SRCREV = "bfaa7bcab3459907014c31d3bf980f65ccd14b08"
require rust-git.inc
SRC_URI_append = "\
file://0001-platform.mk-avoid-choking-on-i586.patch \
file://0007-mk-rt-compiler_rt-pass-LDFLAGS-from-CFG_GCCISH_LINK_.patch \
file://0030-Target-add-default-target.json-path-libdir-rust-targ.patch \
file://0031-mk-cfg-add-.mk-suffix-on-files-to-avoid-supprises-wh.patch \
file://0050-Support-bindir.patch \
file://0051-Remember-relative-libdir-and-bindir-from-build-time.patch \
file://0052-mk-add-missing-CFG_BINDIR_RELATIVE-uses.patch \
file://0053-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://0054-configure-CFG_-DIR_RELATIVE-avoid-requiring-existenc.patch \
file://0055-mk-add-rule-to-create-bindir.patch \
file://0056-mk-always-use-bin-as-bindir-for-stage0-CFG_BUILD-and.patch \
file://0057-mk-stage0-complain-instead-of-creating-an-empty-file.patch \
file://0058-mk-target-fix-typo-so-we-depend-on-the-correct-direc.patch \
file://0059-rustdoc-avoid-supplying-a-bad-default-sysroot-so-the.patch \
file://0060-src-etc-install.sh-use-LIBDIR-and-BINDIR-RELATIVE.patch \
file://0061-configure-silence-warning-about-LOCAL_RUST_ROOT-bein.patch \
file://0070-mk-rt-use-CFG_LLVM_TARGET-instead-of-plain-target-wh.patch \
"
+13
View File
@@ -0,0 +1,13 @@
SRCREV = "ccc4a7cebc759b3c8295b64bd5c1fe29fdb3db8a"
require rust-git.inc
SRC_URI_append = "\
file://0001-platform.mk-avoid-choking-on-i586.patch \
file://0002-mk-rt-compiler_rt-pass-LDFLAGS-from-CFG_GCCISH_LINK_.patch \
file://0003-Target-add-default-target.json-path-libdir-rust-targ.patch \
file://0004-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \
file://0005-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://0006-configure-support-bindir-and-extend-libdir-to-non-bl.patch \
file://0007-XXX-remove-conflicting-realpath-hack.patch \
file://0008-XXX-configure-unneeded-windows-check.patch \
"