I also started testing the beta version(s) of opam 2.2 on Windows: It is really great work! Calling opam and dune from powershell works perfect. I am struggeling with some packages requiring system dependencies (“depext”), many of which require some updates as already discussed in various threads.
Currently, opam 2.2 on Windows sets os=win32 and os-distibution=cygwin (found by calling opam config report).
In the past (meaning the “Ocaml on Windows” setup by @fdopen) we used os-distribution=cygwinports to identify depext’s for the “cygwin mingw64 cross-compiling” environment. What is the idea for opam 2.2 on Windows to identify the mingw64 environment? os-distribution=cygwin sounds misleading in my opinion, as it might identify the native cygwin setup.
Thanks for trying it out, @kkirstein - can I ask if this is hot off the press with beta3 or with beta2 (as the behaviour of os-distribution has been changed slightly)?
os-distribution identifies the operating environment - it’s not related to the mingw64 part. When the Cygwin build of opam, you’d have both os and os-distribution being cygwin.
For native Windows (os = "win32"), opam 2.2.0 will natively return three possible values of os-distribution. It’s based on whether it found the core cygcheck.exe utility (which is common to both Cygwin and MSYS2). If it does, then os-distribution will either be cygwin or msys2. If it can’t find cygcheck.exe, then it will be win32 (and very little will work, obviously).
It is still possible to set it to use the old cygwinports (using opam var --global os-distribution=cygwinports) but this should only be done if using opam-repository-mingw and the opam-depext plugin there. Note that the name cygwinports was simply borrowed from the Cygwin Ports project, which got merged into Cygwin itself.
For getting the appropriate environment, there’s the mingw-w64-shims package in opam-repository which is used when os-distribution = "cygwin" to ensure that the appropriate cross-tools are made available; for MSYS2, there’s the msys2 package in opam-repository which adds the appropriate MSYS2 Environment to PATH, etc.
Thanks for the clarification. It is not a hot issue with current beta 2 or 3 of opam 2.2.
As I am starting now “porting” more of my projects from the “old” Ocaml for Windows setup, I am stepping into more and more packages, which require a fixing of the depext configuration to work with opam 2.2 on “native” Windows. I just want to make sure to get the fixes right from the beginning
As a summary I conclude the following values for the different toolchains on windows:
cygwin based environment (todays preferred environment): os=win32 & os-distribution=cygwin
msys based environment (might be supported in the near future): os=win32 & os-distribution=msys2
native Windows environment without “POSIX-helper”: os=win32 & os-distribution=win32 (this won’t be supported by many packages in the near/mid-term future)
cygwin based environment for cygwin-based builds: os=cygwin & os-distribution=cygwin (Is this supported for ocaml >= 5.0 anyway?)
So, it would make sense to remove configurations os-distribution=cygwinports, if we deprecate the “old” OCaml for Windows ( OCaml for Windows - OCaml for Windows (fdopen.github.io)) setup (I don’t know, how the DKML-distro handles this).