rustc: rename rust to rustc, but keep rust attr name for backwards compat
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
{stdenv, fetchurl, which, file, perl, curl, python27, makeWrapper}:
|
||||
|
||||
/* Rust's build process has a few quirks :
|
||||
|
||||
- It requires some patched in llvm that haven't landed upstream, so it
|
||||
compiles its own llvm. This might change in the future, so at some
|
||||
point we may be able to switch to nix's llvm.
|
||||
|
||||
- The Rust compiler is written is Rust, so it requires a bootstrap
|
||||
compiler, which is downloaded during the build. To make the build
|
||||
pure, we download it ourself before and put it where it is
|
||||
expected. Once the language is stable (1.0) , we might want to
|
||||
switch it to use nix's packaged rust compiler.
|
||||
|
||||
*/
|
||||
|
||||
with ((import ./common.nix) {inherit stdenv; version = "0.11.0"; });
|
||||
|
||||
let snapshot = if stdenv.system == "i686-linux"
|
||||
then "84339ea0f796ae468ef86797ef4587274bec19ea"
|
||||
else if stdenv.system == "x86_64-linux"
|
||||
then "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae"
|
||||
else if stdenv.system == "i686-darwin"
|
||||
then "3f25b2680efbab16ad074477a19d49dcce475977"
|
||||
else if stdenv.system == "x86_64-darwin"
|
||||
then "4a8c2e1b7634d73406bac32a1a97893ec3ed818d"
|
||||
else abort "no-snapshot for platform ${stdenv.system}";
|
||||
snapshotDate = "2014-06-21";
|
||||
snapshotRev = "db9af1d";
|
||||
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2";
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit name;
|
||||
inherit version;
|
||||
inherit meta;
|
||||
|
||||
src = fetchurl {
|
||||
url = http://static.rust-lang.org/dist/rust-0.11.0.tar.gz;
|
||||
sha256 = "1fhi8iiyyj5j48fpnp93sfv781z1dm0xy94h534vh4mz91jf7cyi";
|
||||
};
|
||||
|
||||
# We need rust to build rust. If we don't provide it, configure will try to download it.
|
||||
snapshot = stdenv.mkDerivation {
|
||||
name = "rust-stage0";
|
||||
src = fetchurl {
|
||||
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
|
||||
sha1 = snapshot;
|
||||
};
|
||||
dontStrip = true;
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp -r bin "$out/bin"
|
||||
'' + (if stdenv.isLinux then ''
|
||||
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.gcc.dynamicLinker}" \
|
||||
--set-rpath "${stdenv.gcc.gcc}/lib/:${stdenv.gcc.gcc}/lib64/" \
|
||||
"$out/bin/rustc"
|
||||
'' else "");
|
||||
};
|
||||
|
||||
configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ];
|
||||
|
||||
# The compiler requires cc, so we patch the source to tell it where to find it
|
||||
patches = [ ./hardcode_paths.patch ./local_stage0.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace src/librustc/back/link.rs \
|
||||
--subst-var-by "ccPath" "${stdenv.gcc}/bin/cc" \
|
||||
--subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar"
|
||||
'';
|
||||
|
||||
buildInputs = [ which file perl curl python27 makeWrapper ];
|
||||
enableParallelBuilding = true;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{stdenv, version}:
|
||||
|
||||
{
|
||||
inherit version;
|
||||
|
||||
platform = if stdenv.system == "i686-linux"
|
||||
then "linux-i386"
|
||||
else if stdenv.system == "x86_64-linux"
|
||||
then "linux-x86_64"
|
||||
else if stdenv.system == "i686-darwin"
|
||||
then "macos-i386"
|
||||
else if stdenv.system == "x86_64-darwin"
|
||||
then "macos-x86_64"
|
||||
else abort "no snapshot to boostrap for this platform (missing platform url suffix)";
|
||||
|
||||
target = if stdenv.system == "i686-linux"
|
||||
then "i686-unknown-linux-gnu"
|
||||
else if stdenv.system == "x86_64-linux"
|
||||
then "x86_64-unknown-linux-gnu"
|
||||
else if stdenv.system == "i686-darwin"
|
||||
then "i686-apple-darwin"
|
||||
else if stdenv.system == "x86_64-darwin"
|
||||
then "x86_64-apple-darwin"
|
||||
else abort "no snapshot to boostrap for this platform (missing target triple";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ madjar cstrahan ];
|
||||
license = map (builtins.getAttr "shortName") [ licenses.mit licenses.asl20 ];
|
||||
# platforms as per http://static.rust-lang.org/doc/master/tutorial.html#getting-started
|
||||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
||||
};
|
||||
|
||||
name = "rust-${version}";
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
|
||||
index 7a3e912..ced75fa 100644
|
||||
--- a/src/librustc/back/link.rs
|
||||
+++ b/src/librustc/back/link.rs
|
||||
@@ -766,24 +766,15 @@ pub fn output_lib_filename(id: &CrateId) -> String {
|
||||
|
||||
pub fn get_cc_prog(sess: &Session) -> String {
|
||||
match sess.opts.cg.linker {
|
||||
- Some(ref linker) => return linker.to_string(),
|
||||
- None => {}
|
||||
+ Some(ref linker) => linker.to_string(),
|
||||
+ None => "@ccPath@".to_string()
|
||||
}
|
||||
-
|
||||
- // In the future, FreeBSD will use clang as default compiler.
|
||||
- // It would be flexible to use cc (system's default C compiler)
|
||||
- // instead of hard-coded gcc.
|
||||
- // For win32, there is no cc command, so we add a condition to make it use gcc.
|
||||
- match sess.targ_cfg.os {
|
||||
- abi::OsWin32 => "gcc",
|
||||
- _ => "cc",
|
||||
- }.to_string()
|
||||
}
|
||||
|
||||
pub fn get_ar_prog(sess: &Session) -> String {
|
||||
match sess.opts.cg.ar {
|
||||
Some(ref ar) => (*ar).clone(),
|
||||
- None => "ar".to_string()
|
||||
+ None => "@arPath@".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
{stdenv, fetchurl, fetchgit, which, file, perl, curl, python27, makeWrapper}:
|
||||
|
||||
/* Rust's build process has a few quirks :
|
||||
|
||||
- It requires some patched in llvm that haven't landed upstream, so it
|
||||
compiles its own llvm. This might change in the future, so at some
|
||||
point we may be able to switch to nix's llvm.
|
||||
|
||||
- The Rust compiler is written is Rust, so it requires a bootstrap
|
||||
compiler, which is downloaded during the build. To make the build
|
||||
pure, we download it ourself before and put it where it is
|
||||
expected. Once the language is stable (1.0) , we might want to
|
||||
switch it to use nix's packaged rust compiler.
|
||||
|
||||
*/
|
||||
|
||||
with ((import ./common.nix) {inherit stdenv; version = "0.12.0-pre-7a25cf3f3"; });
|
||||
|
||||
let snapshot = if stdenv.system == "i686-linux"
|
||||
then "a5e1bb723020ac35173d49600e76b0935e257a6a"
|
||||
else if stdenv.system == "x86_64-linux"
|
||||
then "1a2407df17442d93d1c34c916269a345658045d7"
|
||||
else if stdenv.system == "i686-darwin"
|
||||
then "6648fa88e41ad7c0991a085366e36d56005873ca"
|
||||
else if stdenv.system == "x86_64-darwin"
|
||||
then "71b2d1dfd0abe1052908dc091e098ed22cf272c6"
|
||||
else abort "no-snapshot for platform ${stdenv.system}";
|
||||
snapshotDate = "2014-07-17";
|
||||
snapshotRev = "9fc8394";
|
||||
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2";
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit name;
|
||||
inherit version;
|
||||
inherit meta;
|
||||
|
||||
src = fetchgit {
|
||||
url = https://github.com/rust-lang/rust;
|
||||
rev = "7a25cf3f30fa5fae2e868fa910ecc850f5e9ee65";
|
||||
sha256 = "1hx8vd4gn5plbdvr0zvdvqyw9x9r2vbmh112h2f5d2xxsf9p7rf1";
|
||||
};
|
||||
|
||||
# We need rust to build rust. If we don't provide it, configure will try to download it.
|
||||
snapshot = stdenv.mkDerivation {
|
||||
name = "rust-stage0";
|
||||
src = fetchurl {
|
||||
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
|
||||
sha1 = snapshot;
|
||||
};
|
||||
dontStrip = true;
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp -r bin "$out/bin"
|
||||
'' + (if stdenv.isLinux then ''
|
||||
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.gcc.dynamicLinker}" \
|
||||
--set-rpath "${stdenv.gcc.gcc}/lib/:${stdenv.gcc.gcc}/lib64/" \
|
||||
"$out/bin/rustc"
|
||||
'' else "");
|
||||
};
|
||||
|
||||
configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ];
|
||||
|
||||
# The compiler requires cc, so we patch the source to tell it where to find it
|
||||
patches = [ ./hardcode_paths.patch ./local_stage0.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace src/librustc/back/link.rs \
|
||||
--subst-var-by "ccPath" "${stdenv.gcc}/bin/cc" \
|
||||
--subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar"
|
||||
'';
|
||||
|
||||
buildInputs = [ which file perl curl python27 makeWrapper ];
|
||||
enableParallelBuilding = true;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh
|
||||
index e78f231..6b6773b 100755
|
||||
--- a/src/etc/local_stage0.sh
|
||||
+++ b/src/etc/local_stage0.sh
|
||||
@@ -53,8 +53,3 @@ if [ -z $TARG_DIR ]; then
|
||||
fi
|
||||
|
||||
cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
|
||||
-cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
|
||||
Reference in New Issue
Block a user