OPAM depexts on macos/darwin: how to specify Perl packages?

Recently a user told me that one of the camlp5 external dependencies was not found on macos. The dependencies are to perl packages, and specifically to:

  • String::Shellquote
  • IPC:System:Simple

It was straightforward to determine the OS-package-names for Ubuntu/Debian/Alpine/Fedora/Centos/Suse – in short, for all the Linuxes. Just google around, and a name pops up. But doing that for macos (for instance) yields p5.28-string-shellquote and p5.30-ipc-system-simple.

This seems … incompatible, though maybe just using perl5.30 will work? That doesn’t seem great either (hard-coding a perl version dependency). There doesn’t seem to be a conf-perl dependency for macos, and more generally, it’s not clear how to pick package-names on macos?

Does anybody have any experience with this? It’s not a very easy-to-access platform, compared to Linux. [by which I mean only that for those who buy their computers cheap/cheap/cheap, it’s … well, inaccessible.]

ETA: I tried specifying just “perl”, that is, adding the following to depexts:

  ["perl"] {os-family = "macos"}

and it didn’t work, either.

Probably naive, but is dropping perl from the build script an option? It shouldn’t be very hard (if a little more verbose) to rewrite any perl script in OCaml, and you will solve this problem for good on all platforms for all users.

Is there a way to access a MacOS image over the net, where I could run opam-based builds repeatedly, so I wouldn’t be consuming a lot of resources?

Alternatively, are the OPAM maintainers going to be OK with my creating a tiny package that basically just has the depext in it, so I can experiment and figure out how to get the perl dependency?

Or are you saying that on MacOS, OPAM doesn’t support depext at all?

Is there a way to specify that a package cannot be installed on a certain operating system? That would suffice, too.

You could use Github Actions, they have MacOS runners and for public repositories they are free. https://github.com/rgrinberg/opium/blob/master/.github/workflows/ci.yml

Or are you saying that on MacOS, OPAM doesn’t support depext at all?

MacOS definitely supports depexts. You just have to specify homebrew or macports. Homebrew doesn’t seem to provide those packages, but MacPorts has p5.30-string-shellquote
and p5.30-ipc-system-simple as its latest versions.

I believe it must be osx. You can specify perl5.30 for macports.

This is possible with the available field.

No, it should be “macos”: https://github.com/ocaml/opam/blob/f0e82e93b1943fa59a22192a6507f5ed71605341/src/state/opamFormatUpgrade.ml#L24

Thank you: the “available” field seems to have worked, and short-circuited the macos CI build. I’ll document that if somebody wants to run this code on MacOS, they should contact me, and we can work thru actually getting the OPAM file to work on MacOS.

I tried a few combinations, including os = "osx" and the two packages that @mnxn had suggested, but it still failed. Not sure why, but the simplest thing is to wait for an actual user on MacOS.