Compiler support for native Windows for 4.13+
Adds support for the mingw-w64 and MSVC native Windows ports of OCaml
for OCaml 4.13.0 onwards.
Two minor updates are required to the options packages:
- ocaml-option-nnpchecker is supported by the 64-bit MSVC port (but
not by the mingw-w64, because it relies on SEH, which mingw-w64 GCC
doesn't support)
- ocaml-option-tsan is not supported on any Windows ports (sadly)
The conf-msvc32 and conf-msvc64 packages can be co-installed, but only
one compiler may be activated at a time. This is expressed by the
ocaml-env-msvc32 and ocaml-env-msvc64 packages, which ensure that only
configuration is set in the environment. Placing these updates in a
separate package also ensure that the setenv updates are only ever
considered when actually needed (avoiding the issues with opam 2.0.10
and 2.0.4 not supporting += "" in environment updates).
ocaml-system is updated to install the appropriate host-arch- package
dependent on the opam 2.1 sys-ocaml-arch variable. This variable is the
value of ocamlc -config-var architecture, but with amd64 changed to
x86_64 and i386 changed to i686. If this variable is not defined by opam
(for example, for opam 2.0, or where an opam root was upgraded from 2.0
to 2.1), then host-arch-unknown is installed. For Windows, this variable
must be defined. host-system-mingw, host-system-msvc or
host-system-other are installed dependent on the opam 2.1 sys-ocaml-libc
("msvc" for mingw-w64 and MSVC ports and "libc" for everything else) and
sys-ocaml-cc ("cl" for the MSVC port and "cc" for everything else)
variables.
ocaml-base-compiler and ocaml-variants both recognise the arch-x86_64
and arch-x86_32 packages for Windows which allow selecting between the
32-bit and 64-bit variants of the Windows ports (note that this is
distinct from the somewhat ad hoc ocaml-option-32bit package) and
similarly system-mingw and system-msvc to select between the mingw-w64
and MSVC ports. Both packages use the flexdll source package to
bootstrap flexlink and the FlexDLL runtime objects as part of the
compiler build.
All three packages will configure either the appropriate depexts and
mingw-w64 shims or Microsoft Visual Studio Tools environment for the
given compiler port, and ensure that these are placed into the
environment as part of opam env.