2020-04-18 15:43:58 +02:00
|
|
|
{ lib, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-10-18 05:05:17 +02:00
|
|
|
version = "0.10.1";
|
2020-04-18 15:43:58 +02:00
|
|
|
tag = "v${version}";
|
2023-10-18 05:05:17 +02:00
|
|
|
rev = "b6754f574f8846eb842feba4ccbeeecb10bdfacc";
|
2020-04-18 15:43:58 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mrustc";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
# Always update minicargo.nix and bootstrap.nix in lockstep with this
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "thepowersgang";
|
|
|
|
repo = "mrustc";
|
|
|
|
rev = tag;
|
2023-10-18 05:05:17 +02:00
|
|
|
hash = "sha256-sYnx5dUTaQbK4ugnSzAJwIUwZKPUhThmNA+WlY+LEWc=";
|
2020-04-18 15:43:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/\$(shell git show --pretty=%H -s)/${rev}/' Makefile
|
|
|
|
sed -i 's/\$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/${tag}/' Makefile
|
|
|
|
sed -i 's/\$(shell git diff-index --quiet HEAD; echo $$?)/0/' Makefile
|
2022-04-17 10:14:55 +02:00
|
|
|
sed '1i#include <limits>' -i src/trans/codegen_c.cpp
|
2020-04-18 15:43:58 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
buildInputs = [ zlib ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bin/mrustc $out/bin
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Mutabah's Rust Compiler";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "mrustc";
|
2020-04-18 15:43:58 +02:00
|
|
|
longDescription = ''
|
|
|
|
In-progress alternative rust compiler, written in C++.
|
|
|
|
Capable of building a fully-working copy of rustc,
|
|
|
|
but not yet suitable for everyday use.
|
|
|
|
'';
|
|
|
|
inherit (src.meta) homepage;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ progval r-burns ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|