mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-08 02:11:55 +00:00
Make it possible to run the installed Java version of the compiler by
installing versions of the wrapper scripts for 'mercury_compile' and
'mfilterjavac' that have the CLASSPATH set to point to the installed versions
of the standard library Java archives.
The wrapper script generated in the compiler directory is not suitable for this
because as generated it sets the CLASSPATH relative to the compiler directory,
not the installation directory. Modifying that file is not a good idea since
that will mean that then the compiler cannot be executed in situ. Instead we
provide a handwritten version of the wrapper script in the scripts directory
that is installed in place of the generated one. Ditto for mfilterjavac.
While this does create a small maintenance problem, I think that any other
approach, for example, modifying the generation of wrapper scripts to account
for this, is going to be a larger maintenance problem.
TODO:
- handle batch file launchers for Windows.
- handle other executables in the Mercury system (although most of these
are not so important in this context).
compiler/Mmakefile:
mfilterjavac/Mmakefile:
Do not install generated wrapper scripts from these directories in the Java
grade.
scripts/mercury_compile.sh-java:
scripts/mfilterjavac.sh-java:
Java wrappers scripts for the installed versions of the compiler
and mfilterjavac.
scripts/Mmakefile:
In the Java grade install the wrapper scripts for the compiler and
mfilterjavac from this directory.
17 lines
487 B
Bash
Executable File
17 lines
487 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# This script invokes the _installed_ version of the mfilterjavac when it
|
|
# is built in the Java grade.
|
|
|
|
DIR=${0%/*}
|
|
DIR=$( cd "${DIR}" && pwd -P )
|
|
case $WINDIR in
|
|
'') SEP=':' ;;
|
|
*) SEP=';' ;;
|
|
esac
|
|
JARDIR="$DIR/../lib/mercury/lib/java"
|
|
CLASSPATH="$DIR/mfilterjavac.jar"${SEP}$CLASSPATH${SEP}$JARDIR/mer_rt.jar${SEP}$JARDIR/mer_std.jar${SEP}$JARDIR/mer_browser.jar${SEP}$JARDIR/mer_mdbcomp.jar
|
|
export CLASSPATH
|
|
JAVA=${JAVA:-java}
|
|
exec "$JAVA" jmercury.mfilterjavac "$@"
|