Skip to content

smlnj 2026.1 (new formula)#281089

Open
zbyrn wants to merge 1 commit intoHomebrew:mainfrom
zbyrn:main
Open

smlnj 2026.1 (new formula)#281089
zbyrn wants to merge 1 commit intoHomebrew:mainfrom
zbyrn:main

Conversation

@zbyrn
Copy link
Copy Markdown

@zbyrn zbyrn commented May 5, 2026

This PR adds SML/NJ as a source-built formula.

SML/NJ is currently available in Homebrew as a cask that installs the published macOS .pkg installer. That installer is not notarized, and the cask is already scheduled for removal later this year. This formula provides a replacement.

In addition, while the cask installs the legacy compiler, the formula installs the development compiler, which offers native ARM support.

The formula builds from the source distribution, using a bootstrapping compiler from the official website. The main installer script ./build.sh runs completely offline when the bootstrapping compiler is present.

I am one of the maintainers of SML/NJ, and I believe the formula-based installation is better-suited for Homebrew users. I am also happy to maintain this formula going forward.

Companion PR: Homebrew/homebrew-cask#262856.

Note: The current CI failure is due to the token conflict with the existing smlnj cask, which is being removed in the companion PR.


  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>?
  • Is your test running fine brew test <formula>?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

@github-actions github-actions Bot added the new formula PR adds a new formula to Homebrew/homebrew-core label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request.

@zbyrn zbyrn marked this pull request as ready for review May 6, 2026 00:05
@p-linnane p-linnane added CI-skip-new-formulae Pass --skip-new to brew test-bot. CI-skip-new-formulae-strict Pass --skip-new-strict to brew test-bot. labels May 6, 2026
@p-linnane
Copy link
Copy Markdown
Member

Thanks for the PR @zbyrn. I've added labels that will allow us to skip the token check for now so we can run CI.

Comment thread Formula/s/smlnj.rb Outdated
Comment thread Formula/s/smlnj.rb

depends_on "autoconf" => :build
depends_on "cmake" => :build
uses_from_macos "zlib"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses_from_macos "zlib"
uses_from_macos "zlib"

Comment thread Formula/s/smlnj.rb Outdated

resource "bootarchive" do
on_arm do
url "https://smlnj.org/dist/working/2026.1/boot.arm64-unix.tgz"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url "https://smlnj.org/dist/working/2026.1/boot.arm64-unix.tgz"
url "https://smlnj.org/dist/working/2026.1/boot.arm64-unix.tgz", using: :nounzip

Comment thread Formula/s/smlnj.rb Outdated
sha256 "ab2807d27d7ade38b09b80ac96d3de082a47aa707108728fe4edb4199caad7fd"
end
on_intel do
url "https://smlnj.org/dist/working/2026.1/boot.amd64-unix.tgz"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url "https://smlnj.org/dist/working/2026.1/boot.amd64-unix.tgz"
url "https://smlnj.org/dist/working/2026.1/boot.amd64-unix.tgz", using: :nounzip

Comment thread Formula/s/smlnj.rb Outdated
Comment on lines +31 to +37
boot_archive = resource("bootarchive").cached_download
boot_name = if Hardware::CPU.arm?
"boot.arm64-unix.tgz"
else
"boot.amd64-unix.tgz"
end
cp boot_archive, buildpath/boot_name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boot_archive = resource("bootarchive").cached_download
boot_name = if Hardware::CPU.arm?
"boot.arm64-unix.tgz"
else
"boot.amd64-unix.tgz"
end
cp boot_archive, buildpath/boot_name
buildpath.install resource("bootarchive")

Comment thread Formula/s/smlnj.rb
Comment on lines +43 to +53
libexec.mkpath
cd buildpath do
ENV["INSTALLDIR"] = libexec.realpath.to_s
system "./build.sh"

%w[
sml asdlgen heap2exec ml-antlr ml-build ml-burg ml-makedepend ml-ulex ml-yacc
].each do |cmd|
bin.write_exec_script libexec/"bin/#{cmd}"
end
end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this builds its own LLVM. We should use Homebrew's LLVM.

@github-actions github-actions Bot added the autosquash Automatically squash pull request commits according to Homebrew style. label May 6, 2026
@zbyrn zbyrn force-pushed the main branch 2 times, most recently from cda519c to 9aa68f8 Compare May 6, 2026 04:28
@github-actions github-actions Bot removed the autosquash Automatically squash pull request commits according to Homebrew style. label May 6, 2026
zbyrn added a commit to zbyrn/homebrew-cask that referenced this pull request May 6, 2026
Comment thread Formula/s/smlnj.rb Outdated

livecheck do
url :homepage
regex(%r{href=["']?dist/working/(\d+(?:\.\d+)+)/index\.html["' >]}i)
Copy link
Copy Markdown
Member

@samford samford May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
regex(%r{href=["']?dist/working/(\d+(?:\.\d+)+)/index\.html["' >]}i)
regex(%r{href=["']?[^"' >]*dist/working/v?(\d+(?:\.\d+)+)/(?:index\.html)?["' >]}i)

This general livecheck approach seems fine but this suggestion adds some small tweaks for the sake of flexibility:

  • Adds [^"' >]* before the URL path, so the regex will continue to match if the URLs become absolute or additional directories are added at the start of the path.
  • Adds v? before the version regex to use our standard pattern.
  • Makes index.html optional, as the server successfully serves the page with it omitted and upstream could potentially remove it from these URLs in the future. Since we're anchoring the end of the href attribute with ["' >], this will continue to match only links to version pages (not other links like README.html).

Add SML/NJ as a source-built formula. This is intended to replace the
existing smlnj cask, which uses an un-notarized macOS package installer.
@zbyrn
Copy link
Copy Markdown
Author

zbyrn commented May 6, 2026

Thanks, @p-linnane and @samford, for your quick review! I've incorporated all your suggestions, and I learned a lot!

The build script needs to build LLVM because we actually have a fork of LLVM (smlnj/smlnj-llvm-21.1) that supports our own calling conventions. While we are working to eventually upstream it, the current system only works with the customized LLVM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-new-formulae Pass --skip-new to brew test-bot. CI-skip-new-formulae-strict Pass --skip-new-strict to brew test-bot. new formula PR adds a new formula to Homebrew/homebrew-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants