18 Commits
morty ... fido

Author SHA1 Message Date
Doug Goldstein
4305b558b3 update case of OpenEmbedded to match upstream
(cherry picked from commit 3b954b38d1)
2016-10-03 08:20:25 -05:00
Jonathan Creekmore
3a3381b8d0 Merge pull request #5 from starlab-io/cleanup
drop older versions and rename to recipes-devtools
2015-12-11 15:25:10 -06:00
Doug Goldstein
9a1f1aad8d move recipes/{rust,cargo} to recipes-devtools
This better matches where upstream puts compilers and development
utilities.
2015-12-11 00:43:18 -06:00
Doug Goldstein
0653dc1572 remove Rust 1.2.0 2015-12-11 00:41:23 -06:00
Doug Goldstein
be7e8c8ee6 remove Rust 1.1.0 2015-12-11 00:40:35 -06:00
Jonathan Creekmore
344a19bafb Merge pull request #4 from starlab-io/fix-cross-build
Fix security flags for rust-cross
2015-11-17 10:14:52 -06:00
Doug Goldstein
640b962181 Fix security flags for rust-cross 2015-11-17 10:09:12 -06:00
Jonathan Creekmore
d19f3cb6cf Merge pull request #3 from starlab-io/misc-updates
Move license files and update debug message
2015-11-17 09:56:26 -06:00
Doug Goldstein
a526e7a435 move licenses to top level 2015-11-17 09:23:22 -06:00
Doug Goldstein
6ae148d342 cargo.bbclass: update debug message
Hopefully this makes a bit more clear when you see this outputted.
2015-11-16 15:34:44 -06:00
Doug Goldstein
ff13d3319d Merge pull request #2 from starlab-io/fix_sstate_cargo
Updates to rust build recipes
2015-11-16 11:31:26 -06:00
Derek Straka
a018f9586b Add no PIE to rust-llvm 2015-11-15 07:44:29 -06:00
Derek Straka
3406a2920c Update PR number and pack sstate correctly 2015-11-15 07:44:03 -06:00
Doug Goldstein
559214fceb Merge pull request #1 from starlab-io/update-cargo-native
Use the pre-packaged version of cargo for the native packager.

While this is not how we really want to do things, this does let us move forward for right now.
2015-11-13 08:42:02 -06:00
Derek Straka
8702fd31f7 Use the pre-packaged version of cargo for the native packager 2015-11-12 17:40:14 -06:00
Doug Goldstein
1280c29fa7 Merge branch 'security-flags' into fido 2015-11-10 07:48:04 -06:00
Doug Goldstein
2f703c9f1f fix LICENSE_PATH location
The path in LICENSE_PATH was not the correct path to where the licenses
are located in this repo.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2015-11-06 10:19:07 -06:00
Doug Goldstein
25b4255204 remove conf/licenses.conf
Per conversation in #rust with kergoth this file is causing a backtrace
in bitbake because its overriding the meta/conf/licenses.conf file. The
behavior that's expected out of this isn't valid with newer Yocto
releases so its possible this is for an older version.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2015-11-06 10:18:56 -06:00
71 changed files with 43 additions and 1628 deletions

View File

@@ -1,6 +1,6 @@
## Introduction
This openembedded layer provides the rust compiler, tools for building packages
This OpenEmbedded layer provides the rust compiler, tools for building packages
(cargo), and a few example projects.
## What works:

View File

@@ -74,8 +74,8 @@ export CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release"
# change if CARGO_BUILD_FLAGS changes.
export CARGO_TARGET_SUBDIR="${HOST_SYS}/release"
oe_cargo_build () {
which cargo
which rustc
echo "cargo: $(which cargo)"
echo "rustc: $(which rustc)"
bbnote ${CARGO} build ${CARGO_BUILD_FLAGS} "$@"
"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
}

View File

@@ -1,4 +1,6 @@
# Build errors with PIE options enabled
SECURITY_CFLAGS_pn-rust-native = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust-cross = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust-cross-${TARGET_ARCH} = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust-llvm = "${SECURITY_NO_PIE_CFLAGS}"

View File

@@ -2,13 +2,13 @@
BBPATH .= ":${LAYERDIR}"
# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "rust-layer"
BBFILE_PATTERN_rust-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_rust-layer = "7"
LICENSE_PATH += "${LAYERDIR}/files/licenses"
LICENSE_PATH += "${LAYERDIR}/licenses"
# Override security flags
require conf/distro/include/rust_security_flags.inc

View File

@@ -1 +0,0 @@
SRC_DISTRIBUTE_LICENSES += "GPL-2.0-with-linking-exception"

View File

@@ -0,0 +1,36 @@
SUMMARY = "Cargo downloads your Rust project's dependencies and builds your project"
HOMEPAGE = "http://crates.io"
SECTION = "devel"
LICENSE = "MIT | Apache-2.0"
PR = "r2"
DEPENDS += "rust-native"
LIC_FILES_CHKSUM ="\
file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \
file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \
file://LICENSE-THIRD-PARTY;md5=afbb7ae0aa70c8e437a007314eae5f3b \
"
SRC_URI = " \
https://static.rust-lang.org/cargo-dist/2015-04-02/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz \
"
SRC_URI[md5sum] = "3d62194d02a9088cd8aae379e9498134"
SRC_URI[sha256sum] = "16b6338ba2942989693984ba4dbd057c2801e8805e6da8fa7b781b00e722d117"
S = "${WORKDIR}/cargo-nightly-x86_64-unknown-linux-gnu/"
inherit native
do_install() {
install -d ${D}
sh ${S}/install.sh --destdir=${D}${STAGING_DIR_NATIVE} --prefix=
# Remove files provided by rust
rm -f ${D}${STAGING_DIR_NATIVE}/lib/rustlib/uninstall.sh
rm -f ${D}${STAGING_DIR_NATIVE}/lib/rustlib/install.log
rm -f ${D}${STAGING_DIR_NATIVE}/lib/rustlib/components
rm -f ${D}${STAGING_DIR_NATIVE}/lib/rustlib/rust-installer-version
}

