diff --git a/pkgs/development/compilers/mozart/binary.nix b/pkgs/development/compilers/mozart/binary.nix index 1c3a21e2e449..d802aa4fe2e7 100644 --- a/pkgs/development/compilers/mozart/binary.nix +++ b/pkgs/development/compilers/mozart/binary.nix @@ -1,25 +1,30 @@ -{ stdenv, fetchurl, boost, emacs, gmp, makeWrapper +{ stdenv, fetchurl, makeWrapper +, boost, gmp , tcl-8_5, tk-8_5 +, emacs }: let - version = "2.0.0"; -in stdenv.mkDerivation { + binaries = { + "x86_64-linux" = fetchurl { + url = "mirror://sourceforge/project/mozart-oz/v${version}-alpha.0/mozart2-${version}-alpha.0+build.4105.5c06ced-x86_64-linux.tar.gz"; + sha256 = "0rsfrjimjxqbwprpzzlmydl3z3aiwg5qkb052jixdxjyad7gyh5z"; + }; + }; +in + +stdenv.mkDerivation { name = "mozart-binary-${version}"; preferLocalBuild = true; - src = fetchurl { - url = "mirror://sourceforge/project/mozart-oz/v${version}-alpha.0/mozart2-${version}-alpha.0+build.4105.5c06ced-x86_64-linux.tar.gz"; - sha256 = "0rsfrjimjxqbwprpzzlmydl3z3aiwg5qkb052jixdxjyad7gyh5z"; - }; + src = binaries."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc boost - emacs gmp tcl-8_5 tk-8_5 @@ -27,10 +32,36 @@ in stdenv.mkDerivation { TK_LIBRARY = "${tk-8_5}/lib/tk8.5"; - builder = ./builder.sh; - buildInputs = [ makeWrapper ]; + buildCommand = '' + mkdir $out + tar xvf $src -C $out --strip-components=1 + + for exe in $out/bin/{ozemulator,ozwish} ; do + patchelf --set-interpreter $(< $NIX_CC/nix-support/dynamic-linker) \ + --set-rpath $libPath \ + $exe + done + + wrapProgram $out/bin/ozwish \ + --set OZHOME $out \ + --set TK_LIBRARY $TK_LIBRARY + + wrapProgram $out/bin/ozemulator --set OZHOME $out + + ${stdenv.lib.optionalString (emacs != null) '' + wrapProgram $out/bin/oz --suffix PATH ":" ${stdenv.lib.makeBinPath [ emacs ]} + ''} + + sed -i $out/share/applications/oz.desktop \ + -e "s,Exec=oz %u,Exec=$out/bin/oz %u," + + gzip -9n $out/share/mozart/elisp"/"*.elc + + patchShebangs $out + ''; + meta = with stdenv.lib; { homepage = "http://www.mozart-oz.org/"; description = "Multiplatform implementation of the Oz programming language"; @@ -42,6 +73,7 @@ in stdenv.mkDerivation { expressive power and advanced functionality. ''; license = licenses.mit; - platforms = [ "x86_64-linux" ]; + platforms = attrNames binaries; + hydraPlatforms = []; }; } diff --git a/pkgs/development/compilers/mozart/builder.sh b/pkgs/development/compilers/mozart/builder.sh deleted file mode 100644 index b606d4c1bde9..000000000000 --- a/pkgs/development/compilers/mozart/builder.sh +++ /dev/null @@ -1,26 +0,0 @@ -source $stdenv/setup - -echo "unpacking $src..." -tar xvfz $src - -mkdir -p $out/bin -mkdir -p $out/share - -mv mozart*linux/bin/* $out/bin -mv mozart*linux/share/* $out/share - -patchShebangs $out - -for f in $out/bin/*; do - b=$(basename $f) - - if [ $b == "ozemulator" ] || [ $b == "ozwish" ]; then - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath $libPath \ - $f - continue; - fi - - wrapProgram $f --set OZHOME $out \ - --set TK_LIBRARY $TK_LIBRARY -done