about summary refs log tree commit diff
path: root/pkgs/development/interpreters/s9fes/default.nix
blob: a05dde8f1f51ca06bcf6ae32ca42bbffe426b257 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ stdenv, lib, fetchurl, ncurses, buildPackages }:

let
  isCrossCompiling = stdenv.hostPlatform != stdenv.buildPlatform;
in

stdenv.mkDerivation rec {
  pname = "s9fes";
  version = "20181205";

  src = fetchurl {
    url = "https://www.t3x.org/s9fes/s9fes-${version}.tgz";
    sha256 = "sha256-Lp/akaDy3q4FmIE6x0fj9ae/SOD7tdsmzy2xdcCh13o=";
  };

  # Fix cross-compilation
  postPatch = ''
    substituteInPlace Makefile \
      --replace 'ar q' '${stdenv.cc.targetPrefix}ar q' \
      --replace 'strip' '${stdenv.cc.targetPrefix}strip'
    ${lib.optionalString isCrossCompiling "substituteInPlace Makefile --replace ./s9 '${buildPackages.s9fes}/bin/s9'"}
  '';

  buildInputs = [ ncurses ];
  makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "PREFIX=$(out)" ];
  enableParallelBuilding = true;

  meta = with lib; {
    description = "Scheme 9 From Empty Space, an interpreter for R4RS Scheme";
    homepage = "http://www.t3x.org/s9fes/index.html";
    license = licenses.publicDomain;
    maintainers = with maintainers; [ siraben ];
    platforms = platforms.unix;
  };
}