fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv, fetchFromGitHub, coreutils, ocaml-ng, zlib, pcre, pcre2, neko, mbedtls_2, Security }:
2
3let
4 ocamlDependencies = version:
5 if lib.versionAtLeast version "4.3"
6 then with ocaml-ng.ocamlPackages_4_14; [
7 ocaml
8 findlib
9 sedlex
10 xml-light
11 ptmap
12 camlp5
13 sha
14 dune_3
15 luv
16 extlib
17 ] else with ocaml-ng.ocamlPackages_4_10; [
18 ocaml
19 findlib
20 sedlex
21 xml-light
22 ptmap
23 camlp5
24 sha
25 dune_3
26 luv
27 extlib-1-7-7
28 ];
29
30 defaultPatch = ''
31 substituteInPlace extra/haxelib_src/src/haxelib/client/Main.hx \
32 --replace '"neko"' '"${neko}/bin/neko"'
33 '';
34
35 generic = { sha256, version, prePatch ? defaultPatch }:
36 stdenv.mkDerivation {
37 pname = "haxe";
38 inherit version;
39
40 buildInputs = [ zlib neko ]
41 ++ (if lib.versionAtLeast version "4.3" then [pcre2] else [pcre])
42 ++ lib.optional (lib.versionAtLeast version "4.1") mbedtls_2
43 ++ lib.optional (lib.versionAtLeast version "4.1" && stdenv.isDarwin) Security
44 ++ ocamlDependencies version;
45
46 src = fetchFromGitHub {
47 owner = "HaxeFoundation";
48 repo = "haxe";
49 rev = version;
50 fetchSubmodules = true;
51 inherit sha256;
52 };
53
54 inherit prePatch;
55
56 buildFlags = [ "all" "tools" ];
57
58 installPhase = ''
59 install -vd "$out/bin" "$out/lib/haxe/std"
60 cp -vr haxe haxelib std "$out/lib/haxe"
61
62 # make wrappers which provide a temporary HAXELIB_PATH with symlinks to multiple repositories HAXELIB_PATH may point to
63 for name in haxe haxelib; do
64 cat > $out/bin/$name <<EOF
65 #!{bash}/bin/bash
66
67 if [[ "\$HAXELIB_PATH" =~ : ]]; then
68 NEW_HAXELIB_PATH="\$(${coreutils}/bin/mktemp -d)"
69
70 IFS=':' read -ra libs <<< "\$HAXELIB_PATH"
71 for libdir in "\''${libs[@]}"; do
72 for lib in "\$libdir"/*; do
73 if [ ! -e "\$NEW_HAXELIB_PATH/\$(${coreutils}/bin/basename "\$lib")" ]; then
74 ${coreutils}/bin/ln -s "--target-directory=\$NEW_HAXELIB_PATH" "\$lib"
75 fi
76 done
77 done
78 export HAXELIB_PATH="\$NEW_HAXELIB_PATH"
79 $out/lib/haxe/$name "\$@"
80 rm -rf "\$NEW_HAXELIB_PATH"
81 else
82 exec $out/lib/haxe/$name "\$@"
83 fi
84 EOF
85 chmod +x $out/bin/$name
86 done
87 '';
88
89 setupHook = ./setup-hook.sh;
90
91 dontStrip = true;
92
93 # While it might be a good idea to run the upstream test suite, let's at
94 # least make sure we can actually run the compiler.
95 doInstallCheck = true;
96 installCheckPhase = ''
97 # Get out of the source directory to make sure the stdlib from the
98 # sources doesn't interfere with the installed one.
99 mkdir installcheck
100 pushd installcheck > /dev/null
101 cat >> InstallCheck.hx <<EOF
102 class InstallCheck {
103 public static function main() trace("test");
104 }
105 EOF
106 "$out/bin/haxe" -js installcheck.js -main InstallCheck
107 grep -q 'console\.log.*test' installcheck.js
108 popd > /dev/null
109 '';
110
111 meta = with lib; {
112 description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++";
113 homepage = "https://haxe.org";
114 license = with licenses; [ gpl2Plus mit ]; # based on upstream opam file
115 maintainers = [ maintainers.marcweber maintainers.locallycompact maintainers.logo ];
116 platforms = platforms.linux ++ platforms.darwin;
117 };
118 };
119in {
120 haxe_4_0 = generic {
121 version = "4.0.5";
122 sha256 = "0f534pchdx0m057ixnk07ab4s518ica958pvpd0vfjsrxg5yjkqa";
123 };
124 haxe_4_1 = generic {
125 version = "4.1.5";
126 sha256 = "0rns6d28qzkbai6yyws08yzbyvxfn848nj0fsji7chdi0y7pzzj0";
127 };
128 haxe_4_3 = generic {
129 version = "4.3.4";
130 sha256 = "sha256-XGV4VG8nUofHGjHbtrLA+2kIpnnPqw5IlcNrP3EsL+Q=";
131 };
132}