Closed DanGrayson closed 3 years ago
I worked out how to make a just working formulae using this guide, but I don't have access to a Macbook to continue. If anybody picks this up, let me know.
I agree that this would be very nice to have, but it's not easy! 2008-16 I've been maintaining the Macaulay2 packages for Gentoo and that has started as a nightmare and became worse and worse over the years.
A "problem" is that M2's build system is basically a package manager and it relies on having its own little patches and fixed versions of libraries. This is known as "bundling". While not as bad as Elsevier's "bundling", it does create problems. Back in the Gentoo days we determined that an average Mac user has about 117 copies of "zlib" on his computer. Every program brings zlib. Now imagine a security bug is found in zlib.... Therfore package managers of distributions (like homebrew and portage) want to unbundle and install each library only once. In Gentoo it meant that the M2 package could not install a single internal library. All libraries needed to be separate packages. That means M2 should rely on homebrew versions of all its dependencies. Keeping that whole tree in shape is a lot of work and conflicts arise if you want a patch on mpfr that other consumers of that library don't want, etc. Is it really useful to spend our time on this?
Recently M2 has become a lot less dependent on patching the libraries it uses, because we no longer use pari and we no longer tell gmp to use libgc. That might make it feasible. @d-torrance can chime in about the extent to which that is now true for Debian.
Recently M2 has become a lot less dependent on patching the libraries it uses, because we no longer use pari and we no longer tell gmp to use libgc. That might make it feasible. @d-torrance can chime in about the extent to which that is now true for Debian.
The master branch now builds with very few problems using the Debian packages of all of the various dependencies, no bundling required. And these "few problems" are just the absences of various packages (e.g., mpsolve and the latest version of flint), which will be fixed as soon as those packages arrive in Debian. (The two I mentioned are currently in the "NEW queue" and should appear in Debian in the not-too-distant future.)
There are some dependencies which may need to be packaged first. For example, I packaged memtailor, mathic, mathicgb, frobby, etc. for Debian. But there are other dependencies which should already be in homebrew. I see that Sage is in homebrew, and there's a lot of crossover there.
Here's the PR: https://github.com/Homebrew/homebrew-core/pull/58132. We'll see how it goes.
If anybody is interested in testing it in the meanwhile, try:
cd `brew --repo homebrew/core`
git remote add mahrud https://github.com/mahrud/homebrew-core.git
git checkout -b mahrud/new-formula/Macaulay2
brew install --debug --verbose macaulay2
brew test macaulay2
I'm trying but I don't know how homebrew works really.
First,
* git checkout mahrud/new-formula/Macaulay2
would need to be
git checkout -b mahrud/new-formula/Macaulay2
if one tries from scratch because initially the branch is only on remote. Then after that brew install does not work as homebrew is switching back to master maybe? This is how it looks here:
➜ homebrew-core git:(mahrud/new-formula/Macaulay2) brew install --debug --verbose macaulay2
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
lunchy lunchy-go
==> Updated Formulae
awscli grafana
Error: No available formula with the name "macaulay2"
Ah, yes, thank you! It's kind of annoying how brew keeps undoing uncommitted changes actually. I wonder if there's a flag that I don't know of.
Alright, we got some reviews over on the pull request, the main one being that they want some of the dependencies packaged separately, which was predictable. But also the builds were failing with strange errors on macOS 10.13, 10.14, and even 10.15 (all while building the libraries). So I converted the PR to a draft for now. In the meanwhile, if anyone would like to submit formulae for any of the following, it'll be appreciated:
And also:
If anybody is interested in testing it in the meanwhile, try:
The easiest way is using https://github.com/github/hub and doing hub pr checkout <number>
Ah, yes, thank you! It's kind of annoying how brew keeps undoing uncommitted changes actually. I wonder if there's a flag that I don't know of.
If you just run brew install -s formula
it won't remove uncommitted changes. Commands like brew update
can do that though.
Here's the PR: Homebrew/homebrew-core#58132. We'll see how it goes.
Great work!!! That was quick!
We should probably create a Macaulay2 tap and attach the casks as binaries on the Github Releases (see https://brew.sh/2020/11/18/homebrew-tap-with-bottles-uploaded-to-github-releases/). This might sidestep the requirements to get added to the official homebrew repository until all those dependencies are packaged.
Done via https://github.com/mahrud/homebrew-tap/pull/3. Try:
brew tap mahrud/tap
brew install M2
Documentation and changes to README files will be added later.
I tried it, it installs and runs under 11.1. Thanks!
Done via mahrud/homebrew-tap#3. Try:
brew tap mahrud/tap brew install M2
Documentation and changes to README files will be added later.
It works here, too! Great job -- this will save me work in the future.
Thomas, did it install from a bottle on 11.1, or did it have to build from source? Github only supports two macOS runners, macos-11.0 and macos-10.15. Currently the bottling happens for macos-10.15 and ubuntu-18.04, but I can adjust that if you think macos-11.0 is becoming more common.
Thomas, did it install from a bottle on 11.1, or did it have to build from source? Github only supports two macOS runners, macos-11.0 and macos-10.15. Currently the bottling happens for macos-10.15 and ubuntu-18.04, but I can adjust that if you think macos-11.0 is becoming more common.
Yes, it uses the catalina bottle: ==> Downloading https://github.com/mahrud/homebrew-tap/releases/download/macaulay2-1.17_1/macaulay2-1.17_1.catalina.bottle.tar.gz Already downloaded: /Users/tom/Library/Caches/Homebrew/downloads/6593a1bb6a5d886b425c938019de53406735980ae39f503dde4d29d004ccc0fd--macaulay2-1.17_1.catalina.bottle.tar.gz ==> Pouring macaulay2-1.17_1.catalina.bottle.tar.gz
Oh, did the emacs package get installed and loaded correctly?
I think they get installed in $HOMEBREW_PREFIX/share/emacs/site-lisp/macaulay2
and setupEmacs
adds the correct path in .emacs-Macaulay2
, so I think it's fine.
Yes, the site-lisp files work just fine. Speaking of Emacs, I now use https://github.com/d12frosted/homebrew-emacs-plus. It's been smooth sailing, except some minor daemonic issues.
A better way to distribute Macaulay2 on the Mac would be via homebrew, which already provides many of the third party packages we depend on. Doug Torrance (@d-torrance) has been working on getting Macaulay2 into debian (and thus ubuntu) in #286, and that's similar work. This would simplify issuing releases considerably if we got those two systems covered.