[m-dev.] Proposal: Improve specifying Mercury install paths
Keri Harris
keri at gentoo.org
Sat Mar 28 22:26:58 AEDT 2020
Hi,
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/...
/...
2. Running "mmc libmyproject.install" always adds lib/mercury into the
install path, even if --install-prefix is specified. This prevents some
custom install paths from being used. e.g. it's not possible to install
Mercury 'extras' projects into the following directory structure:
/usr/lib/mercury/extras/lib/$grade/...
/ints/...
/...
I was wondering if it would make sense to extend both the Mercury
install scripts and the Mercury compiler to support some type of
"mercury-prefix" setting. Configuring Mercury with --mercury-
prefix=$dir would set INSTALL_LIBDIR=$dir. mmc would look up a global
mercury-prefix setting:
- if --mercury-prefix=$dir is specified then install libraries into
$dir/lib/$grade
- else if --install-prefix=$dir is specified then install libraries
into $dir/lib/mercury/lib/$grade
- else use default "mercury-prefix" setting and install into
$mercury_prefix/lib/$grade
Admittedly, --mercury-prefix would make --install-prefix somewhat
redundant but keeping it at least maintains backwards compatibility,
and I'm not sure what appetite there would be for changing/removing
such a setting.
Examples of using such a "mercury-prefix" parameter follow:
Installing Mercury
------------------
* no prefix specified (current install behaviour is maintained)
=> infer prefix=/usr/local/mercury-x.y
=> infer mercury-prefix=$prefix/lib/mercury
/usr/local/mercury-x.y/bin/mmc
/usr/local/mercury-x.y/lib/mercury/lib/$grade/...
/ints/...
/...
* prefix=/usr (current install behaviour is maintained)
=> infer mercury-prefix=$prefix/lib/mercury
/usr/bin/mmc
/usr/lib/mercury/lib/$grade/...
/ints/...
/...
* prefix=/usr, mercury-prefix=/usr/lib64/mercury
/usr/bin/mmc
/usr/lib64/mercury/lib/$grade/...
/ints/...
/...
* prefix=/opt/mercury, mercury-prefix=/opt/mercury
/opt/mercury/bin/mmc
/opt/mercury/lib/$grade/...
/ints/...
/...
Installing libraries (assuming Mercury installed with prefix=/usr)
--------------------
* mmc libmyproject.install
/usr/lib/mercury/lib/$grade/libmyproject.so
/ints/...
/...
* mmc --mercury-prefix=/usr/lib64/myproject libmyproject.install
/usr/lib64/myproject/lib/$grade/libmyproject.so
/ints/...
/...
* mmc --mercury-prefix=/opt/myproject libmyproject.install
/opt/myproject/lib/$grade/libmyproject.so
/ints/...
/...
I can look at putting together a patch for this if it is something that
would benefit Mercury.
Thanks
Keri
More information about the developers
mailing list