summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/s9/s9fes/package.nix
blob: 3a2cb857c5c0d58f865c2ce380bb589525ce5b22 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  stdenv,
  lib,
  fetchurl,
  ncurses,
  buildPackages,
}:

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

stdenv.mkDerivation (finalAttrs: {
  pname = "s9fes";
  version = "20181205";

  src = fetchurl {
    url = "https://www.t3x.org/s9fes/s9fes-${finalAttrs.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 ];
  preBuild = ''
    makeFlagsArray+=(CFLAGS="-O2 -std=c89")
  '';
  makeFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
    "PREFIX=$(out)"
  ];

  enableParallelBuilding = true;
  # ...-bash-5.2-p15/bin/bash: line 1: ...-s9fes-20181205/bin/s9help: No such file or directory
  # make: *** [Makefile:157: install-util] Error 1
  enableParallelInstalling = false;

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