Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions Formula/s/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
class SpidermonkeyAT128 < Formula
desc "JavaScript-C Engine"
homepage "https://spidermonkey.dev"
url "https://archive.mozilla.org/pub/firefox/releases/128.14.0esr/source/firefox-128.14.0esr.source.tar.xz"
version "128.14.0"
sha256 "93b9ef6229f41cb22ff109b95bbf61a78395a0fe4b870192eeca22947cb09a53"
license "MPL-2.0"

# Spidermonkey versions use the same versions as Firefox, so we simply check
# Firefox ESR release versions.
livecheck do
url "https://www.mozilla.org/en-US/firefox/releases/"
regex(%r{href=.*?/v?(128(?:\.\d+)+)/releasenotes}i)
end

keg_only :versioned_formula

depends_on "cbindgen" => :build
depends_on "pkgconf" => :build
depends_on "[email protected]" => :build
depends_on "rust" => :build
depends_on "icu4c@77"
depends_on "nspr"
depends_on "readline"

uses_from_macos "llvm" => :build # for llvm-objdump
uses_from_macos "m4" => :build
uses_from_macos "zlib"

# From python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
fails_with :gcc do
version "7"
cause "Only GCC 8.1 or newer is supported"
end

# Apply patch used by `gjs` to bypass build error.
# ERROR: *** The pkg-config script could not be found. Make sure it is
# *** in your path, or set the PKG_CONFIG environment variable
# *** to the full path to pkg-config.
# Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1783570
# Ref: https://discourse.gnome.org/t/gnome-45-to-depend-on-spidermonkey-115/16653
patch do
on_macos do
url "https://github.com/ptomato/mozjs/commit/c82346c4e19a73ed4c7f65a6b274fc2138815ae9.patch?full_index=1"
sha256 "0f1cd5f80b4ae46e614efa74a409133e8a69fff38220314f881383ba0adb0f87"
end
end

def install

Check failure on line 49 in Formula/s/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

`brew install --verbose --formula --build-bottle spidermonkey@128` failed on macOS Sonoma (14) on Apple Silicon!

275 | #[cfg(feature = "compiled_data")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: /private/tmp/spidermonkeyA128-20251023-9220-90lm3h/firefox-128.14.0/third_party/rust/icu_provider/src/hello_world.rs:270:5 | 270 | / icu_provider::gen_any_buffer_data_constructors!(locale: include, options: skip, error: DataError, 271 | | #[cfg(skip)] 272 | | functions: [ 273 | | try_new, ... | 277 | | Self, 278 | | ]); | |______- in this macro invocation | = note: expected values for `feature` are: `datagen`, `deserialize_bincode_1`, `deserialize_json`, `deserialize_postcard_1`, `experimental`, `log_error_context`, `logging`, `macros`, `serde`, `std`, and `sync` = help: consider adding `compiled_data` as a feature in `Cargo.toml` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default = note: this warning originates in the macro `icu_provider::gen_any_buffer_data_constructors` (in Nightly builds, run with -Z macro-backtrace for more info) warning: hiding a lifetime that's elided elsewhere is confusing --> /private/tmp/spidermonkeyA128-20251023-9220-90lm3h/firefox-128.14.0/third_party/rust/icu_collections/src/char16trie/trie.rs:95:17 | 95 | pub fn iter(&self) -> Char16TrieIterator { | ^^^^^ ------------------ the same lifetime is hidden here | | | the lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: use `'_` for type paths | 95 | pub fn iter(&self) -> Char16TrieIterator<'_> { | ++++ warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> /private/tmp/spidermonkeyA128-20251023-9220-90lm3h/firefox-128.14.0/third_party/rust/icu_collections/src/codepointinvlist/mod.rs:75:10 | 75 | #[derive(Display, Debug)] | ^------ | | | `Display` is not local | move the `impl` block outside of this constant `_DERIVE_Display_FOR_CodePointInversionListError` 76 | pub enum CodePointInversionListError { | --------------------------- `CodePointInversionListError` is not local | = note: the derive macro `Display` defines the non-local `impl`, and may need to be changed = note: the derive macro `Display` may come from an old version of the `displaydoc` crate, try updating your dependency with `cargo update -p displaydoc` = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl` = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info) warning: hiding a lifetime that's elided elsewhere is confusing --> /private/tmp/spidermonkeyA128-20251023-9220-90lm3h/firefox-128.14.0/third_party/rust/icu_collections/src/codepointinvlist/cpinvlist.rs:386:37 | 386 | pub(crate) fn as_inversion_list(&self) -> &ZeroVec<u32> { | ^^^^^ ------------- | | || | | |the same lifetime is hidden here | | the same lifetime is elided here | the lifetime is elided here | = help: the same lifet
# Workaround for ICU 76+
# Issue ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1927380
inreplace "js/moz.configure", '"icu-i18n >= 73.1"', '"icu-i18n >= 73.1 icu-uc"'

if OS.mac?
inreplace "build/moz.configure/toolchain.configure" do |s|
# Help the build script detect ld64 as it expects logs from LD_PRINT_OPTIONS=1 with -Wl,-version
# Issue ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1844694
s.sub! '"-Wl,--version"', '"-Wl,-ld_classic,-v"' if DevelopmentTools.clang_build_version >= 1500
# Allow using brew libraries on macOS (not officially supported)
s.sub!(/^(\s*def no_system_lib_in_sysroot\(.*\n\s*if )bootstrapped and value:/, "\\1False:")
# Work around upstream only allowing build on limited macOS SDK (14.4 as of Spidermonkey 128)
s.sub!(/^(\s*def mac_sdk_min_version\(.*\n\s*return )"\d+(\.\d+)*"$/, "\\1\"#{MacOS.version}\"")
end
end

mkdir "brew-build" do
args = %W[
--prefix=#{prefix}
--enable-hardening
--enable-optimize
--enable-readline
--enable-release
--enable-rust-simd
--enable-shared-js
--disable-bootstrap
--disable-debug
--disable-jemalloc
--with-intl-api
--with-system-icu
--with-system-nspr
--with-system-zlib
]

system "../js/src/configure", *args
ENV.deparallelize { system "make" }
system "make", "install"
end

rm(lib/"libjs_static.ajs")

# Add an unversioned `js` to be used by dependents like `jsawk` & `plowshare`
bin.install_symlink "js#{version.major}" => "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
Loading