View File

@@ -70,5 +70,3 @@ do_compile () {
do_install () {
oe_runmake DESTDIR="${D}" install
}
BBCLASSEXTEND = "native"

View File

@@ -1,27 +0,0 @@
From 89bd1de30bad2e6bee062f287c454e4a87e11056 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Sat, 15 Nov 2014 20:12:48 -0500
Subject: [PATCH 1/8] platform.mk: avoid choking on i586
---
mk/platform.mk | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mk/platform.mk b/mk/platform.mk
index 9545a1f..80fb0bb 100644
--- a/mk/platform.mk
+++ b/mk/platform.mk
@@ -14,7 +14,9 @@
# would create a variable HOST_i686-darwin-macos with the value
# i386.
define DEF_HOST_VAR
- HOST_$(1) = $(subst i686,i386,$(word 1,$(subst -, ,$(1))))
+ HOST_$(1) = $(subst i686,i386,\
+ $(subst i586,i386,\
+ $(word 1,$(subst -, ,$(1)))))
endef
$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t))))
$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t))))
--
2.4.3

View File

@@ -1,109 +0,0 @@
From 6ed2ad4e243f31e5d9e9fb49e2ce16d2920884c5 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 01:40:21 -0500
Subject: [PATCH 2/8] Target: add default target.json path:
$libdir/rust/targets
---
src/librustc/session/config.rs | 6 +++---
src/librustc/session/mod.rs | 8 ++++++--
src/librustc_back/target/mod.rs | 14 +++++++++++---
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index b999929..3e9743e 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -37,7 +37,7 @@ use getopts;
use std::collections::HashMap;
use std::env;
use std::fmt;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use llvm;
@@ -665,8 +665,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
v
}
-pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
- let target = match Target::search(&opts.target_triple) {
+pub fn build_target_config(sysroot: &Path, opts: &Options, sp: &SpanHandler) -> Config {
+ let target = match Target::search(sysroot, &opts.target_triple[..]) {
Ok(t) => t,
Err(e) => {
sp.handler().fatal(&format!("Error loading target specification: {}", e));
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 7a8ce1b..cb85d2e 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -370,14 +370,18 @@ pub fn build_session_(sopts: config::Options,
local_crate_source_file: Option<PathBuf>,
span_diagnostic: diagnostic::SpanHandler)
-> Session {
- let host = match Target::search(config::host_triple()) {
+ let sysroot = match sopts.maybe_sysroot {
+ Some(ref x) => PathBuf::from(x),
+ None => filesearch::get_or_default_sysroot()
+ };
+ let host = match Target::search(&sysroot, config::host_triple()) {
Ok(t) => t,
Err(e) => {
span_diagnostic.handler()
.fatal(&format!("Error loading host specification: {}", e));
}
};
- let target_cfg = config::build_target_config(&sopts, &span_diagnostic);
+ let target_cfg = config::build_target_config(&sysroot, &sopts, &span_diagnostic);
let p_s = parse::new_parse_sess_special_handler(span_diagnostic);
let default_sysroot = match sopts.maybe_sysroot {
Some(_) => None,
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index c5f1882..1888fbd 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -49,6 +49,8 @@ use serialize::json::Json;
use std::default::Default;
use std::io::prelude::*;
use syntax::{diagnostic, abi};
+use std::borrow::ToOwned;
+use std::path::Path;
mod android_base;
mod apple_base;
@@ -298,12 +300,13 @@ impl Target {
///
/// The error string could come from any of the APIs called, including
/// filesystem access and JSON decoding.
- pub fn search(target: &str) -> Result<Target, String> {
+ pub fn search(sysroot: &Path, target: &str) -> Result<Target, String> {
use std::env;
use std::ffi::OsString;
use std::fs::File;
use std::path::{Path, PathBuf};
use serialize::json;
+ use std::iter::IntoIterator;
fn load_file(path: &Path) -> Result<Target, String> {
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
@@ -390,9 +393,14 @@ impl Target {
let target_path = env::var_os("RUST_TARGET_PATH")
.unwrap_or(OsString::new());
- // FIXME 16351: add a sane default search path?
+ let mut default_path = sysroot.to_owned();
+ default_path.push(env!("CFG_LIBDIR_RELATIVE"));
+ default_path.push("rustlib");
- for dir in env::split_paths(&target_path) {
+ let paths = env::split_paths(&target_path)
+ .chain(Some(default_path).into_iter());
+
+ for dir in paths {
let p = dir.join(&path);
if p.is_file() {
return load_file(&p);
--
2.4.3

View File

@@ -1,67 +0,0 @@
From 0e78aab532c652b6ee8f8929d7d25de5d7c0d2e9 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:52:56 -0500
Subject: [PATCH 3/8] mk: for stage0, use RUSTFLAGS to override target libs dir
Setting HLIB specially for stage0 (and even more specially for windows)
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
stage0-rustc at the appropriate location.
---
mk/main.mk | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk
index 4aa8d7f..af2ddf0 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -370,21 +370,22 @@ 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
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
-else
-ifeq ($(1),0)
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
-else
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
-endif
-endif
# Destinations of artifacts for target architectures
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
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
+# Don't trust stage0, be explicit about libraries
+# TODO: rather than specifying sysroot, we really want to tell which libdir to
+# use (ie: the dir containing 'rustlib'). This would allow us to avoid
+# passing the '-L' options.
+ifeq ($(1),0)
+RUSTFLAGS_S_$(1)_T_$(2)_H_$(3) += --sysroot "$$(HROOT$(1)_H_$(3))" \
+ -L "$$(TLIB$(1)_T_$(2)_H_$(3))"
+endif
+
# Preqrequisites for using the stageN compiler
ifeq ($(1),0)
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
@@ -498,6 +499,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
+ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \
$$(RUSTC_FLAGS_$(2))
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
@@ -506,6 +508,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
+ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \
$$(RUSTC_FLAGS_$(2))
endef
--
2.4.3

View File

@@ -1,27 +0,0 @@
From 54abdace19bc6a855ae122bd16a5eb82d2f223ee Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:48:14 -0500
Subject: [PATCH 4/8] mk: add missing CFG_LIBDIR_RELATIVE
---
mk/grammar.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mk/grammar.mk b/mk/grammar.mk
index d9c66e2..585206d 100644
--- a/mk/grammar.mk
+++ b/mk/grammar.mk
@@ -11,8 +11,8 @@
BG = $(CFG_BUILD_DIR)/grammar/
SG = $(S)src/grammar/
B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
-L = $(B)lib/rustlib/$(CFG_BUILD)/lib
-LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
+L = $(B)$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib
+LD = $(CFG_BUILD)/stage2/$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib/
RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
ifeq ($(CFG_OSTYPE),apple-darwin)
FLEX_LDFLAGS=-ll
--
2.4.3

View File

@@ -1,362 +0,0 @@
From 2fa205f59bd2ab4f9a2356073b18b8a8f0ee6787 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 5/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 assumes absolute paths start with '/', which may break
windows platforms
---
configure | 50 ++++++++++++++++------
mk/host.mk | 6 ++-
mk/main.mk | 11 +++++
mk/perf.mk | 4 +-
mk/prepare.mk | 4 +-
src/librustc/metadata/filesearch.rs | 84 ++++++++++++++-----------------------
src/librustc_trans/back/link.rs | 3 +-
7 files changed, 91 insertions(+), 71 deletions(-)
diff --git a/configure b/configure
index 5e02d07..287d066 100755
--- a/configure
+++ b/configure
@@ -323,6 +323,31 @@ envopt() {
fi
}
+abspath () {
+ case "$1" in
+ /*) echo "$1" ;;
+ *) echo "$PWD/$1" ;;
+ esac
+}
+
+relpath () {
+ local src=$(abspath "$1")
+ local dst=$(abspath "$2")
+ local common=$src
+ local result=
+
+ # Start by checking if the whole src is common, then strip off pack
+ # components until we find the common element.
+ while [ "${dst#"$common"}" = "$dst" ]; do
+ common=$(dirname "$common")
+ result="../$result"
+ done
+
+ local down="${dst#"$common"}"
+ result="${result}${down#/}"
+ echo "$result"
+}
+
to_llvm_triple() {
case $1 in
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
@@ -607,6 +632,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
CFG_HOST=$(to_llvm_triple $CFG_HOST)
CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
+CFG_LIBDIR_RELATIVE=lib
+
# On windows we just store the libraries in the bin directory because
# there's no rpath. This is where the build system itself puts libraries;
# --libdir is used to configure the installation directory.
@@ -614,23 +641,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ]
then
CFG_LIBDIR_RELATIVE=bin
-else
- CFG_LIBDIR_RELATIVE=lib
fi
-valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)"
+valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
-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_BINDIR_RELATIVE=bin
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
-CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_LIBDIR}")
-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
if [ $HELP -eq 1 ]
@@ -1475,6 +1500,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/main.mk b/mk/main.mk
index af2ddf0..15a59be 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -339,7 +339,9 @@ export CFG_RELEASE_CHANNEL
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
ifdef CFG_DISABLE_UNSTABLE_FEATURES
CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
@@ -369,7 +371,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 1ae6a61..e463727 100644
--- a/mk/prepare.mk
+++ b/mk/prepare.mk
@@ -168,10 +168,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
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/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 311ab1c..1b03b1a 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -68,8 +68,7 @@ impl<'a> FileSearch<'a> {
if !found {
let rustpath = rust_path();
for path in &rustpath {
- 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));
@@ -96,7 +95,7 @@ impl<'a> FileSearch<'a> {
where F: FnMut(&Path, PathKind) -> FileMatch
{
self.for_each_lib_search_path(|lib_search_path, kind| {
- debug!("searching {}", lib_search_path.display());
+ info!("searching {}", lib_search_path.display());
match fs::read_dir(lib_search_path) {
Ok(files) => {
let files = files.filter_map(|p| p.ok().map(|s| s.path()))
@@ -157,7 +156,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<PathBuf> {
let mut p = PathBuf::from(self.sysroot);
- p.push(&find_libdir(self.sysroot));
+ p.push(libdir_str());
p.push(&rustlibdir());
p.push(&self.triple);
p.push("bin");
@@ -165,8 +164,8 @@ impl<'a> FileSearch<'a> {
}
}
-pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf {
- let mut p = PathBuf::from(&find_libdir(sysroot));
+pub fn relative_target_lib_path(target_triple: &str) -> PathBuf {
+ let mut p = PathBuf::from(&libdir_str());
assert!(p.is_relative());
p.push(&rustlibdir());
p.push(target_triple);
@@ -176,17 +175,28 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
fn make_target_lib_path(sysroot: &Path,
target_triple: &str) -> PathBuf {
- 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) -> PathBuf {
- 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() -> PathBuf {
+ PathBuf::from(bindir_relative_str())
+}
+
+pub fn libdir_str() -> &'static str {
+ env!("CFG_LIBDIR_RELATIVE")
+}
+
pub fn get_or_default_sysroot() -> PathBuf {
// Follow symlinks. If the resolved path is relative, make it absolute.
fn canonicalize(path: Option<PathBuf>) -> Option<PathBuf> {
@@ -202,7 +212,18 @@ pub fn get_or_default_sysroot() -> PathBuf {
}
match canonicalize(env::current_exe().ok()) {
- 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")
}
}
@@ -257,47 +278,6 @@ pub fn rust_path() -> Vec<PathBuf> {
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_pointer_width = "64")]
- fn primary_libdir_name() -> String {
- "lib64".to_string()
- }
-
- #[cfg(target_pointer_width = "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 rustc's own place to organize libraries.
// Used to be "rustc", now the default is "rustlib"
pub fn rustlibdir() -> String {
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 38ad909..2f2ba16 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -1037,11 +1037,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;
let mut 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 = PathBuf::from(install_prefix);
path.push(&tlib);
--
2.4.3

View File

@@ -1,25 +0,0 @@
From 5364ecd0cdf0bcc815d89180d525b4b60a47219e Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 3 Dec 2014 19:15:19 -0500
Subject: [PATCH 6/8] std/thread_local: workaround for NULL __dso_handle
---
src/libstd/thread/local.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
index f2435b6..4261387 100644
--- a/src/libstd/thread/local.rs
+++ b/src/libstd/thread/local.rs
@@ -397,7 +397,7 @@ mod imp {
#[linkage = "extern_weak"]
static __cxa_thread_atexit_impl: *const ();
}
- if !__cxa_thread_atexit_impl.is_null() {
+ if !__cxa_thread_atexit_impl.is_null() && !__dso_handle.is_null() {
type F = unsafe extern fn(dtor: unsafe extern fn(*mut u8),
arg: *mut u8,
dso_handle: *mut u8) -> libc::c_int;
--
2.4.3

View File

@@ -1,43 +0,0 @@
From 378cc683eb8012dc847dc581b57fd10c84a37ae2 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 2 Mar 2015 13:34:59 -0500
Subject: [PATCH 7/8] mk/install: use disable-rewrite-paths
This stops the install scripts from doing work we've already handled.
Path rewriting is only useful for prepackaged binary installers.
---
mk/install.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mk/install.mk b/mk/install.mk
index cabc97a..273bb0e 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -16,9 +16,9 @@ else
$(Q)$(MAKE) prepare_install
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths
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)"
+ $(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)" --disable-rewrite-paths
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -32,9 +32,9 @@ else
$(Q)$(MAKE) prepare_uninstall
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_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/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths
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)" --disable-rewrite-paths
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
--
2.4.3

View File

@@ -1,40 +0,0 @@
From 79db300ba81f7f8deccd1c2627cd5a25f11d4b82 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 26 May 2015 12:09:36 -0400
Subject: [PATCH 8/8] install: disable ldconfig
---
mk/install.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mk/install.mk b/mk/install.mk
index 273bb0e..58cfc99 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -16,9 +16,9 @@ else
$(Q)$(MAKE) prepare_install
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths --disable-ldconfig
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)" --disable-rewrite-paths
+ $(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)" --disable-rewrite-paths --disable-ldconfig
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -32,9 +32,9 @@ else
$(Q)$(MAKE) prepare_uninstall
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths --disable-ldconfig
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)" --disable-rewrite-paths
+ $(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)" --disable-rewrite-paths --disable-ldconfig
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
--
2.4.3

View File

@@ -1,47 +0,0 @@
From 02936deefb786a244c98ec2293e6b85ecfc85cdb Mon Sep 17 00:00:00 2001
From: Steven Walter <swalter@lexmark.com>
Date: Mon, 15 Jun 2015 11:35:47 -0400
Subject: [PATCH] src/rt/arch/i386/morestack.S: call rust_stack_exhausted via
plt
This prevents a relocation in the text section. Text relocations are
incompatible with hardened kernels.
https://github.com/rust-lang/rust/issues/5714
---
src/rt/arch/i386/morestack.S | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S
index 2f03251..98fdfdf 100644
--- a/src/rt/arch/i386/morestack.S
+++ b/src/rt/arch/i386/morestack.S
@@ -75,7 +75,7 @@
#else
#if defined(__linux__) || defined(__FreeBSD__)
#define MORESTACK __morestack
-#define EXHAUSTED rust_stack_exhausted
+#define EXHAUSTED rust_stack_exhausted@plt
#else
#define MORESTACK ___morestack
#define EXHAUSTED _rust_stack_exhausted
@@ -83,7 +83,6 @@
#endif
.globl MORESTACK
-.globl EXHAUSTED
// FIXME: What about __WIN32__?
#if defined(__linux__) || defined(__FreeBSD__)
@@ -138,7 +137,7 @@ MORESTACK:
// re-align the stack
subl $12,%esp
- calll EXHAUSTED
+ call EXHAUSTED
// the exhaustion function guarantees that it can't return
.cfi_endproc
--
1.9.1

View File

@@ -1,26 +0,0 @@
From 9db9d253355cc0e9e885bb1e63b054e318f9395a Mon Sep 17 00:00:00 2001
From: Steven Walter <swalter@lexmark.com>
Date: Tue, 7 Jul 2015 14:57:42 -0400
Subject: [PATCH] Remove crate metadata from symbol hashing
---
src/librustc_trans/back/link.rs | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 2f2ba16..ea3e897 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -205,9 +205,4 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
symbol_hasher.input_str(&link_meta.crate_name);
- symbol_hasher.input_str("-");
- symbol_hasher.input_str(link_meta.crate_hash.as_str());
- for meta in &*tcx.sess.crate_metadata.borrow() {
- symbol_hasher.input_str(&meta[..]);
- }
symbol_hasher.input_str("-");
symbol_hasher.input_str(&encoder::encoded_ty(tcx, t));
// Prefix with 'h' so that it never blends into adjacent digits
--
1.9.1

View File

@@ -1,27 +0,0 @@
From 776929187d56bd9417532c47d856bf781b08e95f Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Sat, 15 Nov 2014 20:12:48 -0500
Subject: [PATCH 01/10] platform.mk: avoid choking on i586
---
mk/platform.mk | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mk/platform.mk b/mk/platform.mk
index 8a5e58c..e2c3d8f 100644
--- a/mk/platform.mk
+++ b/mk/platform.mk
@@ -14,7 +14,9 @@
# would create a variable HOST_i686-darwin-macos with the value
# i386.
define DEF_HOST_VAR
- HOST_$(1) = $(subst i686,i386,$(word 1,$(subst -, ,$(1))))
+ HOST_$(1) = $(subst i686,i386,\
+ $(subst i586,i386,\
+ $(word 1,$(subst -, ,$(1)))))
endef
$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t))))
$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t))))
--
2.5.0

View File

@@ -1,109 +0,0 @@
From f3966aca0080e8718660137c697ff6856929087a Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 01:40:21 -0500
Subject: [PATCH 02/10] Target: add default target.json path:
$libdir/rust/targets
---
src/librustc/session/config.rs | 6 +++---
src/librustc/session/mod.rs | 8 ++++++--
src/librustc_back/target/mod.rs | 14 +++++++++++---
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index c6ce3a2..51152c7 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -38,7 +38,7 @@ use getopts;
use std::collections::HashMap;
use std::env;
use std::fmt;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use llvm;
@@ -651,8 +651,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
v
}
-pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
- let target = match Target::search(&opts.target_triple) {
+pub fn build_target_config(sysroot: &Path, opts: &Options, sp: &SpanHandler) -> Config {
+ let target = match Target::search(sysroot, &opts.target_triple[..]) {
Ok(t) => t,
Err(e) => {
sp.handler().fatal(&format!("Error loading target specification: {}", e));
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 6b5f587..4432440 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -381,14 +381,18 @@ pub fn build_session_(sopts: config::Options,
local_crate_source_file: Option<PathBuf>,
span_diagnostic: diagnostic::SpanHandler)
-> Session {
- let host = match Target::search(config::host_triple()) {
+ let sysroot = match sopts.maybe_sysroot {
+ Some(ref x) => PathBuf::from(x),
+ None => filesearch::get_or_default_sysroot()
+ };
+ let host = match Target::search(&sysroot, config::host_triple()) {
Ok(t) => t,
Err(e) => {
span_diagnostic.handler()
.fatal(&format!("Error loading host specification: {}", e));
}
};
- let target_cfg = config::build_target_config(&sopts, &span_diagnostic);
+ let target_cfg = config::build_target_config(&sysroot, &sopts, &span_diagnostic);
let p_s = parse::ParseSess::with_span_handler(span_diagnostic);
let default_sysroot = match sopts.maybe_sysroot {
Some(_) => None,
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 402fbcd..a211b84 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -49,6 +49,8 @@ use serialize::json::Json;
use std::default::Default;
use std::io::prelude::*;
use syntax::{diagnostic, abi};
+use std::borrow::ToOwned;
+use std::path::Path;
mod android_base;
mod apple_base;
@@ -306,12 +308,13 @@ impl Target {
///
/// The error string could come from any of the APIs called, including
/// filesystem access and JSON decoding.
- pub fn search(target: &str) -> Result<Target, String> {
+ pub fn search(sysroot: &Path, target: &str) -> Result<Target, String> {
use std::env;
use std::ffi::OsString;
use std::fs::File;
use std::path::{Path, PathBuf};
use serialize::json;
+ use std::iter::IntoIterator;
fn load_file(path: &Path) -> Result<Target, String> {
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
@@ -400,9 +403,14 @@ impl Target {
let target_path = env::var_os("RUST_TARGET_PATH")
.unwrap_or(OsString::new());
- // FIXME 16351: add a sane default search path?
+ let mut default_path = sysroot.to_owned();
+ default_path.push(env!("CFG_LIBDIR_RELATIVE"));
+ default_path.push("rustlib");
- for dir in env::split_paths(&target_path) {
+ let paths = env::split_paths(&target_path)
+ .chain(Some(default_path).into_iter());
+
+ for dir in paths {
let p = dir.join(&path);
if p.is_file() {
return load_file(&p);
--
2.5.0

View File

@@ -1,68 +0,0 @@
From 2bc2e872f7b97e67456dd9dd5563611fe0f15ada Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:52:56 -0500
Subject: [PATCH 03/10] mk: for stage0, use RUSTFLAGS to override target libs
dir
Setting HLIB specially for stage0 (and even more specially for windows)
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
stage0-rustc at the appropriate location.
---
mk/main.mk | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk
index 8983a63..98024bf 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -370,21 +370,22 @@ 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
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
-else
-ifeq ($(1),0)
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
-else
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
-endif
-endif
# Destinations of artifacts for target architectures
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
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
+# Don't trust stage0, be explicit about libraries
+# TODO: rather than specifying sysroot, we really want to tell which libdir to
+# use (ie: the dir containing 'rustlib'). This would allow us to avoid
+# passing the '-L' options.
+ifeq ($(1),0)
+RUSTFLAGS_S_$(1)_T_$(2)_H_$(3) += --sysroot "$$(HROOT$(1)_H_$(3))" \
+ -L "$$(TLIB$(1)_T_$(2)_H_$(3))"
+endif
+
# Preqrequisites for using the stageN compiler
ifeq ($(1),0)
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
@@ -496,6 +497,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
+ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \
$$(RUSTC_FLAGS_$(2))
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
@@ -504,6 +506,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
+ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \
$$(RUSTC_FLAGS_$(2))
endef
--
2.5.0

View File

@@ -1,27 +0,0 @@
From 3572e79ac46629bafcfd8d4a19b2904031ce113c Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:48:14 -0500
Subject: [PATCH 04/10] mk: add missing CFG_LIBDIR_RELATIVE
---
mk/grammar.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mk/grammar.mk b/mk/grammar.mk
index d9c66e2..585206d 100644
--- a/mk/grammar.mk
+++ b/mk/grammar.mk
@@ -11,8 +11,8 @@
BG = $(CFG_BUILD_DIR)/grammar/
SG = $(S)src/grammar/
B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
-L = $(B)lib/rustlib/$(CFG_BUILD)/lib
-LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
+L = $(B)$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib
+LD = $(CFG_BUILD)/stage2/$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib/
RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
ifeq ($(CFG_OSTYPE),apple-darwin)
FLEX_LDFLAGS=-ll
--
2.5.0

View File

@@ -1,362 +0,0 @@
From e5177f4dfdce566fb8e59211d2c2b530e3920203 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 05/10] 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 assumes absolute paths start with '/', which may break
windows platforms
---
configure | 49 ++++++++++++++++------
mk/host.mk | 6 ++-
mk/main.mk | 11 +++++
mk/perf.mk | 4 +-
mk/prepare.mk | 4 +-
src/librustc/metadata/filesearch.rs | 84 ++++++++++++++-----------------------
src/librustc_trans/back/link.rs | 3 +-
7 files changed, 90 insertions(+), 71 deletions(-)
diff --git a/configure b/configure
index bfd2798..c07a517 100755
--- a/configure
+++ b/configure
@@ -323,6 +323,31 @@ envopt() {
fi
}
+abspath () {
+ case "$1" in
+ /*) echo "$1" ;;
+ *) echo "$PWD/$1" ;;
+ esac
+}
+
+relpath () {
+ local src=$(abspath "$1")
+ local dst=$(abspath "$2")
+ local common=$src
+ local result=
+
+ # Start by checking if the whole src is common, then strip off pack
+ # components until we find the common element.
+ while [ "${dst#"$common"}" = "$dst" ]; do
+ common=$(dirname "$common")
+ result="../$result"
+ done
+
+ local down="${dst#"$common"}"
+ result="${result}${down#/}"
+ echo "$result"
+}
+
to_llvm_triple() {
case $1 in
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
@@ -609,6 +634,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
CFG_HOST=$(to_llvm_triple $CFG_HOST)
CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
+CFG_LIBDIR_RELATIVE=lib
+
# On windows we just store the libraries in the bin directory because
# there's no rpath. This is where the build system itself puts libraries;
# --libdir is used to configure the installation directory.
@@ -616,24 +643,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
then
CFG_LIBDIR_RELATIVE=bin
-else
- CFG_LIBDIR_RELATIVE=lib
fi
-valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)"
+valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
-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_BINDIR_RELATIVE=bin
+valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries"
-CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_LIBDIR}")
if ( [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] ) \
- && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then
- err "libdir on windows should be set to 'bin'"
+ && [ "$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
if [ $HELP -eq 1 ]
@@ -1583,6 +1607,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/main.mk b/mk/main.mk
index 98024bf..73fb58b 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -339,7 +339,9 @@ export CFG_RELEASE_CHANNEL
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
ifdef CFG_DISABLE_UNSTABLE_FEATURES
CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
@@ -369,7 +371,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 fe619cc..b8aa0cb 100644
--- a/mk/prepare.mk
+++ b/mk/prepare.mk
@@ -186,10 +186,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
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/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 311ab1c..1b03b1a 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -68,8 +68,7 @@ impl<'a> FileSearch<'a> {
if !found {
let rustpath = rust_path();
for path in &rustpath {
- 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));
@@ -96,7 +95,7 @@ impl<'a> FileSearch<'a> {
where F: FnMut(&Path, PathKind) -> FileMatch
{
self.for_each_lib_search_path(|lib_search_path, kind| {
- debug!("searching {}", lib_search_path.display());
+ info!("searching {}", lib_search_path.display());
match fs::read_dir(lib_search_path) {
Ok(files) => {
let files = files.filter_map(|p| p.ok().map(|s| s.path()))
@@ -157,7 +156,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<PathBuf> {
let mut p = PathBuf::from(self.sysroot);
- p.push(&find_libdir(self.sysroot));
+ p.push(libdir_str());
p.push(&rustlibdir());
p.push(&self.triple);
p.push("bin");
@@ -165,8 +164,8 @@ impl<'a> FileSearch<'a> {
}
}
-pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf {
- let mut p = PathBuf::from(&find_libdir(sysroot));
+pub fn relative_target_lib_path(target_triple: &str) -> PathBuf {
+ let mut p = PathBuf::from(&libdir_str());
assert!(p.is_relative());
p.push(&rustlibdir());
p.push(target_triple);
@@ -176,17 +175,28 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
fn make_target_lib_path(sysroot: &Path,
target_triple: &str) -> PathBuf {
- 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) -> PathBuf {
- 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() -> PathBuf {
+ PathBuf::from(bindir_relative_str())
+}
+
+pub fn libdir_str() -> &'static str {
+ env!("CFG_LIBDIR_RELATIVE")
+}
+
pub fn get_or_default_sysroot() -> PathBuf {
// Follow symlinks. If the resolved path is relative, make it absolute.
fn canonicalize(path: Option<PathBuf>) -> Option<PathBuf> {
@@ -202,7 +212,18 @@ pub fn get_or_default_sysroot() -> PathBuf {
}
match canonicalize(env::current_exe().ok()) {
- 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")
}
}
@@ -257,47 +278,6 @@ pub fn rust_path() -> Vec<PathBuf> {
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_pointer_width = "64")]
- fn primary_libdir_name() -> String {
- "lib64".to_string()
- }
-
- #[cfg(target_pointer_width = "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 rustc's own place to organize libraries.
// Used to be "rustc", now the default is "rustlib"
pub fn rustlibdir() -> String {
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 6b8b59d..6e03f3c 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -997,11 +997,10 @@ fn link_args(cmd: &mut Linker,
// 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;
let mut 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 = PathBuf::from(install_prefix);
path.push(&tlib);
--
2.5.0

View File

@@ -1,25 +0,0 @@
From df6d2377c215240cd27f9ed3da500a09ea9da370 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 3 Dec 2014 19:15:19 -0500
Subject: [PATCH 06/10] std/thread_local: workaround for NULL __dso_handle
---
src/libstd/thread/local.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
index 6056334..e79bd8b 100644
--- a/src/libstd/thread/local.rs
+++ b/src/libstd/thread/local.rs
@@ -337,7 +337,7 @@ mod imp {
#[linkage = "extern_weak"]
static __cxa_thread_atexit_impl: *const ();
}
- if !__cxa_thread_atexit_impl.is_null() {
+ if !__cxa_thread_atexit_impl.is_null() && !__dso_handle.is_null() {
type F = unsafe extern fn(dtor: unsafe extern fn(*mut u8),
arg: *mut u8,
dso_handle: *mut u8) -> libc::c_int;
--
2.5.0

View File

@@ -1,43 +0,0 @@
From 622a5811ed511ea29080cc42a74fe50f308ce91e Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 2 Mar 2015 13:34:59 -0500
Subject: [PATCH 07/10] mk/install: use disable-rewrite-paths
This stops the install scripts from doing work we've already handled.
Path rewriting is only useful for prepackaged binary installers.
---
mk/install.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mk/install.mk b/mk/install.mk
index cabc97a..273bb0e 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -16,9 +16,9 @@ else
$(Q)$(MAKE) prepare_install
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths
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)"
+ $(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)" --disable-rewrite-paths
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -32,9 +32,9 @@ else
$(Q)$(MAKE) prepare_uninstall
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_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/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths
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)" --disable-rewrite-paths
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
--
2.5.0

View File

@@ -1,40 +0,0 @@
From cc039d1c87a417297d8c2b9ee86a3a6d9bf9ae91 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 26 May 2015 12:09:36 -0400
Subject: [PATCH 08/10] install: disable ldconfig
---
mk/install.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mk/install.mk b/mk/install.mk
index 273bb0e..58cfc99 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -16,9 +16,9 @@ else
$(Q)$(MAKE) prepare_install
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths --disable-ldconfig
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)" --disable-rewrite-paths
+ $(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)" --disable-rewrite-paths --disable-ldconfig
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
@@ -32,9 +32,9 @@ else
$(Q)$(MAKE) prepare_uninstall
endif
ifeq ($(CFG_DISABLE_DOCS),)
- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths
+ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths --disable-ldconfig
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)" --disable-rewrite-paths
+ $(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)" --disable-rewrite-paths --disable-ldconfig
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
--
2.5.0

View File

@@ -1,28 +0,0 @@
From ec110b1823638d3ddbedc29e176c1b6dd9a4a9e2 Mon Sep 17 00:00:00 2001
From: Steven Walter <swalter@lexmark.com>
Date: Tue, 7 Jul 2015 14:57:42 -0400
Subject: [PATCH 09/10] Remove crate metadata from symbol hashing
---
src/librustc_trans/back/link.rs | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 6e03f3c..9a5efba 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -204,11 +204,6 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
symbol_hasher.reset();
symbol_hasher.input_str(&link_meta.crate_name);
symbol_hasher.input_str("-");
- symbol_hasher.input_str(link_meta.crate_hash.as_str());
- for meta in tcx.sess.crate_metadata.borrow().iter() {
- symbol_hasher.input_str(&meta[..]);
- }
- symbol_hasher.input_str("-");
symbol_hasher.input_str(&encoder::encoded_ty(tcx, t));
// Prefix with 'h' so that it never blends into adjacent digits
let mut hash = String::from("h");
--
2.5.0

View File

@@ -1,36 +0,0 @@
From 64679c95a8f1fcc27702a0ada730d1fd320ab307 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 26 Aug 2015 11:21:36 -0400
Subject: [PATCH 10/10] mk: tell rustc that we're only looking for native libs
in the LLVM_LIBDIR
This fixes the case where we try to re-build & re-install rust to the
same prefix (without uninstalling) while using an llvm-root that is the
same as the prefix.
Without this, builds like that fail with:
'error: multiple dylib candidates for `std` found'
See https://github.com/jmesmon/meta-rust/issues/6 for some details.
May also be related to #20342.
---
mk/main.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/main.mk b/mk/main.mk
index 73fb58b..4075c24 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -294,7 +294,7 @@ LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
-LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
+LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))"
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
ifeq ($$(findstring freebsd,$(1)),freebsd)
--
2.5.0

View File

@@ -1,15 +0,0 @@
SRC_URI[rust.md5sum] = "e853b04d9da15055d1f8f33b45a1ae68"
SRC_URI[rust.sha256sum] = "ea6eb983daf2a073df57186a58f0d4ce0e85c711bec13c627a8c85d51b6a6d78"
## snapshot info taken from rust/src/snapshots.txt
## TODO: find a way to add aditional SRC_URIs based on the contents of an
## earlier SRC_URI.
RS_DATE = "2015-05-24"
RS_SRCHASH = "ba0e1cd"
# linux-x86_64
RS_ARCH = "linux-x86_64"
RS_HASH = "5fd8698fdfe953e6c4d86cf4fa1d5f3a0053248c"
RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-${RS_ARCH}-${RS_HASH}.tar.bz2"
SRC_URI[rust-snapshot.md5sum] = "04deb393c39d43a2abc68ebac6a0bad2"
SRC_URI[rust-snapshot.sha256sum] = "11f7f56320bd0dff5b47bae3f80377d9514a3ad4bc983d674eb33074c95d66a0"

View File

@@ -1,8 +0,0 @@
LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=47e311aa9caedd1b3abf098bd7814d1d"
# 1.1.0
require rust-release.inc
SRC_URI[rust.md5sum] = "5f2f923f8d1c77a55721d1f0813a158a"
SRC_URI[rust.sha256sum] = "cb09f443b37ec1b81fe73c04eb413f9f656859cf7d00bc5088008cbc2a63fa8a"
require rust-llvm.inc

View File

@@ -1,5 +0,0 @@
require rust-release.inc
require rust-1.2.0.inc
require rust-llvm.inc
LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa"

View File

@@ -1,34 +0,0 @@
# 1.1.0
require rust-release.inc
require rust.inc
SRC_URI[rust.md5sum] = "5f2f923f8d1c77a55721d1f0813a158a"
SRC_URI[rust.sha256sum] = "cb09f443b37ec1b81fe73c04eb413f9f656859cf7d00bc5088008cbc2a63fa8a"
## snapshot info taken from rust/src/snapshots.txt
## TODO: find a way to add aditional SRC_URIs based on the contents of an
## earlier SRC_URI.
RS_DATE = "2015-04-27"
RS_SRCHASH = "857ef6e"
# linux-x86_64
RS_HASH = "94089740e48167c5975c92c139ae9c286764012f"
RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-linux-x86_64-${RS_HASH}.tar.bz2"
SRC_URI[rust-snapshot.md5sum] = "e0d49475a787aaa9481ec0b1a28d1f7a"
SRC_URI[rust-snapshot.sha256sum] = "e7858a90c2c6c35299ebe2cb6425f3f84d0ba171dcbce20ff68295a1ff75c7e5"
# "patch-prefix"
PP = "rust-${PV}"
SRC_URI_append = "\
file://${PP}/0001-platform.mk-avoid-choking-on-i586.patch \
file://${PP}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \
file://${PP}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \
file://${PP}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://${PP}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \
file://${PP}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \
file://${PP}/0007-mk-install-use-disable-rewrite-paths.patch \
file://${PP}/0008-install-disable-ldconfig.patch \
file://${PP}/0009-src-rt-arch-i386-morestack.S-call-rust_stack_exhaust.patch \
file://${PP}/0010-disable-symbol-version-hashing.patch \
\
file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \
"

View File

@@ -1,20 +0,0 @@
require rust-release.inc
require rust.inc
require rust-1.2.0.inc
# "patch-prefix"
PP = "rust-${PV}"
SRC_URI_append = "\
file://${PP}/0001-platform.mk-avoid-choking-on-i586.patch \
file://${PP}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \
file://${PP}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \
file://${PP}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://${PP}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \
file://${PP}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \
file://${PP}/0007-mk-install-use-disable-rewrite-paths.patch \
file://${PP}/0008-install-disable-ldconfig.patch \
file://${PP}/0009-Remove-crate-metadata-from-symbol-hashing.patch \
file://${PP}/0010-mk-tell-rustc-that-we-re-only-looking-for-native-lib.patch \
\
file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \
"