class Haxe < Formula desc "Multi-platform programming language" homepage "https://haxe.org/" url "https://github.com/HaxeFoundation/haxe.git", :tag => "3.4.5", :revision => "666f17e8163d6ad30399b5f91ecadef77d07a105" bottle do cellar :any sha256 "460a7ea565769b46bab3feaeb25067f6d6ab5bbd6a25e9947146e05d453c37fd" => :high_sierra sha256 "b1d00352a244d15eb03dca0d1695ccac8288f0618a3e4fac18d50ec59145d397" => :sierra sha256 "a9609fd07ac455b08aff01134f472f3b7e2e747383730e6a4a756a84c81a30f4" => :el_capitan end head do url "https://github.com/HaxeFoundation/haxe.git", :branch => "development" depends_on "opam" => :build end depends_on "ocaml" => :build depends_on "camlp4" => :build depends_on "cmake" => :build depends_on "neko" depends_on "pcre" def install ENV["OCAMLPARAM"] = "safe-string=0,_" # OCaml 4.06.0 compat # Build requires targets to be built in specific order ENV.deparallelize if build.head? ENV["OPAMROOT"] = buildpath/"opamroot" ENV["OPAMYES"] = "1" system "opam", "init", "--no-setup" system "opam", "config", "exec", "--", "opam", "install", "ocamlfind", "sedlex", "xml-light", "extlib", "rope", "ptmap>2.0.1" system "opam", "config", "exec", "--", "make", "ADD_REVISION=1" else system "make", "OCAMLOPT=ocamlopt.opt" 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" # Replace the absolute symlink by a relative one, # such that binary package created by homebrew will work in non-/usr/local locations. rm bin/"haxe" bin.install_symlink lib/"haxe/haxe" 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