d4f54d88e2
Closes Homebrew/homebrew#33481. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
93 lines
3 KiB
Ruby
93 lines
3 KiB
Ruby
require "formula"
|
|
|
|
class Emscripten < Formula
|
|
homepage "http://emscripten.org"
|
|
url "https://github.com/kripken/emscripten/archive/1.25.2.tar.gz"
|
|
sha1 "6ef643c761d0e07d428fe882d007b48b82f9e0c2"
|
|
|
|
bottle do
|
|
revision 1
|
|
sha1 "2e43d32ea4e376d6815b41a21572ebde86d85e39" => :yosemite
|
|
sha1 "1665407229116c4cd0db67b9fa54489609684e1c" => :mavericks
|
|
sha1 "a96131a541e2b6bc0d0273646c41729870bd697a" => :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.25.2.tar.gz"
|
|
sha1 "32421e56fc3c89820232649bba101d70eb592888"
|
|
end
|
|
|
|
resource "fastcomp-clang" do
|
|
url "https://github.com/kripken/emscripten-fastcomp-clang/archive/1.25.2.tar.gz"
|
|
sha1 "576e5559e94211b352a33ad7b92c451f8ae690ec"
|
|
end
|
|
end
|
|
|
|
depends_on :python if MacOS.version <= :snow_leopard
|
|
depends_on "node"
|
|
depends_on "closure-compiler" => :optional
|
|
depends_on "yuicompressor"
|
|
|
|
def install
|
|
# 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
|
|
# Fix for parsing Mac OS X version numbers >= 10.10
|
|
# https://groups.google.com/forum/#!msg/emscripten-discuss/8gb88R5eyqs/p9_82Wi2pSAJ
|
|
inreplace "Makefile.rules", '10.([0-9])', '10.([0-9]+)'
|
|
inreplace "Makefile.rules", '(10.[0-9])', '(10.[0-9]+)'
|
|
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_prefix}/libexec/llvm/bin\"
|
|
in ~/.emscripten after running `emcc` for the first time.
|
|
EOS
|
|
end
|
|
end
|