diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2014-07-31 20:42:20 +0200 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2014-07-31 20:42:20 +0200 |
commit | 584114b697dfb4fd3c248207f7a6e9c8cda3f81a (patch) | |
tree | 1fcda7bc7c5a2c52dba7bd506ffdaa4e71657d31 /pkgs/development/compilers/rust | |
parent | a510e024b6d3540ba4d8764631a642a94b52ee54 (diff) | |
download | nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar.gz nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar.bz2 nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar.lz nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar.xz nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.tar.zst nixpkgs-584114b697dfb4fd3c248207f7a6e9c8cda3f81a.zip |
rust: Add an alternative package for the master tip
based off of pull request #3084
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r-- | pkgs/development/compilers/rust/head.nix | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix new file mode 100644 index 00000000000..ad33906ae6e --- /dev/null +++ b/pkgs/development/compilers/rust/head.nix @@ -0,0 +1,73 @@ +{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; +} |