[m-rev.] diff: make it possible run an installed compiler built in the C# grade
Julien Fischer
jfischer at opturion.com
Fri Dec 18 00:03:42 AEDT 2015
Make it possible to run an installed compiler built in the C# grade.
scripts/mercury_compile.sh-csharp:
Add a script script that runs an installed compiler built in the C#
grade using Mono. As with compilers built in the Java grade, the
wrapper script we generate in the compiler directory only works
in situ and we require a separate script for the installed version.
XXX TODO: we will need to handle .NET differently, probably by simply
renaming top_level.exe -> mercury_compile.exe.
scripts/Mmakefile:
Install the new script if the compiler was built in the C# grade.
Julien.
diff --git a/scripts/Mmakefile b/scripts/Mmakefile
index fa60cf9..fec7841 100644
--- a/scripts/Mmakefile
+++ b/scripts/Mmakefile
@@ -62,6 +62,9 @@ JAVA_WRAPPER_SCRIPTS = \
mercury_compile \
mfilterjavac
+CSHARP_WRAPPER_SCRIPTS = \
+ mercury_compile
+
#-----------------------------------------------------------------------------#
# .SUFFIXES: .in
@@ -130,7 +133,7 @@ install_mmake: Mmake.vars Mmake.rules install_dirs
.PHONY: install_scripts
install_scripts: $(SCRIPTS) install_dirs
- # we move the installed `mmake' script before (re)installing it
+ # We move the installed `mmake' script before (re)installing it
# to avoid overwriting the script while it is running
# (just removing it doesn't work very well on win32, which will
# deny you permission to write the file while mmake is running).
@@ -146,6 +149,11 @@ ifeq ($(findstring java,$(GRADE)),java)
cp $$file.sh-java $(INSTALL_MERC_BIN_DIR)/$$file ;\
done
endif
+ifeq ($(findstring csharp,$(GRADE)),csharp)
+ for file in $(CSHARP_WRAPPER_SCRIPTS); do \
+ cp $$file.sh-csharp $(INSTALL_MERC_BIN_DIR)/$$file ;\
+ done
+endif
.PHONY: install_config
install_config: Mercury.config install_dirs
diff --git a/scripts/mercury_compile.sh-csharp b/scripts/mercury_compile.sh-csharp
new file mode 100755
index 0000000..0251c46
--- /dev/null
+++ b/scripts/mercury_compile.sh-csharp
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# This script invokes the _installed_ version of the Mercury compiler when it
+# is built in the C# grade and run using Mono.
+
+DIR=${0%/*}
+DIR=$( cd "${DIR}" && pwd -P )
+case $WINDIR in
+ '') SEP=':' ;;
+ *) SEP=';' ;;
+esac
+MONO_PATH="$DIR/../lib/mercury/lib/csharp"${SEP}$MONO_PATH
+export MONO_PATH
+CLI_INTERPRETER=${CLI_INTERPRETER:-/opt/local/bin/mono}
+exec "$CLI_INTERPRETER" "$DIR/top_level.exe" "$@"
More information about the reviews
mailing list