lol

rust: add support for armv6l-linux and armv7l-linux

+32 -50
+2 -13
pkgs/build-support/rust/build-rust-crate/build-crate.nix
··· 1 - { lib, stdenv, echo_build_heading, noisily, makeDeps }: 1 + { lib, stdenv, echo_build_heading, noisily, makeDeps, rust }: 2 2 { crateName, 3 3 dependencies, 4 4 crateFeatures, crateRenames, libName, release, libPath, ··· 13 13 (if release then "-C opt-level=3" else "-C debuginfo=2") 14 14 (["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts); 15 15 rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}"; 16 - 17 - # Some platforms have different names for rustc. 18 - rustPlatform = 19 - with stdenv.hostPlatform.parsed; 20 - let cpu_ = if cpu.name == "armv7a" then "armv7" 21 - else cpu.name; 22 - vendor_ = vendor.name; 23 - kernel_ = kernel.name; 24 - abi_ = abi.name; 25 - in 26 - "${cpu_}-${vendor_}-${kernel_}-${abi_}"; 27 16 in '' 28 17 runHook preBuild 29 18 norm="" ··· 67 56 ${crateFeatures} --out-dir target/bin --emit=dep-info,link -L dependency=target/deps \ 68 57 $LINK ${deps}$EXTRA_LIB --cap-lints allow \ 69 58 $BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors} \ 70 - ${if stdenv.hostPlatform != stdenv.buildPlatform then "--target ${rustPlatform} -C linker=${stdenv.hostPlatform.config}-gcc" else ""} 59 + ${if stdenv.hostPlatform != stdenv.buildPlatform then "--target ${rust.toRustTarget stdenv.hostPlatform} -C linker=${stdenv.hostPlatform.config}-gcc" else ""} 71 60 if [ "$crate_name_" != "$crate_name" ]; then 72 61 mv target/bin/$crate_name_ target/bin/$crate_name 73 62 fi
+2 -2
pkgs/build-support/rust/build-rust-crate/default.nix
··· 4 4 # This can be useful for deploying packages with NixOps, and to share 5 5 # binary dependencies between projects. 6 6 7 - { lib, stdenv, defaultCrateOverrides, fetchCrate, rustc }: 7 + { lib, stdenv, defaultCrateOverrides, fetchCrate, rustc, rust }: 8 8 9 9 let 10 10 # This doesn't appear to be officially documented anywhere yet. ··· 59 59 ''; 60 60 61 61 configureCrate = import ./configure-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps; }; 62 - buildCrate = import ./build-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps; }; 62 + buildCrate = import ./build-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps rust; }; 63 63 installCrate = import ./install-crate.nix; 64 64 65 65 in
+7 -12
pkgs/build-support/rust/default.nix
··· 1 - { stdenv, cacert, git, cargo, rustc, fetchcargo, buildPackages, windows }: 1 + { stdenv, cacert, git, rust, cargo, rustc, fetchcargo, buildPackages, windows }: 2 2 3 3 { name ? "${args.pname}-${args.version}" 4 4 , cargoSha256 ? "unset" ··· 46 46 cargoDepsCopy="$sourceRoot/${cargoVendorDir}" 47 47 ''; 48 48 49 - hostConfig = stdenv.hostPlatform.config; 50 - 51 - rustHostConfig = { 52 - x86_64-pc-mingw32 = "x86_64-pc-windows-gnu"; 53 - }.${hostConfig} or hostConfig; 54 - rustTarget = if target == null then rustHostConfig else target; 49 + rustTarget = if target == null then rust.toRustTarget stdenv.hostPlatform else target; 55 50 56 51 ccForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; 57 52 cxxForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; ··· 87 82 --subst-var-by vendor "$(pwd)/$cargoDepsCopy" 88 83 89 84 cat >> .cargo/config <<'EOF' 90 - [target."${stdenv.buildPlatform.config}"] 85 + [target."${rust.toRustTarget stdenv.buildPlatform}"] 91 86 "linker" = "${ccForBuild}" 92 87 ${stdenv.lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' 93 88 [target."${rustTarget}"] ··· 129 124 ( 130 125 set -x 131 126 env \ 132 - "CC_${stdenv.buildPlatform.config}"="${ccForBuild}" \ 133 - "CXX_${stdenv.buildPlatform.config}"="${cxxForBuild}" \ 134 - "CC_${stdenv.hostPlatform.config}"="${ccForHost}" \ 135 - "CXX_${stdenv.hostPlatform.config}"="${cxxForHost}" \ 127 + "CC_${rust.toRustTarget stdenv.buildPlatform}"="${ccForBuild}" \ 128 + "CXX_${rust.toRustTarget stdenv.buildPlatform}"="${cxxForBuild}" \ 129 + "CC_${rust.toRustTarget stdenv.hostPlatform}"="${ccForHost}" \ 130 + "CXX_${rust.toRustTarget stdenv.hostPlatform}"="${cxxForHost}" \ 136 131 cargo build \ 137 132 ${stdenv.lib.optionalString (buildType == "release") "--release"} \ 138 133 --target ${rustTarget} \
+1
pkgs/development/compilers/rust/1_38_0.nix
··· 10 10 bootstrapHashes = { 11 11 i686-unknown-linux-gnu = "74510e0e52a55e65a9f716673c2cda4d2bd427e2453541c6993c77c3ec04acf9"; 12 12 x86_64-unknown-linux-gnu = "cb573229bfd32928177c3835fdeb62d52da64806b844bc1095c6225b0665a1cb"; 13 + arm-unknown-linux-gnueabihf = "272739fbb23cf6c2040c1813af9c8c7f386cac37d9de638f22a1816eb96bc0ae"; 13 14 armv7-unknown-linux-gnueabihf = "5b87b877f0ed20c6a09ce26e7a15d8c61b26b62484b97e78a51099d0efefec98"; 14 15 aarch64-unknown-linux-gnu = "263ef98fa3a6b2911b56f89c06615cdebf6ef676eb9b2493ad1539602f79b6ba"; 15 16 i686-apple-darwin = "e45d0c4d882fc6c404ffa6fe790294f4ea96384a2b48804adbf723f3635477a8";
+1
pkgs/development/compilers/rust/1_39_0.nix
··· 10 10 bootstrapHashes = { 11 11 i686-unknown-linux-gnu = "41aed8a350e24a0cac1444ed99b3dd24a90bc581dd88cb420c6e547d6b5f57af"; 12 12 x86_64-unknown-linux-gnu = "adda26b3f0609dbfbdc2019da4a20101879b9db2134fae322a4e863a069ec221"; 13 + arm-unknown-linux-gnueabihf = "0603a3d3d16ae8f3b3b117eb699e8f3ef7532a6f6d3c29d13e7d4614fc3c9e7a"; 13 14 armv7-unknown-linux-gnueabihf = "8b1bf1680a61a643d6b5c7a3b1a1ce88448652756395e20ba5846739cbd085c4"; 14 15 aarch64-unknown-linux-gnu = "06afd6d525326cea95c3aa658aaa8542eab26f44235565bb16913ac9d12b7bda"; 15 16 i686-apple-darwin = "cdbf2807774bed350a3af6f41d7f7dd7ceff28777cde310c3ba90033188eb2f8";
+3 -16
pkgs/development/compilers/rust/bootstrap.nix
··· 1 - { stdenv, fetchurl, callPackage, version, hashes }: 1 + { stdenv, fetchurl, rust, callPackage, version, hashes }: 2 2 3 3 let 4 - platform = 5 - if stdenv.hostPlatform.system == "i686-linux" 6 - then "i686-unknown-linux-gnu" 7 - else if stdenv.hostPlatform.system == "x86_64-linux" 8 - then "x86_64-unknown-linux-gnu" 9 - else if stdenv.hostPlatform.system == "armv7l-linux" 10 - then "armv7-unknown-linux-gnueabihf" 11 - else if stdenv.hostPlatform.system == "aarch64-linux" 12 - then "aarch64-unknown-linux-gnu" 13 - else if stdenv.hostPlatform.system == "i686-darwin" 14 - then "i686-apple-darwin" 15 - else if stdenv.hostPlatform.system == "x86_64-darwin" 16 - then "x86_64-apple-darwin" 17 - else throw "missing bootstrap url for platform ${stdenv.hostPlatform.system}"; 4 + platform = rust.toRustTarget stdenv.hostPlatform; 18 5 19 6 src = fetchurl { 20 7 url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; 21 - sha256 = hashes.${platform}; 8 + sha256 = hashes.${platform} or (throw "missing bootstrap url for platform ${platform}"); 22 9 }; 23 10 24 11 in callPackage ./binary.nix
+8
pkgs/development/compilers/rust/default.nix
··· 11 11 , llvmPackages_5 12 12 , pkgsBuildTarget, pkgsBuildBuild 13 13 }: rec { 14 + toRustTarget = platform: with platform.parsed; let 15 + cpu_ = { 16 + "armv7a" = "armv7"; 17 + "armv7l" = "armv7"; 18 + "armv6l" = "arm"; 19 + }.${cpu.name} or cpu.name; 20 + in "${cpu_}-${vendor.name}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}"; 21 + 14 22 makeRustPlatform = { rustc, cargo, ... }: { 15 23 rust = { 16 24 inherit rustc cargo;
+1
pkgs/development/compilers/rust/print-hashes.sh
··· 10 10 PLATFORMS=( 11 11 i686-unknown-linux-gnu 12 12 x86_64-unknown-linux-gnu 13 + arm-unknown-linux-gnueabihf 13 14 armv7-unknown-linux-gnueabihf 14 15 aarch64-unknown-linux-gnu 15 16 i686-apple-darwin
+7 -7
pkgs/development/compilers/rust/rustc.nix
··· 1 1 { stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget 2 2 , fetchurl, file, python2 3 - , llvm_9, darwin, git, cmake, rustPlatform 3 + , llvm_9, darwin, git, cmake, rust, rustPlatform 4 4 , pkgconfig, openssl 5 5 , which, libffi 6 6 , withBundledLLVM ? false ··· 53 53 # We need rust to build rust. If we don't provide it, configure will try to download it. 54 54 # Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py 55 55 configureFlags = let 56 - setBuild = "--set=target.${stdenv.buildPlatform.config}"; 57 - setHost = "--set=target.${stdenv.hostPlatform.config}"; 58 - setTarget = "--set=target.${stdenv.targetPlatform.config}"; 56 + setBuild = "--set=target.${rust.toRustTarget stdenv.buildPlatform}"; 57 + setHost = "--set=target.${rust.toRustTarget stdenv.hostPlatform}"; 58 + setTarget = "--set=target.${rust.toRustTarget stdenv.targetPlatform}"; 59 59 ccForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}cc"; 60 60 cxxForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}c++"; 61 61 ccForHost = "${pkgsBuildHost.targetPackages.stdenv.cc}/bin/${pkgsBuildHost.targetPackages.stdenv.cc.targetPrefix}cc"; ··· 68 68 "--set=build.cargo=${rustPlatform.rust.cargo}/bin/cargo" 69 69 "--enable-rpath" 70 70 "--enable-vendor" 71 - "--build=${stdenv.buildPlatform.config}" 72 - "--host=${stdenv.hostPlatform.config}" 73 - "--target=${stdenv.targetPlatform.config}" 71 + "--build=${rust.toRustTarget stdenv.buildPlatform}" 72 + "--host=${rust.toRustTarget stdenv.hostPlatform}" 73 + "--target=${rust.toRustTarget stdenv.targetPlatform}" 74 74 75 75 "${setBuild}.cc=${ccForBuild}" 76 76 "${setHost}.cc=${ccForHost}"