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