mrustc: 0.9 -> 0.10
And switch from Rust 1.29 to 1.54, as this is the top version supported by mrustc
This commit is contained in:
parent
da7761caca
commit
fd3641ec26
4 changed files with 43 additions and 38 deletions
|
@ -3,8 +3,8 @@
|
|||
, mrustc
|
||||
, mrustc-minicargo
|
||||
, rust
|
||||
, llvm_7
|
||||
, llvmPackages_7
|
||||
, llvm_12
|
||||
, llvmPackages_12
|
||||
, libffi
|
||||
, cmake
|
||||
, python3
|
||||
|
@ -18,12 +18,14 @@
|
|||
}:
|
||||
|
||||
let
|
||||
rustcVersion = "1.29.0";
|
||||
mrustcTargetVersion = "1.54";
|
||||
rustcVersion = "1.54.0";
|
||||
rustcSrc = fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/rustc-${rustcVersion}-src.tar.gz";
|
||||
sha256 = "1sb15znckj8pc8q3g7cq03pijnida6cg64yqmgiayxkzskzk9sx4";
|
||||
sha256 = "0xk9dhfff16caambmwij67zgshd8v9djw6ha0fnnanlv7rii31dc";
|
||||
};
|
||||
rustcDir = "rustc-${rustcVersion}-src";
|
||||
outputDir = "output-${rustcVersion}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -37,20 +39,12 @@ stdenv.mkDerivation rec {
|
|||
dontFixLibtool = true;
|
||||
|
||||
patches = [
|
||||
./patches/0001-use-shared-llvm.patch
|
||||
./patches/0002-dont-build-llvm.patch
|
||||
./patches/0003-echo-newlines.patch
|
||||
./patches/0004-increase-parallelism.patch
|
||||
./patches/0001-dont-download-rustc.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
echo "applying patch ./rustc-${rustcVersion}-src.patch"
|
||||
patch -p0 -d ${rustcDir}/ < rustc-${rustcVersion}-src.patch
|
||||
|
||||
for p in ${lib.concatStringsSep " " llvmPackages_7.compiler-rt.patches}; do
|
||||
echo "applying patch $p"
|
||||
patch -p1 -d ${rustcDir}/src/libcompiler_builtins/compiler-rt < $p
|
||||
done
|
||||
'';
|
||||
|
||||
# rustc unfortunately needs cmake to compile llvm-rt but doesn't
|
||||
|
@ -69,7 +63,7 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
buildInputs = [
|
||||
# for rustc
|
||||
llvm_7 libffi zlib libxml2
|
||||
llvm_12 libffi zlib libxml2
|
||||
# for cargo
|
||||
openssl
|
||||
(curl.override { inherit openssl; })
|
||||
|
@ -79,7 +73,7 @@ stdenv.mkDerivation rec {
|
|||
# Use shared mrustc/minicargo/llvm instead of rebuilding them
|
||||
"MRUSTC=${mrustc}/bin/mrustc"
|
||||
"MINICARGO=${mrustc-minicargo}/bin/minicargo"
|
||||
"LLVM_CONFIG=${llvm_7.dev}/bin/llvm-config"
|
||||
"LLVM_CONFIG=${llvm_12.dev}/bin/llvm-config"
|
||||
"RUSTC_TARGET=${rust.toRustTarget stdenv.targetPlatform}"
|
||||
];
|
||||
|
||||
|
@ -91,26 +85,26 @@ stdenv.mkDerivation rec {
|
|||
${toString makeFlags}
|
||||
)
|
||||
|
||||
touch ${rustcDir}/dl-version
|
||||
export OUTDIR_SUF=-${rustcVersion}
|
||||
export RUSTC_VERSION=${rustcVersion}
|
||||
export MRUSTC_TARGET_VER=${mrustcTargetVersion}
|
||||
|
||||
echo minicargo.mk: libs
|
||||
make -f minicargo.mk "''${flagsArray[@]}" LIBS
|
||||
|
||||
echo minicargo.mk: deps
|
||||
mkdir -p output/cargo-build
|
||||
# minicargo has concurrency issues when running these; let's build them
|
||||
# without parallelism
|
||||
for crate in regex regex-0.2.11 curl-sys
|
||||
do
|
||||
echo "building $crate"
|
||||
minicargo ${rustcDir}/src/vendor/$crate \
|
||||
--vendor-dir ${rustcDir}/src/vendor \
|
||||
--output-dir output/cargo-build -L output/
|
||||
done
|
||||
echo test
|
||||
make "''${flagsArray[@]}" test
|
||||
|
||||
# disabled because it expects ./bin/mrustc
|
||||
#echo local_tests
|
||||
#make "''${flagsArray[@]}" local_tests
|
||||
|
||||
echo minicargo.mk: rustc
|
||||
make -f minicargo.mk "''${flagsArray[@]}" output/rustc
|
||||
make -f minicargo.mk "''${flagsArray[@]}" ${outputDir}/rustc
|
||||
|
||||
echo minicargo.mk: cargo
|
||||
make -f minicargo.mk "''${flagsArray[@]}" output/cargo
|
||||
make -f minicargo.mk "''${flagsArray[@]}" ${outputDir}/cargo
|
||||
|
||||
echo run_rustc
|
||||
make -C run_rustc "''${flagsArray[@]}"
|
||||
|
@ -123,17 +117,17 @@ stdenv.mkDerivation rec {
|
|||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
run_rustc/output/prefix/bin/hello_world | grep "hello, world"
|
||||
run_rustc/${outputDir}/prefix/bin/hello_world | grep "hello, world"
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin/ $out/lib/
|
||||
cp run_rustc/output/prefix/bin/cargo $out/bin/cargo
|
||||
cp run_rustc/output/prefix/bin/rustc_binary $out/bin/rustc
|
||||
cp run_rustc/${outputDir}/prefix/bin/cargo $out/bin/cargo
|
||||
cp run_rustc/${outputDir}/prefix/bin/rustc_binary $out/bin/rustc
|
||||
|
||||
cp -r run_rustc/output/prefix/lib/* $out/lib/
|
||||
cp -r run_rustc/${outputDir}/prefix/lib/* $out/lib/
|
||||
cp $out/lib/rustlib/${rust.toRustTarget stdenv.targetPlatform}/lib/*.so $out/lib/
|
||||
runHook postInstall
|
||||
'';
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
}:
|
||||
|
||||
let
|
||||
version = "0.9";
|
||||
version = "0.10";
|
||||
tag = "v${version}";
|
||||
rev = "15773561e40ca5c8cffe0a618c544b6cfdc5ad7e";
|
||||
rev = "b364724f15fd6fce8234ad8add68107c23a22151";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
|
|||
owner = "thepowersgang";
|
||||
repo = "mrustc";
|
||||
rev = tag;
|
||||
sha256 = "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2";
|
||||
sha256 = "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
|
|
|
@ -12,14 +12,14 @@ stdenv.mkDerivation rec {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
makefile = "minicargo.mk";
|
||||
makeFlags = [ "tools/bin/minicargo" ];
|
||||
makeFlags = [ "bin/minicargo" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
cp tools/bin/minicargo $out/bin
|
||||
cp bin/minicargo $out/bin
|
||||
|
||||
# without it, minicargo defaults to "<minicargo_path>/../../bin/mrustc"
|
||||
# without it, minicargo defaults to "<minicargo_path>/../bin/mrustc"
|
||||
wrapProgram "$out/bin/minicargo" --set MRUSTC_PATH ${mrustc}/bin/mrustc
|
||||
runHook postInstall
|
||||
'';
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- a/minicargo.mk 2023-04-06 08:26:18.408817572 +0200
|
||||
+++ b/minicargo.mk 2023-04-06 08:27:11.553536996 +0200
|
||||
@@ -176,7 +176,7 @@
|
||||
@echo [CURL] $@
|
||||
@rm -f $@
|
||||
@curl -sS https://static.rust-lang.org/dist/$@ -o $@
|
||||
-$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
|
||||
+$(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src.patch
|
||||
tar -xf $(RUSTC_SRC_TARBALL)
|
||||
cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
|
||||
touch $(RUSTC_SRC_DL)
|
Loading…
Reference in a new issue