python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / top-level / haxe-packages.nix
blobbda390e255d8f79a4a8f5a3eb8d3de27885c45b7
1 { stdenv, lib, fetchzip, fetchFromGitHub, haxe, neko, jdk, mono }:
3 let
4   self = haxePackages;
5   haxePackages = with self; {
7     withCommas = lib.replaceChars ["."] [","];
9     # simulate "haxelib dev $libname ."
10     simulateHaxelibDev = libname: ''
11       devrepo=$(mktemp -d)
12       mkdir -p "$devrepo/${withCommas libname}"
13       echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
14       export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
15     '';
17     installLibHaxe = { libname, version, files ? "*" }: ''
18       mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
19       echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
20       cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
21     '';
23     buildHaxeLib = {
24       libname,
25       version,
26       sha256,
27       meta,
28       ...
29     } @ attrs:
30       stdenv.mkDerivation (attrs // {
31         name = "${libname}-${version}";
33         buildInputs = (attrs.buildInputs or []) ++ [ haxe neko ]; # for setup-hook.sh to work
34         src = fetchzip rec {
35           name = "${libname}-${version}";
36           url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
37           inherit sha256;
38           stripRoot = false;
39         };
41         installPhase = attrs.installPhase or ''
42           runHook preInstall
43           (
44             if [ $(ls $src | wc -l) == 1 ]; then
45               cd $src/* || cd $src
46             else
47               cd $src
48             fi
49             ${installLibHaxe { inherit libname version; }}
50           )
51           runHook postInstall
52         '';
54         meta = {
55           homepage = "http://lib.haxe.org/p/${libname}";
56           license = lib.licenses.bsd2;
57           platforms = lib.platforms.all;
58           description = throw "please write meta.description";
59         } // attrs.meta;
60       });
62     format = buildHaxeLib {
63       libname = "format";
64       version = "3.5.0";
65       sha256 = "sha256-5vZ7b+P74uGx0Gb7X/+jbsx5048dO/jv5nqCDtw5y/A=";
66       meta.description = "A Haxe Library for supporting different file formats";
67     };
69     heaps = buildHaxeLib {
70       libname = "heaps";
71       version = "1.9.1";
72       sha256 = "sha256-i5EIKnph80eEEHvGXDXhIL4t4+RW7OcUV5zb2f3ItlI=";
73       meta.description = "The GPU Game Framework";
74     };
76     hlopenal = buildHaxeLib {
77       libname = "hlopenal";
78       version = "1.5.0";
79       sha256 = "sha256-mJWFGBJPPAhVwsB2HzMfk4szSyjMT4aw543YhVqIan4=";
80       meta.description = "OpenAL support for Haxe/HL";
81     };
83     hlsdl = buildHaxeLib {
84       libname = "hlsdl";
85       version = "1.10.0";
86       sha256 = "sha256-kmC2EMDy1mv0jFjwDj+m0CUvKal3V7uIGnMxJBRYGms=";
87       meta.description = "SDL/GL support for Haxe/HL";
88     };
90     hxcpp = buildHaxeLib rec {
91       libname = "hxcpp";
92       version = "4.1.15";
93       sha256 = "1ybxcvwi4655563fjjgy6xv5c78grjxzadmi3l1ghds48k1rh50p";
94       postFixup = ''
95         for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
96           chmod +w "$f"
97           patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker)   "$f" || true
98           patchelf --set-rpath ${ lib.makeLibraryPath [ stdenv.cc.cc ] }  "$f" || true
99         done
100       '';
101       meta.description = "Runtime support library for the Haxe C++ backend";
102     };
104     hxjava = buildHaxeLib {
105       libname = "hxjava";
106       version = "3.2.0";
107       sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
108       meta.description = "Support library for the Java backend of the Haxe compiler";
109       propagatedBuildInputs = [ jdk ];
110     };
112     hxcs = buildHaxeLib {
113       libname = "hxcs";
114       version = "3.4.0";
115       sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
116       meta.description = "Support library for the C# backend of the Haxe compiler";
117       propagatedBuildInputs = [ mono ];
118     };
120     hxnodejs_4 = buildHaxeLib {
121       libname = "hxnodejs";
122       version = "4.0.9";
123       sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
124       meta.description = "Extern definitions for node.js 4.x";
125     };
127     hxnodejs_6 = let
128       libname = "hxnodejs";
129       version = "6.9.0";
130     in stdenv.mkDerivation {
131       name = "${libname}-${version}";
132       src = fetchFromGitHub {
133         owner = "HaxeFoundation";
134         repo = "hxnodejs";
135         rev = "cf80c6a";
136         sha256 = "0mdiacr5b2m8jrlgyd2d3vp1fha69lcfb67x4ix7l7zfi8g460gs";
137       };
138       installPhase = installLibHaxe { inherit libname version; };
139       meta = {
140         homepage = "http://lib.haxe.org/p/${libname}";
141         license = lib.licenses.bsd2;
142         platforms = lib.platforms.all;
143         description = "Extern definitions for node.js 6.9";
144       };
145     };
146   };
147 in self