Version française
Home     About     Download     Resources     Contact us    
Browse thread
MinGW port w/o Cygwin?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Márk_S._Zoltán <zoltan.s.mark@d...>
Subject: Re: Re: [Caml-list] Re: MinGW port w/o Cygwin?
Dmitry Bely wrote:
> On Dec 20, 2007 11:18 PM, Kuba Ober <ober.14@osu.edu> wrote:
>
>   
>> Tried it and sure enough - it works!!! (On an XP machine that never saw Cygwin
>> either).
>>
>> That's *extremely* good news to me.
>>
>> I guess that Ocaml maintainers should just drop that Cygwin requirement, and
>> tweak their build process to work "out of the box" with MSYS/MinGW.
>>     
>
> If MSYS become mandatory I strongly disagree. Cygwin is a common
> requirement for building any Ocaml distribution on Windows (even if
> you use Microsoft Visual Studio). I see absolutely no problem to
> install and use it. Why I should bother to install another Cygwin fork
> (MSYS) and handle name clashes etc.?
>
> - Dmitry Bely
>
>   

I am using my clandestine MSys + MinGW OCaml since about 3.0, and I have 
originally switched to MSys because the configuration scripts of a 
number of other apps and libraries did not handle the -mno-cygwin flag, 
or any other flag for that matter: the 'supply extra compiler flags' 
feature seemed to be thoroughly broken in all configure scripts, I 
wonder if anyone ever uses it. When it comes to building apps from 
tarballs, the best bet is to use Cygwin alone, if you can abide by 
having to carry cygwin1.dll around - I cannot. Next best is MSys, and 
the worst is Cygwin with -mno-cygwin, supported by very few apps. On the 
positive side, I have kept MSys and Cygwin side-by-side for years and 
never had any name clashes. If you want two variants of the same app, 
e.g. a Cygwin ocaml (for debugging, which does not work in the MinGW 
variant) and an MSys + MinGW ocaml (for release builds without a need 
for cygwin1.dll), AND you want the same home directory for both systems, 
THEN you need to make sure your .profile or .bashrc 'sed-its' the path 
to point to the correct app depending on the system being fired up; I 
did it and never ran into name clashes or anything similar.

I don't think the MinGW-over-Cygwin variant must actually be dropped, 
since a pure MSys + MinGW version would be relatively easy to maintain 
alongside it. As an illustration, pretty much all I ever needed to do is 
comment out a code snippet in ccomp.ml (to prevent a responsefile from 
being even used, see below) and then build ocaml on MSys according to 
the same procedure one would use for MinGW over Cygwin. With v3.10 this 
works like a charm (some much earlier versions required extra setup 
because the camlp4 Win32 build used to be slightly aberrant).

====================================

MSys howto:  edit utils\ccomp.ml by commenting-out the following code:

let quote_files lst =
  let s =
    String.concat " "
      (List.map (fun f -> if f = "" then f else Filename.quote f) lst) in
  (*if Sys.os_type = "Win32" && String.length s >= 256
  then build_diversion lst
  else*) s

Copy config\Makefile.mingw to config\Makefile and edit it to set your 
preferences (e.g. I always disable shared libs - maybe they wouldn't 
work with this method at all, I don't know). Copy config\m-nt.h to 
config\m.h and config\s-nt.h to config\s.h. I also usually copy the main 
Makefile.nt onto Makefile, such that I don't have to remember to type -f 
Makefile.nt on the make command line. Works without a hitch.