92 lines
2.9 KiB
Ruby
92 lines
2.9 KiB
Ruby
class Emscripten < Formula
|
|
desc "LLVM bytecode to JavaScript compiler"
|
|
homepage "https://kripken.github.io/emscripten-site/"
|
|
|
|
stable do
|
|
url "https://github.com/kripken/emscripten/archive/1.35.2.tar.gz"
|
|
sha256 "56feaa3037ec72e2d5299b0a92d7e3b9e1da164db32338c1fe02fe3ca68d8adb"
|
|
|
|
resource "fastcomp" do
|
|
url "https://github.com/kripken/emscripten-fastcomp/archive/1.35.2.tar.gz"
|
|
sha256 "3bbc7990138381b0cbdac39f83afee76fa143efe81dba4939c1f514dccc307a3"
|
|
end
|
|
|
|
resource "fastcomp-clang" do
|
|
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.35.2.tar.gz"
|
|
sha256 "5f7090fe66b9462e172cb7a889d9044aa301ffc946072293dd2b269973f358ce"
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 "198eb3d39472c8807b9a86e5e7c433262562f2315c212181a54f6b6e8ca7aaf0" => :el_capitan
|
|
sha256 "01b436990a411cff5c3b874eaa48bbd6aa078c6ed8b5db072650d0b2a0d4587e" => :yosemite
|
|
sha256 "53c3c5f2965e1e6e48b64e2c54fbb745f5abd08116991556f02a776449a9fbb8" => :mavericks
|
|
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
|
|
|
|
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
|
|
# 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",
|
|
]
|
|
|
|
mkdir "fastcomp/build" 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
|
|
|
|
def caveats; <<-EOS.undent
|
|
Manually set LLVM_ROOT to
|
|
#{opt_libexec}/llvm/bin
|
|
in ~/.emscripten after running `emcc` for the first time.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
system "#{libexec}/llvm/bin/llvm-config", "--version"
|
|
end
|
|
end
|