Bootstrapping for Leopard

Simon Marlow simonmarhaskell at gmail.com
Fri Feb 1 04:37:54 EST 2008


Matthias Kilian wrote:
> On Wed, Jan 30, 2008 at 08:13:01PM +1100, Manuel M T Chakravarty wrote:

> [...]
>> This is due to a change of the configure stage that AFAIK was made to  
>> easy building on windows.  Instead, of using shell commands/scripts  
>> (as GHC did previously) to obtain some configuration information (here  
>> the file path at which the top of the GHC build tree is located), the  
>> build system now uses small Haskell programs/scripts.  This makes the  
>> build more portable ** if there is already a Haskell compiler on the  
>> system **.
> 
> But it just doesn't make sense at all. You need a good set of shell
> commands at all, since they're used by configure as well as in
> Makefiles. I really can't believe that simple stuff like this doesn't
> work on windos:
> 
> --- aclocal.m4.orig	Mon Dec 10 19:11:31 2007
> +++ aclocal.m4	Sun Jan 20 17:10:07 2008
> @@ -1098,20 +1098,14 @@ AC_REQUIRE([AC_PROG_CC])
>  AC_DEFUN([FP_FIND_ROOT],[
>  AC_MSG_CHECKING(for path to top of build tree)
>  
> -dnl This would be
> -dnl     make -C utils/pwd clean && make -C utils/pwd
> -dnl except we don't want to have to know what make is called. Sigh.
> -if test ! -f utils/pwd/pwd && test ! -f utils/pwd/pwd.exe; then
> -  cd utils/pwd
> -  rm -f *.o
> -  rm -f *.hi
> -  rm -f pwd
> -  rm -f pwd.exe
> -  $WithGhc -v0 --make pwd -o pwd
> -  cd ../..
> -fi
> -
> -hardtop=`utils/pwd/pwd forwardslash`
> +case $HostPlatform in
> +*cygwin32|*mingw32)
> +	hardtop=`pwd | tr \\ /`
> +	;;
> +*)
> +	hardtop=`pwd`
> +	;;
> +esac
>  
>  if ! test -d "$hardtop"; then
>    AC_MSG_ERROR([cannot determine current directory])

Things are complicated because

   - on Cygwin, pwd gives you /cygdrive/c/...
   - on MSYS, pwd gives you /c/...

(remember we still support MSYS), and we want c:/...

So we used to use cygpath on cygwin, and some horrible sed command on MSYS, 
IIRC.  It was a mess, and frequently went wrong.

Sure there are other ways to do it, but I think at the time it seemed 
simpler to write a Haskell program.  In hindsight, probably a C program 
(compiled using mingw gcc) would be better for bootstrapping.  A shell 
script would be problematic for the reasons above, I'm guessing.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list