summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pi/picolisp/package.nix
blob: 188dfeea5eb7fcc6b2bce03500036d376e12d0ad (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
52
53
54
55
56
57
58
59
60
61
62
{
  clang,
  fetchurl,
  lib,
  libffi,
  llvm,
  makeWrapper,
  openssl,
  pkg-config,
  readline,
  stdenv,
}:

stdenv.mkDerivation {
  pname = "PicoLisp";
  version = "24.3.30";
  src = fetchurl {
    url = "https://www.software-lab.de/picoLisp-24.3.tgz";
    sha256 = "sha256-FB43DAjHBFgxdysoLzBXLxii52a2CCh1skZP/RTzfdc=";
  };

  nativeBuildInputs = [
    makeWrapper
    pkg-config
  ];
  buildInputs = [
    clang
    libffi
    llvm
    openssl
    readline
  ];
  sourceRoot = "pil21";
  preBuild = ''
    cd src
  ''
  + lib.optionalString stdenv.hostPlatform.isDarwin ''
    # Flags taken from instructions at: https://picolisp.com/wiki/?alternativeMacOSRepository
    makeFlagsArray+=(
      SHARED='-dynamiclib -undefined dynamic_lookup'
    )
  '';

  installPhase = ''
    cd ..
    mkdir -p "$out/lib" "$out/bin" "$out/man"
    cp -r . "$out/lib/picolisp/"
    ln -s "$out/lib/picolisp/bin/picolisp" "$out/bin/picolisp"
    ln -s "$out/lib/picolisp/bin/pil" "$out/bin/pil"
    ln -s "$out/lib/picolisp/man/man1/pil.1" "$out/man/pil.1"
    ln -s "$out/lib/picolisp/man/man1/picolisp.1" "$out/man/picolisp.1"
    substituteInPlace $out/bin/pil --replace-fail /usr $out
  '';

  meta = {
    description = "Pragmatic programming language";
    homepage = "https://picolisp.com/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ nat-418 ];
    platforms = lib.platforms.all;
  };
}