class Haxe < Formula desc "Multi-platform programming language" homepage "https://haxe.org/" url "https://github.com/HaxeFoundation/haxe.git", :tag => "4.0.2", :revision => "fc976eac04685b206a9a64d9a88ee6237e4b72af" head "https://github.com/HaxeFoundation/haxe.git", :branch => "development" bottle do cellar :any sha256 "03e8b41fc8bfd6cc77d283ec78d5b5f89a3343ccb31338fb2de5ad11bde0e0e1" => :catalina sha256 "6b7c977ce5acd98d9c38bd668d1d31a42cc61fb1fa8be2c3400acfc0d507ad62" => :mojave sha256 "d58593b1301ad899f18087c72da39b12045785dfd69d40cf9fbdac15124dd4df" => :high_sierra end depends_on "cmake" => :build depends_on "ocaml" => :build depends_on "opam" => :build depends_on "pkg-config" => :build depends_on "neko" depends_on "pcre" def install # Build requires targets to be built in specific order ENV.deparallelize Dir.mktmpdir("opamroot") do |opamroot| ENV["OPAMROOT"] = opamroot ENV["OPAMYES"] = "1" ENV["ADD_REVISION"] = "1" if build.head? system "opam", "init", "--no-setup", "--disable-sandboxing" system "opam", "config", "exec", "--", "opam", "pin", "add", "haxe", buildpath, "--no-action" system "opam", "config", "exec", "--", "opam", "install", "haxe", "--deps-only" system "opam", "config", "exec", "--", "make" end # Rebuild haxelib as a valid binary cd "extra/haxelib_src" do system "cmake", "." system "make" end rm "haxelib" cp "extra/haxelib_src/haxelib", "haxelib" bin.mkpath system "make", "install", "INSTALL_BIN_DIR=#{bin}", "INSTALL_LIB_DIR=#{lib}/haxe", "INSTALL_STD_DIR=#{lib}/haxe/std" end def caveats; <<~EOS Add the following line to your .bashrc or equivalent: export HAXE_STD_PATH="#{HOMEBREW_PREFIX}/lib/haxe/std" EOS end test do ENV["HAXE_STD_PATH"] = "#{HOMEBREW_PREFIX}/lib/haxe/std" system "#{bin}/haxe", "-v", "Std" system "#{bin}/haxelib", "version" end end