spidermonkey 91.6.0

master
Michael Cho 2022-02-10 18:36:32 -08:00 committed by BrewTestBot
parent d414362cfa
commit 7d0adf956c
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
2 changed files with 54 additions and 31 deletions

1
Aliases/spidermonkey@91 Symbolic link
View File

@ -0,0 +1 @@
../Formula/spidermonkey.rb

View File

@ -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