Merge #25538: haxe: 3.2.1 -> 3.4.2

This commit is contained in:
Vladimír Čunát 2017-05-19 23:44:18 +02:00
commit dc8c798e5d
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
2 changed files with 8 additions and 138 deletions

View file

@ -1,25 +1,23 @@
{ stdenv, fetchgit, ocaml, zlib, neko, camlp4 }:
{ stdenv, fetchgit, ocaml, zlib, pcre, neko, camlp4 }:
stdenv.mkDerivation {
name = "haxe-3.2.1";
name = "haxe-3.4.2";
buildInputs = [ocaml zlib neko camlp4];
buildInputs = [ocaml zlib pcre neko camlp4];
src = fetchgit {
url = "https://github.com/HaxeFoundation/haxe.git";
sha256 = "1x9ay5a2llq46fww3k07jxx8h1vfpyxb522snc6702a050ki5vz3";
sha256 = "1m5fp183agqv8h3ynhxw4kndkpq2d6arysmirv3zl3vz5crmpwqd";
fetchSubmodules = true;
# Tag 3.2.1
rev = "deab4424399b520750671e51e5f5c2684e942c17";
# Tag 3.4.2
rev = "890f8c70cf23ce6f9fe0fdd0ee514a9699433ca7";
};
prePatch = ''
sed -i -e 's|com.class_path <- \[|&"'"$out/lib/haxe/std/"'";|' main.ml
sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml
'';
patches = [ ./haxelib-nix.patch ];
buildFlags = [ "all" "tools" ];
installPhase = ''
@ -34,7 +32,7 @@ stdenv.mkDerivation {
meta = with stdenv.lib; {
description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++";
homepage = http://haxe.org;
homepage = https://haxe.org;
license = with licenses; [ gpl2 bsd2 /*?*/ ]; # -> docs/license.txt
maintainers = [ maintainers.marcweber ];
platforms = platforms.linux ++ platforms.darwin;

View file

@ -1,128 +0,0 @@
diff --git a/src/tools/haxelib/Main.hx b/src/tools/haxelib/Main.hx
index dc18815..def5231 100644
--- a/extra/haxelib_src/src/tools/haxelib/Main.hx
+++ b/extra/haxelib_src/src/tools/haxelib/Main.hx
@@ -1301,21 +1301,26 @@ class Main {
}
function checkRec( prj : String, version : String, l : List<{ project : String, version : String, info : Infos }> ) {
- var pdir = getRepository() + Data.safe(prj);
- if( !FileSystem.exists(pdir) )
- throw "Library "+prj+" is not installed : run 'haxelib install "+prj+"'";
- var version = if( version != null ) version else getCurrent(pdir);
- var vdir = pdir + "/" + Data.safe(version);
- if( vdir.endsWith("dev") )
- vdir = getDev(pdir);
- if( !FileSystem.exists(vdir) )
- throw "Library "+prj+" version "+version+" is not installed";
- for( p in l )
- if( p.project == prj ) {
- if( p.version == version )
- return;
- throw "Library "+prj+" has two version included "+version+" and "+p.version;
- }
+ var vdir = this.getNixLib(prj);
+ if (vdir == null) {
+ var pdir = getRepository() + Data.safe(prj);
+ if( !FileSystem.exists(pdir) )
+ throw "Library "+prj+" is not installed : run 'haxelib install "+prj+"'";
+ var version = if( version != null ) version else getCurrent(pdir);
+ var vdir = pdir + "/" + Data.safe(version);
+ if( vdir.endsWith("dev") )
+ vdir = getDev(pdir);
+ if( !FileSystem.exists(vdir) )
+ throw "Library "+prj+" version "+version+" is not installed";
+ for( p in l )
+ if( p.project == prj ) {
+ if( p.version == version )
+ return;
+ throw "Library "+prj+" has two version included "+version+" and "+p.version;
+ }
+ } else {
+ version = null;
+ }
var json = try File.getContent(vdir+"/"+Data.JSON) catch( e : Dynamic ) null;
var inf = Data.readData(json,false);
l.add({ project : prj, version : version, info: inf });
@@ -1330,15 +1335,21 @@ class Main {
var a = args[argcur++].split(":");
checkRec(a[0],a[1],list);
}
- var rep = getRepository();
for( d in list ) {
- var pdir = Data.safe(d.project)+"/"+Data.safe(d.version)+"/";
- var dir = rep + pdir;
- try {
- dir = getDev(rep+Data.safe(d.project));
+ var dir = this.getNixLib(d.project);
+ var pdir = Data.safe(d.project)+"/";
+ if (dir == null) {
+ var rep = getRepository();
+ pdir += Data.safe(d.version)+"/";
+ dir = rep + pdir;
+ try {
+ dir = getDev(rep+Data.safe(d.project));
+ dir = Path.addTrailingSlash(dir);
+ pdir = dir;
+ } catch( e : Dynamic ) {}
+ } else {
dir = Path.addTrailingSlash(dir);
- pdir = dir;
- } catch( e : Dynamic ) {}
+ }
var ndir = dir + "ndll";
if( FileSystem.exists(ndir) ) {
var sysdir = ndir+"/"+Sys.systemName();
@@ -1491,23 +1502,43 @@ class Main {
);
}
+ function getNixLib(project:String):Null<String>
+ {
+ var hlibPath = Sys.getEnv("HAXELIB_PATH");
+ if (hlibPath != null) {
+ for (libDir in hlibPath.split(":")) {
+ var fullpath = libDir;
+ fullpath += libDir.substr(-1, 1) == "/" ? "" : "/";
+ fullpath += Data.safe(project);
+ if (FileSystem.exists(fullpath))
+ return fullpath;
+ }
+ }
+ return null;
+ }
function run() {
- var rep = getRepository();
var project = param("Library");
var temp = project.split(":");
project = temp[0];
- var pdir = rep + Data.safe(project);
- if( !FileSystem.exists(pdir) )
- throw "Library "+project+" is not installed";
- pdir += "/";
- var version = temp[1] != null ? temp[1] : getCurrent(pdir);
- var dev = try getDev(pdir) catch ( e : Dynamic ) null;
- var vdir = dev != null ? dev : pdir + Data.safe(version);
args.push(cli.cwd);
+
+ var vdir = this.getNixLib(project);
+ if (vdir == null) {
+ var rep = getRepository();
+ var pdir = rep + Data.safe(project);
+ if( !FileSystem.exists(pdir) )
+ throw "Library "+project+" is not installed";
+ pdir += "/";
+ var version = temp[1] != null ? temp[1] : getCurrent(pdir);
+ var dev = try getDev(pdir) catch ( e : Dynamic ) null;
+ vdir = dev!=null ? dev : pdir + Data.safe(version);
+ var rdir = vdir + "/run.n";
+ if( !FileSystem.exists(rdir) )
+ throw "Library "+project+" version "+version+" does not have a run script";
+ }
cli.cwd = vdir;
-
var callArgs =
switch try [Data.readData(File.getContent(vdir + '/haxelib.json'), false), null] catch (e:Dynamic) [null, e] {
case [null, e]: