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