summary refs log tree commit diff
path: root/pkgs/development/compilers/haxe/default.nix
blob: 8b69ecc72c5f159ef30adbb39700b25ad3dad47e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
args: with args;

stdenv.mkDerivation {
  name = "haxe-cvs";

  src = sourceByName "haxe";

  buildInputs = [ocaml zlib makeWrapper];

  inherit zlib;

  buildPhase = ''
    mkdir -p ocaml/{swflib,extc,extlib-dev,xml-light} neko/libs

    # strange setup. install.ml seems to co the same repo again into haxe directory!
    tar xfz $src --strip-components=1 -C haxe

    t(){ tar xfz $1 -C $2 --strip-components=2; }
    t ${sourceByName "haxe_swflib"} ocaml/swflib
    t ${sourceByName "haxe_extc"} ocaml/extc
    t ${sourceByName "haxe_extlib_dev"} ocaml/extlib-dev
    t ${sourceByName "haxe_xml_light"} ocaml/xml-light
    t ${sourceByName "haxe_neko_include"} neko/libs

    sed -e '/download();/d' \
        -e "s@/usr/lib/@''${zlib}/lib/@g" \
        doc/install.ml > install.ml
    
    ocaml install.ml
  '';

  # probably rpath should be set properly
  installPhase = ''
    ensureDir $out/lib/haxe
    cp -r bin $out/bin
    wrapProgram "$out/bin/haxe" \
      --set "LD_LIBRARY_PATH" $zlib/lib \
      --set HAXE_LIBRARY_PATH "''${HAXE_LIBRARY_PATH}''${HAXE_LIBRARY_PATH:-:}:$out/lib/haxe/std:."
    cp -r std $out/lib/haxe/
  '';

  meta = { 
    description = "programming language targeting JavaScript, Flash, NekVM, PHP, C++";
    homepage = http://haxe.org;
    license = ["GPLv2" "BSD2" /*?*/ ];  # -> docs/license.txt
    maintainers = [args.lib.maintainers.marcweber];
    platforms = args.lib.platforms.linux;
  };
}