microscheme: refactor, fix build on darwin and cross-compilation

This commit is contained in:
Ben Siraphob 2021-02-17 13:05:55 +07:00
parent 028ebdb0b0
commit f40849784a

View file

@ -1,21 +1,24 @@
{ lib, stdenv, fetchzip, vim, makeWrapper }: { lib, stdenv, fetchFromGitHub, makeWrapper, unixtools }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "microscheme"; pname = "microscheme";
version = "0.9.3"; version = "0.9.3";
src = fetchzip { src = fetchFromGitHub {
name = "${pname}-${version}-src"; owner = "ryansuchocki";
url = "https://github.com/ryansuchocki/microscheme/archive/v${version}.tar.gz"; repo = "microscheme";
sha256 = "1r3ng4pw1s9yy1h5rafra1rq19d3vmb5pzbpcz1913wz22qdd976"; rev = "v${version}";
sha256 = "5qTWsBCfj5DCZ3f9W1bdo6WAc1DZqVxg8D7pwC95duQ=";
}; };
buildInputs = [ makeWrapper vim ]; postPatch = ''
substituteInPlace makefile --replace gcc ${stdenv.cc.targetPrefix}cc
installPhase = ''
make install PREFIX=$out
''; '';
nativeBuildInputs = [ makeWrapper unixtools.xxd ];
makeFlags = [ "PREFIX=${placeholder "out"}" ];
meta = with lib; { meta = with lib; {
homepage = "http://microscheme.org"; homepage = "http://microscheme.org";
description = "A Scheme subset for Atmel microcontrollers"; description = "A Scheme subset for Atmel microcontrollers";
@ -24,7 +27,7 @@ stdenv.mkDerivation rec {
microcontrollers, especially as found on Arduino boards. microcontrollers, especially as found on Arduino boards.
''; '';
license = licenses.mit; license = licenses.mit;
platforms = platforms.linux; platforms = platforms.all;
maintainers = with maintainers; [ ardumont ]; maintainers = with maintainers; [ ardumont ];
}; };
} }