homebrew-core/Formula/emscripten.rb

88 lines
2.6 KiB
Ruby

require "formula"
class Emscripten < Formula
homepage "http://emscripten.org"
url "https://github.com/kripken/emscripten/archive/1.22.1.tar.gz"
sha1 "af45e93a6815392f91a26213f69b9d5121136c60"
bottle do
sha1 "64644afd5fe3f6e1c88f28d962f69e13d346cb25" => :mavericks
sha1 "e384a5b9b0d90926e64a96f0ebef26ecec76b729" => :mountain_lion
sha1 "d30b417e1f013c8c84f925caf0bc4d053e134349" => :lion
end
head do
url "https://github.com/kripken/emscripten.git", :branch => "incoming"
resource "fastcomp" do
url "https://github.com/kripken/emscripten-fastcomp.git", :branch => "incoming"
end
resource "fastcomp-clang" do
url "https://github.com/kripken/emscripten-fastcomp-clang.git", :branch => "incoming"
end
end
stable do
resource "fastcomp" do
url "https://github.com/kripken/emscripten-fastcomp/archive/1.22.1.tar.gz"
sha1 "7479f53b6123012c779722332ad08eddabbc5a68"
end
resource "fastcomp-clang" do
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.22.1.tar.gz"
sha1 "0f3742b12f921822daad3195970dd0d2cabee0f5"
end
end
depends_on "node"
depends_on "closure-compiler" => :optional
depends_on "yuicompressor"
def install
# OSX doesn't provide a "python2" binary so use "python" instead.
python2_shebangs = `grep --recursive --files-with-matches ^#!/usr/bin/.*python2$ #{buildpath}`
python2_shebang_files = python2_shebangs.lines.sort.uniq
python2_shebang_files.map! {|f| Pathname(f.chomp)}
python2_shebang_files.reject! &:symlink?
inreplace python2_shebang_files, %r{^(#!/usr/bin/.*python)2$}, "\\1"
# All files from the repository are required as emscripten is a collection
# of scripts which need to be installed in the same layout as in the Git
# repository.
libexec.install Dir["*"]
(buildpath/"fastcomp").install resource("fastcomp")
(buildpath/"fastcomp/tools/clang").install resource("fastcomp-clang")
args = [
"--prefix=#{libexec}/llvm",
"--enable-optimized",
"--enable-targets=host,js",
"--disable-assertions",
"--disable-bindings",
]
cd "fastcomp" do
system "./configure", *args
system "make"
system "make", "install"
end
%w(em++ em-config emar emcc emcmake emconfigure emlink.py emmake
emranlib emrun emscons).each do |emscript|
bin.install_symlink libexec/emscript
end
end
test do
system "#{libexec}/llvm/bin/llvm-config", "--version"
end
def caveats; <<-EOS.undent
Manually set LLVM_ROOT to \"#{opt_prefix}/libexec/llvm/bin\"
in ~/.emscripten after running `emcc` for the first time.
EOS
end
end