homebrew-core/Formula/haxe.rb
2019-10-27 17:37:59 +09:00

64 lines
2 KiB
Ruby

class Haxe < Formula
desc "Multi-platform programming language"
homepage "https://haxe.org/"
url "https://github.com/HaxeFoundation/haxe.git",
:tag => "4.0.0",
:revision => "ef18b627e598d8c7411f58c1ca672a5aace13c74"
head "https://github.com/HaxeFoundation/haxe.git", :branch => "development"
bottle do
cellar :any
sha256 "b89c02a63a539337248fedb0c7375092eb7c37d4b273389ce0332369fb2bc712" => :catalina
sha256 "cd237ef4f82e201889b9757fb90be5422fc610f1dcf971ca0c5c1a5634751f79" => :mojave
sha256 "63bb8b498921d931971dc2776911f2417c354fa9ffc809e28f15d4ede4159feb" => :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