caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matthieu Dubuget <matthieu.dubuget@gmail.com>
To: Caml Mailing List <caml-list@yquem.inria.fr>
Cc: David Allsopp <dra-news@metastack.com>
Subject: Re: [Caml-list] Trying to setup mingw OCaml 3.12.1 + fresh cygwin
Date: Wed, 10 Aug 2011 11:42:07 +0200	[thread overview]
Message-ID: <4E42526F.8000200@gmail.com> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9C23E6979@Remus.metastack.local>


Date: 10/08/2011 10:25
From: David Allsopp <dra-news@metastack.com> wrote:
> Good to know that 64-bit MinGW is working - that said, I thought the MinGW port was broken in 3.12.1 or is that not affected with the 64-bit compiler? Could you share details on how you configured OCaml?

This is not 64 bits. i686-w64-mingw32 is 32 bits. But for this, I 
adapted some patches borrowed from bug #5179, that may interest you.

Here is the way I follow in order to install everything.
(I have scripts for this, but they are not generic…)

First, install cygwin, with something like this:

> @echo off
>
> rem "miniInstallPack/" is supposed to be on the user's desktop
>
> rem If you put "depot_cygwin/" in "miniInstallPack/" from a previous
> rem cygwin install, it will be used to save some bandwidth
> IF NOT EXIST depot_cygwin GOTO :NOCYGWINDEPOTDIR
>
> rem But only if you don't already have a c:\depot_cygwin
> IF EXIST c:\depot_cygwin GOTO :NOCYGWINDEPOTDIR
> XCOPY /E /Q /Y depot_cygwin c:\depot_cygwin\
> :NOCYGWINDEPOTDIR
>
> setup.exe -s ftp://mirror.switch.ch/mirror/cygwin -R c:\cygwin -q -l 
> c:\depot_cygwin -n -C Base -P 
> wget,unzip,binutils,diffutils,file,gdbm,make,ncurses,patchutils,m4,time,patch,autoconf,automake,mingw64-i686-gcc-core,vim
> c:
> chdir c:\cygwin\bin
>
> rem création du home
> bash --login -i -c "exit"
>
> bash --login -c "echo 'export TMP=/tmp' >> .bashrc"
> bash --login -c "echo 'export TEMP=/tmp' >> .bashrc"
> bash --login -c "cp -a `cygpath -d -D -m`/miniInstallPack ."
> rem the following script is to use kitty
> bash --login -c "cd miniInstallPack && bash 12_kittycyg.sh"
> bash --login -c "[ ! -e 'miniInstallPack/download' ] && mkdir 
> miniInstallPack/download"
> bash --login -c "[ ! -e 'miniInstallPack/extracted' ] && mkdir 
> miniInstallPack/extracted"
>
> echo
> echo Now, you'll have to log-in
> echo cd miniInstallPack
> echo and run 00_install_suite.sh
> echo

00_install_suite.sh is something like that:

> #!/bin/bash
> . installation_configuration.sh
>
> rm -rf `cygpath -d -D -m`/miniInstallPack
> rm -rf depot_cygwin
>
> . ./02_flexlink.sh
> . ./03_tcl.sh
> . ./04_ocaml.sh
> . ./05_findlib.sh
> . ./06_menhir.sh
> . ./11_emacs.sh
> . ./20_caml_mode.sh
> . ./19_tuareg.sh
> . ./15_bitstring_improved.sh
> . ./14_ounit.sh
> . ./21_ocamlcsv.sh
> . ./25_frontc.sh
> . ./22_magit.sh
> . ./23_xmllight.sh
> . ./08_camomile.sh
> . ./09_batteries.sh
> . ./24_zlib.sh
> . ./24_camlzip.sh
> ...

where installation_configuration.sh contains some functions and variables:

