homebrew-core/Formula/emscripten.rb

88 lines
2.6 KiB
Ruby
Raw Normal View History

require "formula"
class Emscripten < Formula
homepage "http://emscripten.org"
2014-09-23 04:12:03 +00:00
url "https://github.com/kripken/emscripten/archive/1.24.0.tar.gz"
sha1 "19f45d0d33078959aa84b48c4cbe8a9cf8a7a12b"
2014-05-08 08:52:56 +00:00
bottle do
sha1 "b5093ee8311a3cfc22526c26eab67b92c4554ffc" => :mavericks
sha1 "b52376a4b6e2f7e830cb9679963210875e2c0e4f" => :mountain_lion
sha1 "eb5f07a073f38e19df12aa3005057fed71742827" => :lion
2014-05-08 08:52:56 +00:00
end
head do
2014-09-05 00:49:29 +00:00
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
2014-09-23 04:12:03 +00:00
url "https://github.com/kripken/emscripten-fastcomp/archive/1.24.0.tar.gz"
sha1 "39d28dbed54edb267c30f480ef579738fac42d24"
end
resource "fastcomp-clang" do
2014-09-23 04:12:03 +00:00
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.24.0.tar.gz"
sha1 "4b89e978b8ad9227daca7460e43da4cb78bc7c30"
end
end
depends_on "node"
depends_on "closure-compiler" => :optional
depends_on "yuicompressor"
def install
2014-06-07 13:59:48 +00:00
# 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.
2014-07-21 02:32:04 +00:00
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
2014-06-07 13:59:48 +00:00
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\"
2014-06-07 13:59:48 +00:00
in ~/.emscripten after running `emcc` for the first time.
EOS
end
end