From 3b4066bf339a09b6b6b36e29336f2491416c59ad Mon Sep 17 00:00:00 2001 From: carlocab <30379873+carlocab@users.noreply.github.com> Date: Thu, 3 Dec 2020 13:32:53 +0000 Subject: [PATCH] emscripten 2.0.10 - bumped emscripten version - changed llvm revision according to (see formula for details): - https://github.com/emscripten-core/emsdk/blob/master/emscripten-releases-tags.txt - https://chromium.googlesource.com/emscripten-releases/+/37fc7647c754ac9a28ad588c143b82286de0ef71/DEPS - use recommended binaryen revision - The same has been done with llvm. See: https://github.com/Homebrew/homebrew-core/pull/63183 - updated license to reflect bundled llvm and binaryen --- Formula/emscripten.rb | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/Formula/emscripten.rb b/Formula/emscripten.rb index efffb72e3ad3..ff09ae5b4346 100644 --- a/Formula/emscripten.rb +++ b/Formula/emscripten.rb @@ -3,12 +3,15 @@ class Emscripten < Formula desc "LLVM bytecode to JavaScript compiler" homepage "https://emscripten.org/" - url "https://github.com/emscripten-core/emscripten/archive/2.0.7.tar.gz" - sha256 "ffe4a1e6b6cb223bfcb2f8ca28d39b23c4ae7102b36f69f40669739762d91445" + url "https://github.com/emscripten-core/emscripten/archive/2.0.10.tar.gz" + sha256 "e37d625c2cdf5cfcccaaa58ec1a4e60b126b9d738fafc1caa7effd4c22fde136" # Emscripten is available under 2 licenses, the MIT license and the # University of Illinois/NCSA Open Source License. - license "MIT" - revision 1 + license all_of: [ + "MIT", + "Apache-2.0", # binaryen + "Apache-2.0" => { with: "LLVM-exception" }, # llvm + ] head "https://github.com/emscripten-core/emscripten.git" livecheck do @@ -25,11 +28,17 @@ class Emscripten < Formula end depends_on "cmake" => :build - depends_on "binaryen" depends_on "node" depends_on "python@3.9" depends_on "yuicompressor" + # Use emscripten's recommended binaryen revision to avoid build failures. + # See llvm resource below for instructions on how to update this. + resource "binaryen" do + url "https://github.com/WebAssembly/binaryen.git", + revision: "bd9872ddf850bf177298a5274a15807e6227cd3d" + end + # emscripten needs argument '-fignore-exceptions', which is only available in llvm >= 12 # To find the correct llvm revision, find a corresponding commit at: # https://github.com/emscripten-core/emsdk/blob/master/emscripten-releases-tags.txt @@ -38,7 +47,7 @@ class Emscripten < Formula # Then use the listed llvm_project_revision for the resource below. resource "llvm" do url "https://github.com/llvm/llvm-project.git", - revision: "25a8881b724abf7251a9278e72224af7e82cb9c2" + revision: "445289aa63e1b82b9eea6497fb2d0443813a9d4e" end def install @@ -95,12 +104,23 @@ def install end mkdir llvmpath/"build" do + # We can use `make` and `make install` here, but prefer these commands + # for consistency with the llvm formula. system "cmake", "-G", "Unix Makefiles", "..", *args system "cmake", "--build", "." system "cmake", "--build", ".", "--target", "install" end end + resource("binaryen").stage do + args = std_cmake_args.reject { |s| s["CMAKE_INSTALL_PREFIX"] } + %W[ + -DCMAKE_INSTALL_PREFIX=#{libexec}/binaryen + ] + + system "cmake", ".", *args + system "make", "install" + end + cd libexec do system "npm", "install", *Language::Node.local_npm_install_args rm_f "node_modules/ws/builderror.log" # Avoid references to Homebrew shims @@ -116,7 +136,7 @@ def post_install system bin/"emcc" inreplace "#{libexec}/.emscripten" do |s| s.gsub! /^(LLVM_ROOT.*)/, "#\\1\nLLVM_ROOT = \"#{opt_libexec}/llvm/bin\"\\2" - s.gsub! /^(BINARYEN_ROOT.*)/, "#\\1\nBINARYEN_ROOT = \"#{Formula["binaryen"].opt_prefix}\"\\2" + s.gsub! /^(BINARYEN_ROOT.*)/, "#\\1\nBINARYEN_ROOT = \"#{opt_libexec}/binaryen\"\\2" end end