1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 gmp,
7 libffi,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "polyml";
12 version = "5.9.1";
13
14 src = fetchFromGitHub {
15 owner = "polyml";
16 repo = "polyml";
17 rev = "v${version}";
18 sha256 = "sha256-72wm8dt+Id59A5058mVE5P9TkXW5/LZRthZoxUustVA=";
19 };
20
21 postPatch =
22 ''
23 substituteInPlace configure.ac \
24 --replace-fail 'AC_FUNC_ALLOCA' "AC_FUNC_ALLOCA
25 AH_TEMPLATE([_Static_assert])
26 AC_DEFINE([_Static_assert], [static_assert])
27 "
28 ''
29 + lib.optionalString stdenv.hostPlatform.isDarwin ''
30 substituteInPlace configure.ac --replace-fail stdc++ c++
31 '';
32
33 buildInputs = [
34 libffi
35 gmp
36 ];
37
38 nativeBuildInputs = [ autoreconfHook ];
39
40 configureFlags = [
41 "--enable-shared"
42 "--with-system-libffi"
43 "--with-gmp"
44 ];
45
46 doCheck = true;
47
48 checkPhase = ''
49 runHook preCheck
50 make check
51 runHook postCheck
52 '';
53
54 meta = with lib; {
55 description = "Standard ML compiler and interpreter";
56 longDescription = ''
57 Poly/ML is a full implementation of Standard ML.
58 '';
59 homepage = "https://www.polyml.org/";
60 license = licenses.lgpl21;
61 platforms = with platforms; (linux ++ darwin);
62 maintainers = with maintainers; [
63 maggesi
64 kovirobi
65 ];
66 };
67}