|
| 1 | +self: super: |
| 2 | + |
| 3 | +with self; |
| 4 | + |
| 5 | +{ |
| 6 | + mozart2 = llvmPackages.stdenv.mkDerivation rec { |
| 7 | + name = "mozart2-${version}"; |
| 8 | + version = "2.0.0-beta.1"; |
| 9 | + |
| 10 | + src = super.fetchFromGitHub { |
| 11 | + repo = "mozart2"; |
| 12 | + owner = "mozart"; |
| 13 | + rev = "99139ce628cc4f8941fe267dd5b12df054f968d6"; |
| 14 | + sha256 = "0s8329fqbq5ali0jjd3brhhf63cmv9kiqax2kfhalkl3cbmwrlzm"; |
| 15 | + fetchSubmodules = true; |
| 16 | + }; |
| 17 | + |
| 18 | + bootcompiler = fetchurl { |
| 19 | + url = "https://github.com/layus/mozart2/releases/download/v2.0.0-beta.1/bootcompiler.jar"; |
| 20 | + sha256 = "1hgh1a8hgzgr6781as4c4rc52m2wbazdlw3646s57c719g5xphjz"; |
| 21 | + }; |
| 22 | + |
| 23 | + postConfigure = '' |
| 24 | + ln -sfn ${bootcompiler} bootcompiler/bootcompiler.jar |
| 25 | + ''; |
| 26 | + |
| 27 | + nativeBuildInputs = [ cmake makeWrapper ]; |
| 28 | + |
| 29 | + cmakeFlags = [ |
| 30 | + "-DCMAKE_CXX_COMPILER=${llvmPackages.clang}/bin/clang++" |
| 31 | + "-DCMAKE_C_COMPILER=${llvmPackages.clang}/bin/clang" |
| 32 | + "-DBoost_USE_STATIC_LIBS=OFF" |
| 33 | + "-DMOZART_BOOST_USE_STATIC_LIBS=OFF" |
| 34 | + "-DCMAKE_PROGRAM_PATH=${llvmPackages_4.clang}/bin" |
| 35 | + # Rationale: Nix's cc-wrapper needs to see a compile flag (like -c) to |
| 36 | + # infer that it is not a linking call, and stop trashing the command line |
| 37 | + # with linker flags. |
| 38 | + # As it does not recognise -emit-ast, we pass -c immediately overridden |
| 39 | + # by -emit-ast. |
| 40 | + # The remaining is just the default flags that we cannot reuse and need |
| 41 | + # to repeat here. |
| 42 | + "-DMOZART_GENERATOR_FLAGS='-c;-emit-ast;--std=c++0x;-Wno-invalid-noreturn;-Wno-return-type;-Wno-braced-scalar-init'" |
| 43 | + # We are building with clang, as nix does not support having clang and |
| 44 | + # gcc together as compilers and we need clang for the sources generation. |
| 45 | + # However, clang emits tons of warnings about gcc's atomic-base library. |
| 46 | + "-DCMAKE_CXX_FLAGS=-Wno-braced-scalar-init" |
| 47 | + ]; |
| 48 | + |
| 49 | + fixupPhase = '' |
| 50 | + wrapProgram $out/bin/oz --set OZEMACS ${emacs}/bin/emacs |
| 51 | + ''; |
| 52 | + |
| 53 | + buildInputs = [ |
| 54 | + boost |
| 55 | + llvmPackages_4.llvm |
| 56 | + llvmPackages_4.clang |
| 57 | + llvmPackages_4.clang-unwrapped |
| 58 | + gmp |
| 59 | + emacs25-nox |
| 60 | + jre_headless |
| 61 | + tcl |
| 62 | + tk |
| 63 | + ]; |
| 64 | + |
| 65 | + }; |
| 66 | +} |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
0 commit comments