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