[opam-devel] [wg-windows] Identifying windows ports for build systems & cross compiling distinctions

David Allsopp dra-news at metastack.com
Thu Jul 23 19:55:50 BST 2015

Daniel Bünzli wrote:
> Le mardi, 30 juin 2015 à 18:52, Daniel Bünzli a écrit :
> > Le mardi, 30 juin 2015 à 18:13, David Allsopp a écrit :
> > > $OCAMLLIB/Makefile.config defines TOOLCHAIN variable already which
> gives mingw or msvc.
> >
> It seems that `ocamlc -config` doesn't output this variable. Could anyone
> confirm me that `ocamlc -config | grep ccomp_type` gives the information
> (and how).

utils/config.mlp shows that the output will be the CCOMPTYPE variable OCaml was configured with; config/Makefile.{msvc,msvc64,mingw,mingw64} show that is "msvc" for the first two and "cc" for the second two.
> Besides regarding the initial discussion I think the only reasonable
> option would be:
> b) Distinguish an OS for the mingw ports

That looks an abuse to me! The operating system for all four ports is Win32 (yes, it may sound strange that the OS for a 64-bit port is also Win32, but that's actually how the parlance works and isn't unique to OCaml...). The operating system for the Cygwin ports is *not* Windows, hence the different output.

Additionally, while new code out there may be taking advantage of Sys.win32, I expect there's a lot of code still reasonably expecting that Sys.os_type = "Win32" will work forever. Adding Sys.comp_type would be handy, of course... but then having the entire Config module as Sys.Config would be generally quite useful!

> However I would like to get feedback from windows users if it makes sense
> to do this, in the sense that a lot of things have to be done differently
> build-wise with mingw compared to a plain win32 and that it's useful in
> build systems to be able to get that information without having to grep
> `ocamlc -config`. Because if it's only for the file extension business
> maybe it's not such a good idea to define an os value for it.

I'm not sure what you're getting at here - what build system differences are you referring to? 


More information about the opam-devel mailing list