lol
1{ lib
2, fetchurl
3, fetchpatch
4, cmake
5, unzip
6, makeWrapper
7, boost
8, llvmPackages
9, gmp
10, emacs
11, jre_headless
12, tcl
13, tk
14}:
15
16let stdenv = llvmPackages.stdenv;
17
18in stdenv.mkDerivation rec {
19 pname = "mozart2";
20 version = "2.0.1";
21 name = "${pname}-${version}";
22
23 src = fetchurl {
24 url = "https://github.com/mozart/mozart2/releases/download/v${version}/${name}-Source.zip";
25 sha256 = "1mad9z5yzzix87cdb05lmif3960vngh180s2mb66cj5gwh5h9dll";
26 };
27
28 # This is a workaround to avoid using sbt.
29 # I guess it is acceptable to fetch the bootstrapping compiler in binary form.
30 bootcompiler = fetchurl {
31 url = "https://github.com/layus/mozart2/releases/download/v2.0.0-beta.1/bootcompiler.jar";
32 sha256 = "1hgh1a8hgzgr6781as4c4rc52m2wbazdlw3646s57c719g5xphjz";
33 };
34
35 patches = [
36 ./patch-limits.diff
37 (fetchpatch {
38 name = "remove-uses-of-deprecated-boost-apis.patch";
39 url = "https://github.com/mozart/mozart2/commit/4256d3a9122e1cbb01400a1807bdee66088ff274.patch";
40 hash = "sha256-AnOrBnxoCxqis+RdCsq8EKBg//jcNHSOFYUvf7vh+Hc=";
41 })
42 ];
43
44 postConfigure = ''
45 cp ${bootcompiler} bootcompiler/bootcompiler.jar
46 '';
47
48 nativeBuildInputs = [ cmake makeWrapper unzip ];
49
50 cmakeFlags = [
51 "-DBoost_USE_STATIC_LIBS=OFF"
52 "-DMOZART_BOOST_USE_STATIC_LIBS=OFF"
53 # We are building with clang, as nix does not support having clang and
54 # gcc together as compilers and we need clang for the sources generation.
55 # However, clang emits tons of warnings about gcc's atomic-base library.
56 "-DCMAKE_CXX_FLAGS=-Wno-braced-scalar-init"
57 ];
58
59 fixupPhase = ''
60 wrapProgram $out/bin/oz --set OZEMACS ${emacs}/bin/emacs
61 '';
62
63 buildInputs = [
64 boost
65 gmp
66 emacs
67 jre_headless
68 tcl
69 tk
70 ];
71
72 meta = with lib; {
73 description = "An open source implementation of Oz 3";
74 maintainers = with maintainers; [ layus h7x4 ];
75 license = licenses.bsd2;
76 homepage = "https://mozart.github.io";
77 platforms = platforms.all;
78 # Trace/BPT trap: 5
79 broken = stdenv.isDarwin;
80 };
81
82}