17 let stdenv = llvmPackages.stdenv;
19 in stdenv.mkDerivation rec {
22 name = "${pname}-${version}";
25 url = "https://github.com/mozart/mozart2/releases/download/v${version}/${name}-Source.zip";
26 sha256 = "1mad9z5yzzix87cdb05lmif3960vngh180s2mb66cj5gwh5h9dll";
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";
37 cp ${bootcompiler} bootcompiler/bootcompiler.jar
40 nativeBuildInputs = [ cmake makeWrapper unzip ];
42 # We cannot compile with both gcc and clang, but we need clang during the
43 # process, so we compile everything with clang.
44 # BUT, we need clang4 for parsing, and a more recent clang for compiling.
46 "-DCMAKE_CXX_COMPILER=${llvmPackages.clang}/bin/clang++"
47 "-DCMAKE_C_COMPILER=${llvmPackages.clang}/bin/clang"
48 "-DBoost_USE_STATIC_LIBS=OFF"
49 "-DMOZART_BOOST_USE_STATIC_LIBS=OFF"
50 "-DCMAKE_PROGRAM_PATH=${llvmPackages_5.clang}/bin"
51 # Rationale: Nix's cc-wrapper needs to see a compile flag (like -c) to
52 # infer that it is not a linking call, and stop trashing the command line
54 # As it does not recognise -emit-ast, we pass -c immediately overridden
56 # The remaining is just the default flags that we cannot reuse and need
58 "-DMOZART_GENERATOR_FLAGS='-c;-emit-ast;--std=c++0x;-Wno-invalid-noreturn;-Wno-return-type;-Wno-braced-scalar-init'"
59 # We are building with clang, as nix does not support having clang and
60 # gcc together as compilers and we need clang for the sources generation.
61 # However, clang emits tons of warnings about gcc's atomic-base library.
62 "-DCMAKE_CXX_FLAGS=-Wno-braced-scalar-init"
66 wrapProgram $out/bin/oz --set OZEMACS ${emacs}/bin/emacs
73 llvmPackages_5.clang-unwrapped
82 description = "An open source implementation of Oz 3";
83 maintainers = [ lib.maintainers.layus ];
84 license = lib.licenses.bsd2;
85 homepage = "https://mozart.github.io";