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