{ stdenv, fetchgit, bash, coreutils, ocaml, zlib, pcre, neko, camlp4 }: let generic = { version, sha256, prePatch }: stdenv.mkDerivation rec { name = "haxe-${version}"; buildInputs = [ocaml zlib pcre neko camlp4]; src = fetchgit { url = https://github.com/HaxeFoundation/haxe.git; inherit sha256; fetchSubmodules = true; rev = "refs/tags/${version}"; }; inherit prePatch; buildFlags = [ "all" "tools" ]; installPhase = '' install -vd "$out/bin" "$out/lib/haxe/std" cp -vr haxe haxelib std "$out/lib/haxe" # make wrappers which provide a temporary HAXELIB_PATH with symlinks to multiple repositories HAXELIB_PATH may point to for name in haxe haxelib; do cat > $out/bin/$name < docs/license.txt maintainers = [ maintainers.marcweber ]; platforms = platforms.linux ++ platforms.darwin; }; }; in { # this old version is required to compile some libraries haxe_3_2 = generic { version = "3.2.1"; sha256 = "1x9ay5a2llq46fww3k07jxx8h1vfpyxb522snc6702a050ki5vz3"; prePatch = '' sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' main.ml sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/tools/haxelib/Main.hx ''; }; haxe_3_4 = generic { version = "3.4.4"; sha256 = "057psarsmz8q2y9pqv5221vpdya241gcy8xnl2wg9wyscn6z1lx6"; prePatch = '' sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/haxelib/client/Main.hx ''; }; }