
On Fri, 2005-08-26 at 18:36 -0700, Frederik Eaton wrote:
On Fri, Aug 26, 2005 at 09:37:20AM +0300, Krasimir Angelov wrote:
It isn't so easy to simulate #! behaviour in rawSystem because the file path after #! is in Unix style. Cygwin keeps the mapping between Unix style paths and the native Windows paths. Usually /usr/bin/sh is mapped to something like c:\cygwin\bin\sh.exe. All executables which are compiled with cygwin.dll runtime library are working with Unix paths which are silently mapped to native paths. All GHC compiled executables are linked to the native msvcrt.dll runtime library so they understands only the native paths. I don't think that rawSystem should try to emulate Unix behaviour.
Then maybe Cabal needs to be linked to cygwin.dll? I don't know anything about Cygwin, or MinGW, or what the difference is between the two, but if a program written in Haskell running *within* Cygwin can't execute a #! script using rawSystem then something is wrong.
GHC on windows is now a native application and it compiles native windows applications. That is it doesn't link with any unix emulation libraries. For the vast majority of windows users this is a good thing. (GHC has become vastly more popular amongst windows users since it stopped depending on cygwin.) I think we just have to accept that windows doesn't understand the #! thing. If fact cabal packages that use configure scripts are not going to be portable to windows anyway since we cannot assume that users have MinGW/cygwin installed. That is one of the reasons to favour the simple cabal build system, because it will work on windows without any unix utiities like sh & make etc. Duncan