[m-rev.] for review: Mercury.config*.in

Julien Fischer jfischer at opturion.com
Tue Jun 24 20:54:38 AEST 2025


On Tue, 24 Jun 2025 at 19:52, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
>
>
> On Tue, 24 Jun 2025 13:24:05 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> > > I would propose that
> > >
> > > - we decide what options should be in Mercury.config, and set up Mercury.config.in
> > >   accordingly,
> > >
> > > - we DELETE Mercury.config.bootstrap.in, and
> > >
> > > - we add a make rule that COPIES Mercury.config to Mercury.bootstrap.config,
> > >   using an action such as "grep -v XYZZY < Mercury.config > Mercury.config.bootstrap",
> > >   with a comment that says "if you add an option to Mercury.config.in that the
> > >   current installed compiler does not understand, replace the XYZZY with the
> > >   name of that option until the installed compiler does understand it".
> > >
> > > There is a minor issue in that we don't want that grep -v to convert a line ending
> > > with a backslash into the last line of the file, but that is trivially solvable.
> > >
> > > Does anyone see any problems with this proposal?
> >
> > I don't see any problems (other than the issue I mentioned above).
>
> Ok. As the first step, here is an updated version of the original diff, which,
> instead of noting the differences between the two files, modifies the bootstrap
> version to eliminate them. (I wasn't sure whether LIBGRADE_OPT was needed
> in the bootstrap version, so I commented it out, did mmake clean, and reconfigured;
> it worked just fine, including a bootstrap test. If anyone knows why this test
> would give a deceptive result, please speak up now.)

The only other test you might want to do is try "mmake install".
(Although to the
best of my knowledge that should be looking at the grade list in Mmake.vars,
not Mercury.config.bootstrap.

> Make Mercury.config.* more readable.
>
> scripts/Mercury.config.in:
> scripts/Mercury.config.bootstrap.in:
>     Use spaces for indentation instead of tabs.
>
>     List all the environment variables in lexicographic order.
>     Sort the big groups.
>
>     Put the options in the definitions of DEFAULT_MCFLAGS into
>     logical groups, indicated by indentation.
>
>     Eliminate the differences between the values of DEFAULT_MCFLAGS
>     in the two config files. Make all the changes required for this
>     to the bootstrap version. The need for these changes seem to be
>     caused by updates to Mercury.config.in that *should* have updated
>     the bootstrap version as well, but did not. (The difference in
>     the lists of copyright years is stark.)
>
> diff --git a/scripts/Mercury.config.bootstrap.in b/scripts/Mercury.config.bootstrap.in
> index f04ab6499..41a8dbe7c 100644
> --- a/scripts/Mercury.config.bootstrap.in
> +++ b/scripts/Mercury.config.bootstrap.in
> @@ -1,11 +1,12 @@
> +# vim: ts=4 sw=4 expandtab ft=sh
>  #
> -# This file has no hash-bang line since it isn't intended to be executable,
> +# This file has no hash-bang line since it isn't intended to be executable;
>  # instead it is 'sourced' by other scripts.

The origin of that comment seems to have been that at one point Mercury.config
had a #!/bin/sh at the start (for some reason). I think saying it is 'sourced'
by other scripts is incomplete; it's also read directly by the compiler itself.

>  # @configure_input@
>  #---------------------------------------------------------------------------#
>  # Copyright (C) 2003-2004, 2006-2007, 2010, 2012 The University of Melbourne.
> -# Copyright (C) 2013, 2015, 2016, 2018 The Mercury team.
> +# Copyright (C) 2013, 2015, 2016, 2018, 2025 The Mercury team.
>  # This file may only be copied under the terms of the GNU General
>  # Public License - see the file COPYING in the Mercury distribution.
>  #---------------------------------------------------------------------------#
> @@ -14,14 +15,19 @@
>  #
>  # Configuration file for the Melbourne Mercury Compiler.
>  #
> -# This file is used instead of Mercury.config when building the
> -# stage1 compiler. It should only refer to options which are
> -# understood by the installed compilers.
> +# We use this file instead of Mercury.config when building stage 1.
> +# It should refer only to options which are understood by the
> +# installed compiler.
>  #
> -# Environment variables: MERCURY_STDLIB_DIR, MERCURY_C_COMPILER,
> -# MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL,
> -# MERCURY_JAVA_COMPILER, MERCURY_JAVA_INTERPRETER,
> -# MERCURY_CSHARP_COMPILER.
> +# Environment variables:
> +#
> +#   MERCURY_CSHARP_COMPILER
> +#   MERCURY_C_COMPILER
> +#   MERCURY_DEFAULT_GRADE
> +#   MERCURY_DEFAULT_OPT_LEVEL
> +#   MERCURY_JAVA_COMPILER
> +#   MERCURY_JAVA_INTERPRETER
> +#   MERCURY_STDLIB_DIR
>
>  # These settings won't override settings in the environment.
>  MERCURY_STDLIB_DIR=@LIBDIR@
> @@ -43,15 +49,22 @@ MATH_LIB=$(MERCURY_MATH_LIB)
>  # This needed for Java classpath.
>  INSTALL_JAVA_LIBRARY_DIR=$(MERCURY_STDLIB_DIR)/lib/java

INSTALL_JAVA_LIBRARY_DIR can be deleted; you've deleted its only uses
below.  Ditto for Mercury.config.in.

...

That looks fine otherwise.

Julien.


More information about the reviews mailing list