homebrew-core/Formula/haxe.rb
2019-11-04 18:19:12 -05: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.1",
:revision => "fcb00541a644af872333970bb0b6355b4b8fa5bf"
head "https://github.com/HaxeFoundation/haxe.git", :branch => "development"
bottle do
cellar :any
sha256 "e02bcf271506e66e090a85cd93b1261e7070dd271d879ad21330d9e244c109ee" => :catalina
sha256 "0b561dd0e48700943be9f6aad4f0e833099ff06814cce2aca66ec6e2d9c75624" => :mojave
sha256 "56f9b84ec358a21a609fe2fa034f2f7725d501fff19a4a12f2f8829da2929bbb" => :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