Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / mozart / binary.nix
blobb043187e6c1ee864faf79dc71b0e41ccdeb6d793
1 { lib, stdenv, fetchurl, makeWrapper
2 , boost, gmp
3 , tcl-8_5, tk-8_5
4 , emacs
5 }:
7 let
8   version = "2.0.0";
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   };
18 stdenv.mkDerivation {
19   pname = "mozart-binary";
20   inherit version;
22   preferLocalBuild = true;
24   src = binaries.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
26   libPath = lib.makeLibraryPath
27     [ stdenv.cc.cc
28       boost
29       gmp
30       tcl-8_5
31       tk-8_5
32     ];
34   TK_LIBRARY = "${tk-8_5}/lib/tk8.5";
36   nativeBuildInputs = [ makeWrapper ];
38   buildCommand = ''
39     mkdir $out
40     tar xvf $src -C $out --strip-components=1
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
48     wrapProgram $out/bin/ozwish \
49       --set OZHOME $out \
50       --set TK_LIBRARY $TK_LIBRARY
52     wrapProgram $out/bin/ozemulator --set OZHOME $out
54     ${lib.optionalString (emacs != null) ''
55       wrapProgram $out/bin/oz --suffix PATH ":" ${lib.makeBinPath [ emacs ]}
56     ''}
58     sed -i $out/share/applications/oz.desktop \
59         -e "s,Exec=oz %u,Exec=$out/bin/oz %u,"
61     gzip -9n $out/share/mozart/elisp"/"*.elc
63     patchShebangs $out
64   '';
66   meta = with 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   };