[m-dev.] Proposal: Improve specifying Mercury install paths
Keri Harris
keri at gentoo.org
Thu Apr 2 03:53:56 AEDT 2020
On 29/03/2020 01:41, Julien Fischer wrote:
> Hi Keri,
>
> On Sat, 28 Mar 2020, Keri Harris wrote:
>
>
> I've run into a couple of issues with install paths in Mercury:
>
> 1. Mercury installed with --prefix=/usr may not respect any 32 bit vs
> 64 bit library separation on some hosts. For example on RedHat Linux
> or
> Gentoo Linux, 32 bit libraries are installed into /lib, /usr/lib
> while
> 64 bit libraries are installed into /lib64, /usr/lib64.
> There doesn't appear to be any way to install Mercury into the
> following directory structure:
>
> /usr/bin/mmc
> /usr/lib64/mercury/lib/$grade/...
> /ints/...
> /...
>
> I assume that what you are doing there is essentially:
>
> ./configure --prefix=/usr
>
> ?
That's correct
> Allowing that may have been the original intent when the library
> installation directory was designed, however that was well before
> Linux
> distributions started using /usr/lib64 etc.
>
> At this point, I think it may be simpler to achieve something close
> to
> what you want by making it possible to specify alternative
> installation
> directories for the executables ({prefix}/bin) and documentation
> ({prefix}/share) instead. (Autoconf already provides --bindir etc,
> we
> just don't use them.)
>
> In that case I would suggest setting the installation prefix for the
> rest of the system to /usr/lib64/mercury or /usr/lib/mercury and
> living
> with the fact that there will be a few extra layers of subdirectories
> (i.e. lib/mercury) beneath that.
>
> The library files being installed under $prefix/lib/mercury is hard
> coded throughout a good part of the system and changing that would be
> a
> reasonable chunk of work. (For not much benefit IMO.)
>
I've attached a patch that modifies the Mercury scripts to respect --
bindir. Note that any time @bindir@ is occurs both @prefix@ and
@exec_prefix@ need to also be present in the script. e.g:
prefix=@prefix@
exec_prefix=@exec_prefix@
MERCURY_COMPILER=${MERCURY_COMPILER-"@bindir@/mercury_compile"}
Running configure without a --bindir arg will set the following default
values:
$ ./configure
prefix = ...
exec_prefix=${prefix}
MERCURY_COMPILER=${MERCURY_COMPILER-
"${exec_prefix}/bin/mercury_compile"}
Running with a --bindir arg bypasses $prefix and $exec_prefix as we
would expect:
$ ./configure --bindir=/usr/bin
prefix = ...
exec_prefix=${prefix}
MERCURY_COMPILER=${MERCURY_COMPILER-"/usr/bin/mercury_compile"}
Other Mercury install directories already support various autoconf
directories like @docdir@, @infodir etc. While having extra layers of
subdirectories is not a prefect solution, it's probably satisfactory
for most installations.
Changing the meaning of mmc --install-prefix within the mercury
compiler is another possible solution. It also isn't too complicated -
just compiler/file_util.m & compiler/make.program_target.m would need
to change. To date on Gentoo Linux I've been patching those files to
replace the hard coded lib/mercury paths with multilib-aware paths. The
obvious drawback to patching compiler .m files is that you can only do
that after having an instance of mercury_compile already built.
Thanks
Keri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mercury-bindir.patch
Type: text/x-patch
Size: 2882 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20200401/8164b045/attachment.bin>
More information about the developers
mailing list