95 lines
2.9 KiB
Ruby
95 lines
2.9 KiB
Ruby
class Emscripten < Formula
|
|
desc "LLVM bytecode to JavaScript compiler"
|
|
homepage "https://emscripten.org/"
|
|
|
|
stable do
|
|
url "https://github.com/emscripten-core/emscripten/archive/1.39.10.tar.gz"
|
|
sha256 "63c40e3c01eb416d48f1d46b7a180f7fcac67bd6cef23999457a1a6f9c7ba645"
|
|
|
|
resource "fastcomp" do
|
|
url "https://github.com/emscripten-core/emscripten-fastcomp/archive/1.39.10.tar.gz"
|
|
sha256 "12335fcdbaca1d13fb48b754cd34c1b0d641208bc26b9716d2d15132980b1a84"
|
|
end
|
|
|
|
resource "fastcomp-clang" do
|
|
url "https://github.com/emscripten-core/emscripten-fastcomp-clang/archive/1.39.10.tar.gz"
|
|
sha256 "d9f6be46eb7fbd34b55cdf55f24d88a207bff0e2a3d14e50a184723ec5071604"
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "2bc9f9f717a831304ea899dd0fcd4ddf91fb24a14cc48887706c7e46ba12e49c" => :catalina
|
|
sha256 "e9e21e75970ddb6580d4d55587354359f038c703fc4b6dfe0f08350cff1d81a6" => :mojave
|
|
sha256 "ca9bfa9a945f817ff84b9f6a3488c3d1cff7128ef2c4cd02e0eda409ed2546a7" => :high_sierra
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/emscripten-core/emscripten.git", :branch => "incoming"
|
|
|
|
resource "fastcomp" do
|
|
url "https://github.com/emscripten-core/emscripten-fastcomp.git", :branch => "incoming"
|
|
end
|
|
|
|
resource "fastcomp-clang" do
|
|
url "https://github.com/emscripten-core/emscripten-fastcomp-clang.git", :branch => "incoming"
|
|
end
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "binaryen"
|
|
depends_on "node"
|
|
depends_on "python"
|
|
depends_on "yuicompressor"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
# 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")
|
|
|
|
cmake_args = std_cmake_args.reject { |s| s["CMAKE_INSTALL_PREFIX"] }
|
|
cmake_args = [
|
|
"-DCMAKE_BUILD_TYPE=Release",
|
|
"-DCMAKE_INSTALL_PREFIX=#{libexec}/llvm",
|
|
"-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'",
|
|
"-DLLVM_INCLUDE_EXAMPLES=OFF",
|
|
"-DLLVM_INCLUDE_TESTS=OFF",
|
|
"-DCLANG_INCLUDE_TESTS=OFF",
|
|
"-DOCAMLFIND=/usr/bin/false",
|
|
"-DGO_EXECUTABLE=/usr/bin/false",
|
|
]
|
|
|
|
mkdir "fastcomp/build" do
|
|
system "cmake", "..", *cmake_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
|
|
Manually set LLVM_ROOT to
|
|
#{opt_libexec}/llvm/bin
|
|
and BINARYEN_ROOT to
|
|
#{Formula["binaryen"].opt_prefix}
|
|
in ~/.emscripten after running `emcc` for the first time.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
system bin/"emcc"
|
|
assert_predicate testpath/".emscripten", :exist?, "Failed to create sample config"
|
|
end
|
|
end
|