[m-rev.] for post-commit review: pay attention to MERCURY_STDLIB_DIR
Julien Fischer
jfischer at opturion.com
Sat Nov 30 02:57:20 AEDT 2024
On Tue, 26 Nov 2024 at 11:46, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> Pay attention to MERCURY_STDLIB_DIR ...
>
> ... when checking whether the standard Mercury library is installed in
> the current grade.
...
> diff --git a/compiler/check_libgrades.m b/compiler/check_libgrades.m
> index 3ff41435a..a6b975004 100644
> --- a/compiler/check_libgrades.m
> +++ b/compiler/check_libgrades.m
> @@ -40,9 +40,26 @@
> % of the Mercury standard library, in which grades is the Mercury standard
> % library installed there?
> %
> -% The location may be specified by either the value of the
> -% mercury_standard_library_directory option, or by the value of the
> -% MERCURY_STDLIB_DIR environment variable.
> +% The location of the Mercury standard library may be specified by
> +%
> +% - the value of the mercury_standard_library_directory option,
> +% - the value of the MERCURY_STDLIB_DIR make variable in an options file, or
> +% - the value of the MERCURY_STDLIB_DIR environment variable.
> +%
> +% The above is the priority order of the sources. The second and third are
> +% both handled by options_file.m.
> +%
> +% Note that mmc does not actually need to know anything about installed
> +% grades;
That statement is confusing. In some cases, mmc _does_ need to know the set of
installed grades is (mmc --make's install target wouldn't work otherwise). What
mmc does not require is the set of installed library grades to be hardcoded
into its configuration information (i.e. Mercury.config).
There are two case:
1. We are using mmc --make (or mmc to compile a single module program).
In that case, mmc uses the code in this module to probe the installation
directory and dynamically determine the set of installed grades.
2. We are using mmake. In this case, mmc does not care what the set of
installed grades is because it (and other tools like mgnuc and ml) will
be told what grade(s) to use by mmake. mmake itself does have the
set of installed libgrades hardcoded into its configuration info. (i.e.
Mmake.vars).
> that info is needed only by the tools (e.g. ml) that process
> +% the *output* of mmc.
The ml script does not know about the set of installed grades, it only operates
on one grade at a time and is told what grade to operates on by mmake.
> The only parts of the system that now has hardcoded
> +% in it the list of installed stdlib grades are Mercury.config and the
> +% Mmake.vars file, which is automatically included in the makefiles
> +% constructed by mmake. Those hardcoded lists are set by the configure script,
> +% and are static data afterward, until the next invocation of configure.
The list of installed stdlib grades is *not* hardcoded into Mercury.config.
(The entire point of commit ab20c86 was to remove such hardcoding.)
The set of stdlib grades is currently only hardcoded into Mmake.vars.
> +% Since commit ab20c86, the Mercury compiler uses these predicates
> +% to get this information dynamically. This allows additional library
> +% grades to be installed without reconfiguration.
The diff looks fine otherwise.
Julien.
More information about the reviews
mailing list