From 683e2067d796f90cb9cff5a610d436afaa395302 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 17 Apr 2018 13:52:29 +0200 Subject: [PATCH] haxe: Fix path to stdlib and add small test The version bump in c727e7e7d60e687be7d8def95fce5cd02cb5293b (pull request #35153) didn't actually take into account that Haxe has changed the way they search for the stdlib. Instead of a hardcoded list of paths it now searches based on a common prefix. So when running Haxe, it errored out because it couldn't find its own standard library. This is now fixed by changing the sed expression accordingly. Apart from fixing the actual issue, I've added a small test in installCheckPhase to make sure something like this won't happen again in future updates. Signed-off-by: aszlig Cc: @volth, @joachifm --- pkgs/development/compilers/haxe/default.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/haxe/default.nix b/pkgs/development/compilers/haxe/default.nix index a420949711e0..afeef2b3637c 100644 --- a/pkgs/development/compilers/haxe/default.nix +++ b/pkgs/development/compilers/haxe/default.nix @@ -53,6 +53,24 @@ let dontStrip = true; + # While it might be a good idea to run the upstream test suite, let's at + # least make sure we can actually run the compiler. + doInstallCheck = true; + installCheckPhase = '' + # Get out of the source directory to make sure the stdlib from the + # sources doesn't interfere with the installed one. + mkdir installcheck + pushd installcheck > /dev/null + cat >> InstallCheck.hx < /dev/null + ''; + meta = with stdenv.lib; { description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++"; homepage = https://haxe.org; @@ -75,7 +93,7 @@ in { version = "3.4.6"; sha256 = "1myc4b8fwp0f9vky17wv45n34a583f5sjvajsc93f5gm1wanp4if"; prePatch = '' - sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml + sed -i -re 's!(let +prefix_path += +).*( +in)!\1"'"$out/"'"\2!' src/main.ml sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/haxelib/client/Main.hx ''; };