From 7d0adf956cf6764c0ea04d800d50c82b77d9da3c Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 10 Feb 2022 18:36:32 -0800 Subject: [PATCH] spidermonkey 91.6.0 --- Aliases/spidermonkey@91 | 1 + Formula/spidermonkey.rb | 84 ++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 31 deletions(-) create mode 120000 Aliases/spidermonkey@91 diff --git a/Aliases/spidermonkey@91 b/Aliases/spidermonkey@91 new file mode 120000 index 00000000000..9396c34f84e --- /dev/null +++ b/Aliases/spidermonkey@91 @@ -0,0 +1 @@ +../Formula/spidermonkey.rb \ No newline at end of file diff --git a/Formula/spidermonkey.rb b/Formula/spidermonkey.rb index dae6f59bed6..a0425bd038a 100644 --- a/Formula/spidermonkey.rb +++ b/Formula/spidermonkey.rb @@ -1,11 +1,10 @@ class Spidermonkey < Formula desc "JavaScript-C Engine" homepage "https://spidermonkey.dev" - url "https://archive.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz" - version "1.8.5" - sha256 "5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687" - license "MPL-1.1" - revision 4 + url "https://archive.mozilla.org/pub/firefox/releases/91.6.0esr/source/firefox-91.6.0esr.source.tar.xz" + version "91.6.0" + sha256 "7e802832152c39588b9a5c8392e90c1b00036bf948fa4a97a7af0d1435ba09a1" + license "MPL-2.0" head "https://hg.mozilla.org/mozilla-central", using: :hg # Spidermonkey versions use the same versions as Firefox, so we simply check @@ -22,49 +21,72 @@ class Spidermonkey < Formula sha256 cellar: :any, mojave: "8c0b46bc04a7e95f99262969b22cc311ee1f7d83413af05865318743ccd96944" end - depends_on :macos # Due to Python 2 + depends_on "autoconf@2.13" => :build + depends_on "pkg-config" => :build + depends_on "python@3.9" => :build + depends_on "rust" => :build + depends_on "icu4c" depends_on "nspr" depends_on "readline" + uses_from_macos "llvm" => :build # for llvm-objdump + uses_from_macos "m4" => :build + uses_from_macos "zlib" + + on_linux do + depends_on "gcc" + end + conflicts_with "narwhal", because: "both install a js binary" + # From python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py + fails_with :gcc do + version "6" + cause "Only GCC 7.1 or newer is supported" + end + def install - cd "js/src" do - # Remove the broken *(for anyone but FF) install_name - inreplace "config/rules.mk", - "-install_name @executable_path/$(SHARED_LIBRARY) ", - "-install_name #{lib}/$(SHARED_LIBRARY) " + # Remove the broken *(for anyone but FF) install_name + # _LOADER_PATH := @executable_path + inreplace "config/rules.mk", + "-install_name $(_LOADER_PATH)/$(SHARED_LIBRARY) ", + "-install_name #{lib}/$(SHARED_LIBRARY) " - # The ./configure script assumes that it can find readline - # just as "-lreadline", but we want it to look in opt/readline/lib - inreplace "configure", "-lreadline", "-L#{Formula["readline"].opt_lib} -lreadline" - end - - # The ./configure script that comes with spidermonkey 1.8.5 makes some mistakes - # with Xcode 12's default setting of -Werror,implicit-function-declaration - ENV.append "CFLAGS", "-Wno-implicit-function-declaration" + inreplace "old-configure", "-Wl,-executable_path,${DIST}/bin", "" + cd "js/src" + system "autoconf213" mkdir "brew-build" do - system "../js/src/configure", "--prefix=#{prefix}", - "--enable-readline", - "--enable-threadsafe", - "--with-system-nspr", - "--with-nspr-prefix=#{Formula["nspr"].opt_prefix}", - "--enable-macos-target=#{MacOS.version}" - - inreplace "js-config", /JS_CONFIG_LIBS=.*?$/, "JS_CONFIG_LIBS=''" - # These need to be in separate steps. + system "../configure", "--prefix=#{prefix}", + "--enable-optimize", + "--enable-readline", + "--enable-release", + "--enable-shared-js", + "--disable-bootstrap", + "--disable-jemalloc", + "--with-intl-api", + "--with-system-icu", + "--with-system-nspr", + "--with-system-zlib" system "make" system "make", "install" - - # Also install js REPL. - bin.install "shell/js" end + + (lib/"libjs_static.ajs").unlink + + # Add an unversioned `js` to be used by dependents like `jsawk` & `plowshare` + ln_s bin/"js#{version.major}", bin/"js" + + # Avoid writing nspr's versioned Cellar path in js*-config + inreplace bin/"js#{version.major}-config", + Formula["nspr"].prefix.realpath, + Formula["nspr"].opt_prefix end test do path = testpath/"test.js" path.write "print('hello');" + assert_equal "hello", shell_output("#{bin}/js#{version.major} #{path}").strip assert_equal "hello", shell_output("#{bin}/js #{path}").strip end end