2021-01-27 06:50:30 +01:00
|
|
|
{ lib, stdenvNoCC, buildPackages, makeRustPlatform }:
|
2020-07-21 22:11:36 +02:00
|
|
|
|
2020-08-20 11:46:31 +02:00
|
|
|
let
|
2021-01-27 06:50:30 +01:00
|
|
|
rpath = lib.makeLibraryPath [
|
2020-08-20 11:46:31 +02:00
|
|
|
buildPackages.stdenv.cc.libc
|
|
|
|
"$out"
|
|
|
|
];
|
|
|
|
bootstrapCrossRust = stdenvNoCC.mkDerivation {
|
|
|
|
name = "binary-redox-rust";
|
2020-10-14 23:23:37 +02:00
|
|
|
|
2020-10-20 02:17:22 +02:00
|
|
|
src = buildPackages.fetchzip {
|
2020-10-19 11:20:28 +02:00
|
|
|
name = "redox-rust-toolchain.tar.gz";
|
|
|
|
url = "https://www.dropbox.com/s/qt7as0j7cwnin8z/redox-rust-toolchain.tar.gz?dl=1";
|
2020-08-20 11:46:31 +02:00
|
|
|
sha256 = "1g17qp2q6b88p04yclkw6amm374pqlakrmw9kd86vw8z4g70jkxm";
|
|
|
|
};
|
2020-07-21 22:11:36 +02:00
|
|
|
|
2020-08-20 11:46:31 +02:00
|
|
|
dontBuild = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out/
|
|
|
|
cp -r * $out/
|
|
|
|
|
|
|
|
find $out/ -executable -type f -exec patchelf \
|
|
|
|
--set-interpreter "${buildPackages.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2" \
|
|
|
|
--set-rpath "${rpath}" \
|
|
|
|
"{}" \;
|
|
|
|
find $out/ -name "*.so" -type f -exec patchelf \
|
|
|
|
--set-rpath "${rpath}" \
|
|
|
|
"{}" \;
|
|
|
|
'';
|
|
|
|
|
2021-01-27 06:50:30 +01:00
|
|
|
meta.platforms = with lib; platforms.redox ++ platforms.linux;
|
2020-08-20 11:46:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
redoxRustPlatform = buildPackages.makeRustPlatform {
|
|
|
|
rustc = bootstrapCrossRust;
|
|
|
|
cargo = bootstrapCrossRust;
|
2020-07-21 22:11:36 +02:00
|
|
|
};
|
|
|
|
|
2020-08-20 11:46:31 +02:00
|
|
|
in
|
|
|
|
redoxRustPlatform.buildRustPackage rec {
|
|
|
|
pname = "relibc";
|
|
|
|
version = "latest";
|
|
|
|
|
|
|
|
LD_LIBRARY_PATH = "${buildPackages.zlib}/lib";
|
2020-07-21 22:11:36 +02:00
|
|
|
|
2020-08-20 11:46:31 +02:00
|
|
|
src = buildPackages.fetchgit {
|
|
|
|
url = "https://gitlab.redox-os.org/redox-os/relibc/";
|
|
|
|
rev = "5af8e3ca35ad401014a867ac1a0cc3b08dee682b";
|
|
|
|
sha256 = "1j4wsga9psl453031izkl3clkvm31d1wg4y8f3yqqvhml2aliws5";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
|
|
|
dontInstall = true;
|
|
|
|
dontFixup = true;
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
mkdir -p $out
|
|
|
|
DESTDIR=$out make install
|
2020-07-21 22:11:36 +02:00
|
|
|
'';
|
|
|
|
|
2020-10-14 05:37:29 +02:00
|
|
|
# TODO: should be hostPlatform
|
|
|
|
TARGET = buildPackages.rust.toRustTargetSpec stdenvNoCC.targetPlatform;
|
2020-08-20 11:46:31 +02:00
|
|
|
|
|
|
|
cargoSha256 = "1fzz7ba3ga57x1cbdrcfrdwwjr70nh4skrpxp4j2gak2c3scj6rz";
|
|
|
|
|
2021-01-27 06:50:30 +01:00
|
|
|
meta = with lib; {
|
2020-07-21 22:11:36 +02:00
|
|
|
homepage = "https://gitlab.redox-os.org/redox-os/relibc";
|
|
|
|
description = "C Library in Rust for Redox and Linux";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.aaronjanse ];
|
2021-12-09 22:31:51 +01:00
|
|
|
platforms = platforms.redox ++ [ "x86_64-linux" ];
|
2020-07-21 22:11:36 +02:00
|
|
|
};
|
|
|
|
}
|