2014-04-15 13:15:49 +00:00
|
|
|
class Emscripten < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "LLVM bytecode to JavaScript compiler"
|
2014-11-26 01:18:16 +00:00
|
|
|
homepage "https://kripken.github.io/emscripten-site/"
|
2015-08-25 06:33:49 +00:00
|
|
|
|
|
|
|
stable do
|
2016-05-27 19:40:27 +00:00
|
|
|
url "https://github.com/kripken/emscripten/archive/1.36.5.tar.gz"
|
|
|
|
sha256 "df18a63f540dd4b3ae58fcb7df91c5e19ec8563e07f16231ca5a8fd737348ee6"
|
2015-08-25 06:33:49 +00:00
|
|
|
|
|
|
|
resource "fastcomp" do
|
2016-05-27 19:40:27 +00:00
|
|
|
url "https://github.com/kripken/emscripten-fastcomp/archive/1.36.5.tar.gz"
|
|
|
|
sha256 "322501d14eb90b5590d463ef2ae1b358c07c590440d7bd21b60ea88885bc2fa0"
|
2015-08-25 06:33:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "fastcomp-clang" do
|
2016-05-27 19:40:27 +00:00
|
|
|
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.36.5.tar.gz"
|
|
|
|
sha256 "b6a35fe26efaaaaea5d3d1139e61d5754760f03bed0a4af87236767d1a56b00d"
|
2015-08-25 06:33:49 +00:00
|
|
|
end
|
|
|
|
end
|
2014-04-15 13:15:49 +00:00
|
|
|
|
2014-05-08 08:52:56 +00:00
|
|
|
bottle do
|
2016-05-27 22:34:08 +00:00
|
|
|
sha256 "cf1f89ef7693c1dd48e1460693269673cb3bbd9098c3228d9b7198a90d7cff8e" => :el_capitan
|
|
|
|
sha256 "ca6952b6e028bc13134ed22e091616a95f3deeb3d09ddd8046bf08e5079dc0af" => :yosemite
|
|
|
|
sha256 "ec769916fd5bb5696558fae42131c413f1d9fd6f97aa7fafd5cf34c893e102ab" => :mavericks
|
2014-05-08 08:52:56 +00:00
|
|
|
end
|
|
|
|
|
2014-04-15 13:15:49 +00:00
|
|
|
head do
|
2014-09-05 00:49:29 +00:00
|
|
|
url "https://github.com/kripken/emscripten.git", :branch => "incoming"
|
|
|
|
|
2014-04-15 13:15:49 +00:00
|
|
|
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
|
|
|
|
|
2015-01-23 23:23:09 +00:00
|
|
|
needs :cxx11
|
|
|
|
|
2014-10-17 05:45:01 +00:00
|
|
|
depends_on :python if MacOS.version <= :snow_leopard
|
2014-04-15 13:15:49 +00:00
|
|
|
depends_on "node"
|
|
|
|
depends_on "closure-compiler" => :optional
|
|
|
|
depends_on "yuicompressor"
|
|
|
|
|
|
|
|
def install
|
2015-01-23 23:23:09 +00:00
|
|
|
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
|
2015-08-03 12:55:31 +00:00
|
|
|
python2_shebang_files.map! { |f| Pathname(f.chomp) }
|
2014-06-07 13:59:48 +00:00
|
|
|
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["*"]
|
2014-04-15 13:15:49 +00:00
|
|
|
|
|
|
|
(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",
|
2015-10-05 07:29:10 +00:00
|
|
|
"--disable-bindings",
|
2014-04-15 13:15:49 +00:00
|
|
|
]
|
|
|
|
|
2015-10-24 12:27:59 +00:00
|
|
|
mkdir "fastcomp/build" do
|
|
|
|
system "../configure", *args
|
2014-04-15 13:15:49 +00:00
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
%w[em++ em-config emar emcc emcmake emconfigure emlink.py emmake
|
|
|
|
emranlib emrun emscons].each do |emscript|
|
2014-06-07 13:59:48 +00:00
|
|
|
bin.install_symlink libexec/emscript
|
2014-04-15 13:15:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2014-10-27 03:30:28 +00:00
|
|
|
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.
|
2014-04-15 13:15:49 +00:00
|
|
|
EOS
|
|
|
|
end
|
2015-08-25 06:33:49 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
system "#{libexec}/llvm/bin/llvm-config", "--version"
|
|
|
|
end
|
2014-04-15 13:15:49 +00:00
|
|
|
end
|