1{
2 lib,
3 stdenv,
4 fetchurl,
5 makeWrapper,
6 boost,
7 gmp,
8 tcl-8_5,
9 tk-8_5,
10 emacs,
11}:
12
13let
14 version = "2.0.0";
15
16 binaries = {
17 x86_64-linux = fetchurl {
18 url = "mirror://sourceforge/project/mozart-oz/v${version}-alpha.0/mozart2-${version}-alpha.0+build.4105.5c06ced-x86_64-linux.tar.gz";
19 sha256 = "0rsfrjimjxqbwprpzzlmydl3z3aiwg5qkb052jixdxjyad7gyh5z";
20 };
21 };
22in
23
24stdenv.mkDerivation {
25 pname = "mozart-binary";
26 inherit version;
27
28 preferLocalBuild = true;
29
30 src =
31 binaries.${stdenv.hostPlatform.system}
32 or (throw "unsupported system: ${stdenv.hostPlatform.system}");
33
34 libPath = lib.makeLibraryPath [
35 stdenv.cc.cc
36 boost
37 gmp
38 tcl-8_5
39 tk-8_5
40 ];
41
42 TK_LIBRARY = "${tk-8_5}/lib/tk8.5";
43
44 nativeBuildInputs = [ makeWrapper ];
45
46 buildCommand = ''
47 mkdir $out
48 tar xvf $src -C $out --strip-components=1
49
50 for exe in $out/bin/{ozemulator,ozwish} ; do
51 patchelf --set-interpreter $(< $NIX_CC/nix-support/dynamic-linker) \
52 --set-rpath $libPath \
53 $exe
54 done
55
56 wrapProgram $out/bin/ozwish \
57 --set OZHOME $out \
58 --set TK_LIBRARY $TK_LIBRARY
59
60 wrapProgram $out/bin/ozemulator --set OZHOME $out
61
62 ${lib.optionalString (emacs != null) ''
63 wrapProgram $out/bin/oz --suffix PATH ":" ${lib.makeBinPath [ emacs ]}
64 ''}
65
66 sed -i $out/share/applications/oz.desktop \
67 -e "s,Exec=oz %u,Exec=$out/bin/oz %u,"
68
69 gzip -9n $out/share/mozart/elisp"/"*.elc
70
71 patchShebangs $out
72 '';
73
74 meta = with lib; {
75 homepage = "https://www.mozart-oz.org/";
76 description = "Multiplatform implementation of the Oz programming language";
77 longDescription = ''
78 The Mozart Programming System combines ongoing research in
79 programming language design and implementation, constraint logic
80 programming, distributed computing, and human-computer
81 interfaces. Mozart implements the Oz language and provides both
82 expressive power and advanced functionality.
83 '';
84 sourceProvenance = with sourceTypes; [ binaryBytecode ];
85 license = licenses.mit;
86 platforms = attrNames binaries;
87 hydraPlatforms = [ ];
88 };
89}