Merge pull request #95848 from aaronjanse/aj-relibc-from-source
relibc: build from source
This commit is contained in:
commit
156fe85c5f
@ -1,27 +1,72 @@
|
|||||||
{ stdenvNoCC, buildPackages, fetchurl }:
|
{ stdenvNoCC, buildPackages, makeRustPlatform }:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
let
|
||||||
name = "binary-relibc-latest";
|
rpath = stdenvNoCC.lib.makeLibraryPath [
|
||||||
|
buildPackages.stdenv.cc.libc
|
||||||
|
"$out"
|
||||||
|
];
|
||||||
|
bootstrapCrossRust = stdenvNoCC.mkDerivation {
|
||||||
|
name = "binary-redox-rust";
|
||||||
|
|
||||||
# snapshot of https://static.redox-os.org/toolchain/x86_64-unknown-redox/relibc-install.tar.gz
|
src = fetchTarball {
|
||||||
src = fetchurl {
|
name = "redox-rust-toolchain-bin.tar.gz";
|
||||||
name = "relibc-install.tar.gz";
|
url = "https://www.dropbox.com/s/33r92en0t47l1ei/redox-rust-toolchain-bin.tar.gz?dl=1";
|
||||||
url = "https://gateway.pinata.cloud/ipfs/QmNp6fPTjPA6LnCYvW1UmbAHcPpU7tqZhstfSpSXMJCRwp";
|
sha256 = "1g17qp2q6b88p04yclkw6amm374pqlakrmw9kd86vw8z4g70jkxm";
|
||||||
sha256 = "1hjdzrj67jdag3pm8h2dqh6xipbfxr6f4navdra6q1h83gl7jkd9";
|
};
|
||||||
|
|
||||||
|
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}" \
|
||||||
|
"{}" \;
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.platforms = with stdenvNoCC.lib; platforms.redox ++ platforms.linux;
|
||||||
};
|
};
|
||||||
|
|
||||||
# to avoid "unpacker produced multiple directories"
|
redoxRustPlatform = buildPackages.makeRustPlatform {
|
||||||
unpackPhase = "unpackFile $src";
|
rustc = bootstrapCrossRust;
|
||||||
|
cargo = bootstrapCrossRust;
|
||||||
|
};
|
||||||
|
|
||||||
dontBuild = true;
|
in
|
||||||
dontPatchELF = true;
|
redoxRustPlatform.buildRustPackage rec {
|
||||||
dontStrip = true;
|
pname = "relibc";
|
||||||
installPhase = ''
|
version = "latest";
|
||||||
mkdir $out/
|
|
||||||
cp -r x86_64-unknown-redox/* $out/
|
LD_LIBRARY_PATH = "${buildPackages.zlib}/lib";
|
||||||
rm -rf $out/bin
|
|
||||||
|
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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
TARGET = buildPackages.rust.toRustTarget stdenvNoCC.targetPlatform;
|
||||||
|
|
||||||
|
cargoSha256 = "1fzz7ba3ga57x1cbdrcfrdwwjr70nh4skrpxp4j2gak2c3scj6rz";
|
||||||
|
|
||||||
meta = with stdenvNoCC.lib; {
|
meta = with stdenvNoCC.lib; {
|
||||||
homepage = "https://gitlab.redox-os.org/redox-os/relibc";
|
homepage = "https://gitlab.redox-os.org/redox-os/relibc";
|
||||||
description = "C Library in Rust for Redox and Linux";
|
description = "C Library in Rust for Redox and Linux";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user