nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 pname = "mozart2";
20 version = "2.0.1";
21
22 # This is a workaround to avoid using sbt.
23 # I guess it is acceptable to fetch the bootstrapping compiler in binary form.
24 bootcompiler = fetchurl {
25 url = "https://github.com/layus/mozart2/releases/download/v2.0.0-beta.1/bootcompiler.jar";
26 sha256 = "1hgh1a8hgzgr6781as4c4rc52m2wbazdlw3646s57c719g5xphjz";
27 };
28in
29stdenv.mkDerivation {
30 inherit pname version;
31
32 src = fetchurl {
33 url = "https://github.com/mozart/mozart2/releases/download/v${version}/${pname}-${version}-Source.zip";
34 sha256 = "1mad9z5yzzix87cdb05lmif3960vngh180s2mb66cj5gwh5h9dll";
35 };
36
37 patches = [
38 ./patch-limits.diff
39 (fetchpatch {
40 name = "remove-uses-of-deprecated-boost-apis.patch";
41 url = "https://github.com/mozart/mozart2/commit/4256d3a9122e1cbb01400a1807bdee66088ff274.patch";
42 hash = "sha256-AnOrBnxoCxqis+RdCsq8EKBg//jcNHSOFYUvf7vh+Hc=";
43 })
44 ];
45
46 postConfigure = ''
47 cp ${bootcompiler} bootcompiler/bootcompiler.jar
48 '';
49
50 nativeBuildInputs = [
51 cmake
52 makeWrapper
53 unzip
54 ];
55
56 cmakeFlags = [
57 "-DBoost_USE_STATIC_LIBS=OFF"
58 "-DMOZART_BOOST_USE_STATIC_LIBS=OFF"
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"
63 ];
64
65 fixupPhase = ''
66 wrapProgram $out/bin/oz --set OZEMACS ${emacs}/bin/emacs
67 '';
68
69 buildInputs = [
70 boost183
71 gmp
72 emacs
73 jre_headless
74 tcl
75 tk
76 ];
77
78 postPatch = ''
79 substituteInPlace {vm,.}/CMakeLists.txt \
80 --replace-fail "cmake_minimum_required(VERSION 2.8)" "cmake_minimum_required(VERSION 3.10)"
81 substituteInPlace vm/vm/test/gtest/{googletest,.}/CMakeLists.txt \
82 --replace-fail "cmake_minimum_required(VERSION 2.6.4)" "cmake_minimum_required(VERSION 3.10)"
83 substituteInPlace bootcompiler/CMakeLists.txt \
84 --replace-fail "cmake_minimum_required(VERSION 2.6)" "cmake_minimum_required(VERSION 3.10)"
85 substituteInPlace {boosthost,opi,wish,stdlib}/CMakeLists.txt \
86 --replace-fail "cmake_minimum_required(VERSION 2.8.6)" "cmake_minimum_required(VERSION 3.10)"
87 '';
88
89 meta = {
90 description = "Open source implementation of Oz 3";
91 maintainers = with lib.maintainers; [
92 layus
93 h7x4
94 ];
95 license = lib.licenses.bsd2;
96 homepage = "https://mozart.github.io";
97 platforms = lib.platforms.all;
98 # Trace/BPT trap: 5
99 broken = stdenv.hostPlatform.isDarwin;
100 };
101
102}