90 lines
2.8 KiB
Ruby
90 lines
2.8 KiB
Ruby
class Emscripten < Formula
|
|
homepage "https://kripken.github.io/emscripten-site/"
|
|
url "https://github.com/kripken/emscripten/archive/1.29.11.tar.gz"
|
|
sha1 "d926f406486e3c3a94a1fe58783a91fd6975bc9c"
|
|
|
|
bottle do
|
|
sha256 "75c43ccaa49dc749f51bae40ac86d4bb767df74866ab9650dd8153f79139d529" => :yosemite
|
|
sha256 "61d9ec9b4f6f914fcc17cc8278081dfd5b4858c287fc5b1ef1a333bd175a190e" => :mavericks
|
|
sha256 "699b9c70104360d5210a3eeb6a09e93c6b78140566ac39eda89c9eb317050ccb" => :mountain_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.29.11.tar.gz"
|
|
sha1 "bde56decd9b46962b53b129de5d942dd03d9e960"
|
|
end
|
|
|
|
resource "fastcomp-clang" do
|
|
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.29.11.tar.gz"
|
|
sha1 "08a75316f4578ca0b3a40316aa6dc52f89199a61"
|
|
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",
|
|
]
|
|
|
|
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_libexec}/llvm/bin
|
|
in ~/.emscripten after running `emcc` for the first time.
|
|
EOS
|
|
end
|
|
end
|