Friday, October 15, 2010

Mercury configure and make: Cygwin tips

I have recently been trying to imagine why a language as smart as Mercury which is itself used to generte the smart Mercury compiler is built using a configure script and then make and a Makefile.

One of the most non-declarative aspects of building Mercury is the lack of examples in configure.help as an aid to building, say, a minimal Mercury library with both a Java and Erlang backend but no profilers etc.  There is a flag for --disable-most-grades and a flag for --enable-Java-grade but if one were to use both in that order?

So my first Mercury tool should be a translator for the Makefile and a wrapper for make to display what we will build given a run of the configure script.

Cygwin must know: that there is no INSTALL env var in your Windows env and that your Cygwin bash has run zsh at least once so as to create a .zshrc file.  These two little points could save you hours in Win32 world.

Do first run
sh configure --help
as I have been advised that "everyone" knows to do this first.

You may find a Win binary at winmercury over at code.google.com

With Cygwin 1.7 you will still need symbolic links to suitable java, javac and jar executables as well as a path to Erlang erl and erlc if you wish to compile to either.

The install depends on the executable install.exe in Cygwin /bin so if your Windows env holds an INSTALL var, edit and rename it.  Do not rely on exporting it as an empty string in your Cygwin bat or in your .profile - but do create a java.sh in /profile.d as to use your preferred JAVA_HOME.

And good luck.  But why would you need that - luck - when compiling C towards a self-compiling compiler for a logic programming language in 2010? Oh - and about 2 Gb filespace for cp and a few hours on a spare CPU core.  Better rsults may be had on Windows 7 and with parallel make for multicore CPU.

Neat things in Mercury - the .m pages at Ralph Becket's site at cs.mu.oz.au

At this date (10/2010) the make clean fails to delete essential transient Makefile instances beneath ./boehm_gc making it essential (?) to do so if you are intending to re-run ./configure to prep a re-make.  It is also essential (?) to delete the transient config.h file which a previous configure pass will have placed in the ./src subdirectory of the gc hierarchy:
 .\mercury-compiler-10.04.2\boehm_gc\libatomic_ops\src
and down to the deepest Makefile left behind in
 .\mercury-10.04.2\mercury-compiler-10.04.2\boehm_gc\libatomic_ops\src\atomic_ops\sysdeps
I understand per the maillist that this is already a fix committed for future release (or in a daily snapshot.)

No comments:

Post a Comment