[m-rev.] for review: improve support for MSYS2 builds
Peter Wang
novalazy at gmail.com
Fri Jan 24 14:49:48 AEDT 2020
On Fri, 24 Jan 2020 13:58:33 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
>
> For review by Peter.
>
> This replaces my diff from yesterday; it preserves the possibility
> of using MinGW-w64 cross-compiler.
>
> -------------------------------------
>
> Improve support for MSYS2 builds.
>
> MSYS2 provides a POSIX like environment and package manager for Windows.
> It packages up the MinGW-w64 port of GCC. (MSYS2 is separate from the
> original MSYS.)
Can you add your explanation of the MinGW, MinGW-w64, MSYS and MSYS2
projects to the top of README.MinGW, and the host triplets involved?
>
> Make it possible to build Mercury under MSYS2 with the MinGW-w64 GCC
> without having to resort to cross compilation.
>
> configure.ac:
> Recognise the x86_64-pc-mingw* architecture returned by config.guess
> under MSYS2.
>
> If we are building the MSVC port under MSYS2, set up the flags for
> threads appropriately.
>
> scripts/ml.in:
> Pass libraries to the linker correctly for static linking on all the
> different MinGW configurations.
>
> Julien.
>
> diff --git a/README.MinGW b/README.MinGW
> index 57df999..d6a5387 100644
> --- a/README.MinGW
> +++ b/README.MinGW
> @@ -98,16 +98,22 @@ To build the source distribution under MSYS follow these steps:
> path with a drive letter (except use `/' instead of `\').
> Do not use a path like `/mercury', because that
> will be interpreted differently by the MSYS shell than by the generated
> - executables, resulting in a broken installation.
> + executables, resulting in a broken installation.
>
> - If you are using the MSYS or MSYS2 shell with MinGW-w64 then you must also
> - invoke configure with the following option:
> + If you are using the MSYS shell with MinGW-w64 then you must also invoke
> + configure with the following option:
>
... using the MSYS shell (not the MSYS2 shell) ...
> --host=x86_64-w64-mingw32
>
> This will cause mmake to use the MinGW-w64 tool chain. Ensure that the
> MinGW-w64 tools are in your PATH before running configure.
>
> + If you are using the MSYS2 shell then you need to launch it in either
> + the "MSYS2 MinGW 32-bit" mode or the "MSYS2 MinGW 63-bit mode" to build
Move the first end quote to after "mode".
63-bit
> + a 32- or 64-bit Mercury system respectively. You do *not* need to pass
> + the --host=x86_64-w64-mingw32 option to configure on MSYS2; if you do
> + you will get a 64-bit compiler.
> +
Replace the last sentence with something like:
You do not need to pass the --host option to configure; it will
detect the 32-bit or 64-bit MSYS2 environment you are running in.
?
> diff --git a/configure.ac b/configure.ac
> index 281baef..3e7e10c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3277,12 +3277,22 @@ case "$host" in
> esac
> ;;
>
> - *-w64-mingw*)
> - CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
> - BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
> - THREAD_LIBS="-lpthread"
> - ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
> - ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
> + *-w64-mingw*|x86_64-pc-mingw*)
> + THREAD_LIBS=""
> + case "$mercury_cv_cc_type" in
> + msvc)
> + CFLAGS_FOR_THREADS="-DGC_THREADS -MD"
> + LDFLAGS_FOR_THREADS="-MD"
> + LD_LIBFLAGS_FOR_THREADS="-MD"
> + ;;
> + *)
> + CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
> + BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
> + THREAD_LIBS="-lpthread"
> + ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
> + ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
> + ;;
> + esac
> ;;
>
Ok. I think we can merge this case with the preceding case for
i*86-pc-mingw*, but commit this first.
Peter
More information about the reviews
mailing list