> #!/bin/bash
>
> here=`pwd`
> prefix=/home/matt
> appsprefix=${prefix}/apps
> prefixwin=C:/cygwin${prefix}
> appsprefixwin=${prefixwin}/apps
> downloaddir=${here}/download
> extractdir=${here}/extracted
> ocaml=ocaml-3.12.1
>
> emacs=emacs-23.3
> emacsarchive=${emacs}-bin-i386.zip
> emacsdownload=http://ftp.gnu.org/pub/gnu/emacs/windows/${emacsarchive}
> emacsdestdir=${appsprefix}/emacs
>
> ocamldir=ocamlmgw
> ocamldirwin=${prefixwin}/${ocamldir}
> ocamllib=${prefix}/${ocamldir}/lib
> bindir=${prefix}/${ocamldir}/bin
> tkroot=c:/tcl
> gtkdestdir=${appsprefix}/GTK
>
> # download_file file url
> download_file (){
> if [[ -e ${downloaddir}/$1 ]]
> then
> echo "'$1' already there."
> else
> echo "'$1' is not there: downloading..."
> echo
> wget --no-check-certificate -O ${downloaddir}/$1 $2
> echo
>
> if [[ -e ${downloaddir}/$1 ]]
> then
> echo "DOWNLOAD FINISHED -> OK"
> else
> echo "FAILED. exiting"
> exit 1
> fi
> fi
> }
> # extract_archive archiv dest dir
> extract_archive (){
> if [[ -e $2/$3 && -d $2/$3 ]]
> then
> echo "'$3' already extracted"
> else
> echo "Extracting '$3'..."
> tar -xaC $2 -f $1
> fi
> }
>
> # extract_archive_zip archive destdir
> extract_archive_zip (){
> if [[ -e "$2" && -d "$2" ]]
> then
> echo "'$2' already extracted"
> else
> echo "Extracting '$2'..."
> unzip -d "$2" "$1"
> fi
> }
>
> # extract_archive_zip_overwrite archive destdir
> extract_archive_zip_overwrite (){
> unzip -q -o -d "$2" "$1"
> }
>
> affiche_install (){
> echo
> echo -----------------------
> echo $1
> echo -----------------------
> echo
> }
>
> prepend_path (){
> export PATH="$1:$PATH"
> }
>
> append_path (){
> export PATH="$PATH:$1"
> }

Flexlink is a patched version (see bug #5179)

03_tcl.sh:
> #!/bin/bash
> affiche_install "TCL (Activetcl8.5.9.2.294317-win32-ix86-threaded)"
> activetcl=ActiveTcl8.5.9.2.294317-win32-ix86-threaded.exe
> activetcldownload=http://downloads.activestate.com/ActiveTcl/releases/8.5.9.2/${activetcl}
>
> download_file ${activetcl} ${activetcldownload}
> chmod +x ${downloaddir}/${activetcl}
> ${downloaddir}/${activetcl} --directory ${tkroot}

04_ocaml.sh:
> #!/bin/bash
> cd ${here}
> affiche_install "OCaml"
> ocamlarchive=${ocaml}.tar.bz2
> ocamldownload=http://caml.inria.fr/pub/distrib/ocaml-3.12/${ocamlarchive}
>
> # download
> download_file ${ocamlarchive} ${ocamldownload}
>
> #Extract
> extract_archive ${downloaddir}/${ocamlarchive} ${extractdir} ${ocaml}
>
> #Patch (for cygwin mingw cross compilation use)
> cd ${extractdir}/${ocaml} && patch -p1 -i ../../ocaml-i686-mingw64-patch
>
> #Configure
> cp ${extractdir}/${ocaml}/config/s-nt.h ${extractdir}/${ocaml}/config/s.h
> cp ${extractdir}/${ocaml}/config/m-nt.h ${extractdir}/${ocaml}/config/m.h
> cp ${extractdir}/${ocaml}/config/Makefile.mingw 
> ${extractdir}/${ocaml}/config/Makefile
>
> #We want to install in a different place
> cmd1="s|PREFIX=C:/ocamlmgw|PREFIX=$ocamldirwin|"
> sed -i.bak -e "$cmd1" ${extractdir}/${ocaml}/config/Makefile
>
> cd ${extractdir}/${ocaml} && \
> make -f Makefile.nt world && \
> make -f Makefile.nt opt && \
> make -f Makefile.nt opt.opt && \
> make -f Makefile.nt install
>
> echo "export PATH=\$PATH:${bindir}" >> ${HOME}/.bashrc
> append_path "${bindir}"
> cd ${here}

05_findlib.sh
> #!/bin/bash
> cd ${here}
> affiche_install "Findlib"
>
> findlib=findlib-1.2.7
> findlibarchive=${findlib}.tar.gz
> findlibdownload=http://download.camlcity.org/download/${findlibarchive}
>
> download_file ${findlibarchive} ${findlibdownload}
> extract_archive ${downloaddir}/${findlibarchive} ${extractdir} ${findlib}
>
> #If configure is not patched, a trailing \r\n remains in camlp4's META
> #file, which breaks it's use with ocamlfind
> cd ${extractdir}/${findlib} && \
> sed -i -e "s/camlp4 -where/camlp4 -where | tr -d '\\\\015'/" configure 
> && \
> ./configure -cygpath && \
> make all && make opt && make install
> cd ${here}


...

If somebody wants them, I can share those recipes.

Salutations

Matt



  reply	other threads:[~2011-08-10  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08 14:35 Matthieu Dubuget
2011-08-08 19:25 ` Adrien
2011-08-10  8:25 ` David Allsopp
2011-08-10  9:42   ` Matthieu Dubuget [this message]
2011-08-10 10:55     ` Adrien
2011-08-12 11:55       ` David Allsopp
2011-08-12 12:00     ` David Allsopp
2011-08-12 13:07       ` Adrien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E42526F.8000200@gmail.com \
    --to=matthieu.dubuget@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=dra-news@metastack.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).