homebrew-core/Formula/emscripten.rb

91 lines
2.9 KiB
Ruby
Raw Normal View History

class Emscripten < Formula
homepage "https://kripken.github.io/emscripten-site/"
2015-04-02 22:23:24 +00:00
url "https://github.com/kripken/emscripten/archive/1.30.2.tar.gz"
sha256 "ea25a8180b6ad68289adea965f7d02632369f52332ac1500c4be4f45c06ae4da"
2014-05-08 08:52:56 +00:00
bottle do
2015-04-02 23:25:04 +00:00
sha256 "fd40a8cafea9b5bd9313f210bb6467a0af056d2e7813ec914b1429ab3d09e7f9" => :yosemite
sha256 "28d539e95c6073184efdef768a3258a03c5d4797b7458818a7840a1bcbe40f84" => :mavericks
sha256 "db0679e1b4e5f90878fbfa85787273fccce284cd0b15e3ee87da5dba57f82641" => :mountain_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
2015-04-02 22:23:24 +00:00
url "https://github.com/kripken/emscripten-fastcomp/archive/1.30.2.tar.gz"
sha256 "d0343e3859992acfdff86991694074c8422e39ac6bce7b09599e461cdc61bcb3"
end
resource "fastcomp-clang" do
2015-04-02 22:23:24 +00:00
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.30.2.tar.gz"
sha256 "340ab0639026ba86008b7f4cc2d0d47351c409b7237829cd1c4d113c6d048e04"
end
end
needs :cxx11
depends_on :python if MacOS.version <= :snow_leopard
depends_on "node"
depends_on "closure-compiler" => :optional
depends_on "yuicompressor"
def install
ENV.cxx11
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_libexec}/llvm/bin
2014-06-07 13:59:48 +00:00
in ~/.emscripten after running `emcc` for the first time.
EOS
end
end