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