diff options
author | Volth <volth@webmaster.ms> | 2017-05-20 21:14:08 +0000 |
---|---|---|
committer | Volth <volth@webmaster.ms> | 2017-07-03 20:06:23 +0000 |
commit | 37ef9e3b606defb7b7c9f2bfd661ab160caf2198 (patch) | |
tree | ba30643c3cedcad0453f489f95ed6c1be9c02aee /pkgs/development/compilers/haxe | |
parent | dc7cc77111a49f332c3f4c430685890a1f004c9b (diff) | |
download | nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar.gz nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar.bz2 nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar.lz nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar.xz nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.tar.zst nixpkgs-37ef9e3b606defb7b7c9f2bfd661ab160caf2198.zip |
haxe: fix hxcpp, introduce haxePackage with hxjava and hxcs
Diffstat (limited to 'pkgs/development/compilers/haxe')
-rw-r--r-- | pkgs/development/compilers/haxe/default.nix | 98 | ||||
-rw-r--r-- | pkgs/development/compilers/haxe/hxcpp.nix | 52 | ||||
-rw-r--r-- | pkgs/development/compilers/haxe/setup-hook.sh | 2 |
3 files changed, 72 insertions, 80 deletions
diff --git a/pkgs/development/compilers/haxe/default.nix b/pkgs/development/compilers/haxe/default.nix index 684c6d25daa..ca41545eb45 100644 --- a/pkgs/development/compilers/haxe/default.nix +++ b/pkgs/development/compilers/haxe/default.nix @@ -1,40 +1,82 @@ -{ stdenv, fetchgit, ocaml, zlib, pcre, neko, camlp4 }: +{ stdenv, fetchgit, bash, coreutils, ocaml, zlib, pcre, neko, camlp4 }: -stdenv.mkDerivation { - name = "haxe-3.4.2"; +let + generic = { version, sha256, prePatch }: + stdenv.mkDerivation rec { + name = "haxe-${version}"; - buildInputs = [ocaml zlib pcre neko camlp4]; + buildInputs = [ocaml zlib pcre neko camlp4]; - src = fetchgit { - url = "https://github.com/HaxeFoundation/haxe.git"; - sha256 = "1m5fp183agqv8h3ynhxw4kndkpq2d6arysmirv3zl3vz5crmpwqd"; - fetchSubmodules = true; + src = fetchgit { + url = https://github.com/HaxeFoundation/haxe.git; + inherit sha256; + fetchSubmodules = true; + rev = "refs/tags/${version}"; + }; - # Tag 3.4.2 - rev = "890f8c70cf23ce6f9fe0fdd0ee514a9699433ca7"; - }; + inherit prePatch; + + buildFlags = [ "all" "tools" ]; - prePatch = '' - sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml - ''; + installPhase = '' + install -vd "$out/bin" "$out/lib/haxe/std" + cp -vr haxe haxelib std "$out/lib/haxe" - buildFlags = [ "all" "tools" ]; + # 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 <<EOF + #!{bash}/bin/bash - installPhase = '' - install -vd "$out/bin" "$out/lib/haxe/std" - install -vt "$out/bin" haxe haxelib - cp -vr std "$out/lib/haxe" - ''; + if [[ "\$HAXELIB_PATH" =~ : ]]; then + NEW_HAXELIB_PATH="\$(${coreutils}/bin/mktemp -d)" - setupHook = ./setup-hook.sh; + IFS=':' read -ra libs <<< "\$HAXELIB_PATH" + for libdir in "\''${libs[@]}"; do + for lib in "\$libdir"/*; do + if [ ! -e "\$NEW_HAXELIB_PATH/\$(${coreutils}/bin/basename "\$lib")" ]; then + ${coreutils}/bin/ln -s "--target-directory=\$NEW_HAXELIB_PATH" "\$lib" + fi + done + done + export HAXELIB_PATH="\$NEW_HAXELIB_PATH" + $out/lib/haxe/$name "\$@" + rm -rf "\$NEW_HAXELIB_PATH" + else + exec $out/lib/haxe/$name "\$@" + fi + EOF + chmod +x $out/bin/$name + done + ''; - dontStrip = true; + setupHook = ./setup-hook.sh; - meta = with stdenv.lib; { - description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++"; - homepage = https://haxe.org; - license = with licenses; [ gpl2 bsd2 /*?*/ ]; # -> docs/license.txt - maintainers = [ maintainers.marcweber ]; - platforms = platforms.linux ++ platforms.darwin; + dontStrip = true; + + meta = with stdenv.lib; { + description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++"; + homepage = https://haxe.org; + license = with licenses; [ gpl2 bsd2 /*?*/ ]; # -> 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.2"; + sha256 = "1m5fp183agqv8h3ynhxw4kndkpq2d6arysmirv3zl3vz5crmpwqd"; + 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 + ''; }; } diff --git a/pkgs/development/compilers/haxe/hxcpp.nix b/pkgs/development/compilers/haxe/hxcpp.nix deleted file mode 100644 index 56b43fc128e..00000000000 --- a/pkgs/development/compilers/haxe/hxcpp.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ stdenv, fetchzip, haxe, neko, pcre, sqlite, zlib }: - -stdenv.mkDerivation rec { - name = "hxcpp-3.2.27"; - - src = let - zipFile = stdenv.lib.replaceChars ["."] [","] name; - in fetchzip { - inherit name; - url = "http://lib.haxe.org/files/3.0/${zipFile}.zip"; - sha256 = "1hw4kr1f8q7f4fkzis7kvkm7h1cxhv6cf5v1iq7rvxs2fxiys7fr"; - }; - - NIX_LDFLAGS = "-lpcre -lz -lsqlite3"; - - outputs = [ "out" "lib" ]; - - patchPhase = '' - rm -rf bin lib project/thirdparty project/libs/sqlite/sqlite3.[ch] - find . -name '*.n' -delete - sed -i -re '/(PCRE|ZLIB)_DIR|\<sqlite3\.c\>/d' project/Build.xml - sed -i -e 's/mFromFile = "@";/mFromFile = "";/' tools/hxcpp/Linker.hx - sed -i -e '/dll_ext/s,HX_CSTRING("./"),HX_CSTRING("'"$lib"'/"),' \ - src/hx/Lib.cpp - ''; - - buildInputs = [ haxe neko pcre sqlite zlib ]; - - targetArch = "linux-m${if stdenv.is64bit then "64" else "32"}"; - - buildPhase = '' - haxe -neko project/build.n -cp tools/build -main Build - haxe -neko run.n -cp tools/run -main RunMain - haxe -neko hxcpp.n -cp tools/hxcpp -main BuildTool - (cd project && neko build.n "ndll-$targetArch") - ''; - - installPhase = '' - for i in bin/Linux*/*.dso; do - install -vD "$i" "$lib/$(basename "$i")" - done - find *.n toolchain/*.xml build-tool/BuildCommon.xml src include \ - -type f -exec install -vD -m 0644 {} "$out/lib/haxe/hxcpp/{}" \; - ''; - - meta = { - homepage = "http://lib.haxe.org/p/hxcpp"; - description = "Runtime support library for the Haxe C++ backend"; - license = stdenv.lib.licenses.bsd2; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/development/compilers/haxe/setup-hook.sh b/pkgs/development/compilers/haxe/setup-hook.sh index a29e04a989b..21cc0206859 100644 --- a/pkgs/development/compilers/haxe/setup-hook.sh +++ b/pkgs/development/compilers/haxe/setup-hook.sh @@ -1,5 +1,7 @@ addHaxeLibPath() { + if [ ! -d "$1/lib/haxe/std" ]; then addToSearchPath HAXELIB_PATH "$1/lib/haxe" + fi } envHooks+=(addHaxeLibPath) |