diff --git a/appveyor.yml b/appveyor.yml index 6cfc4968..7830c5c7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ # AppVeyor config using https://github.com/Chris00/ocaml-appveyor install: - - appveyor DownloadFile "https://raw.githubusercontent.com/Chris00/ocaml-appveyor/master/install_ocaml.cmd" -FileName "C:\install_ocaml.cmd" - - C:\install_ocaml.cmd + - cd "%APPVEYOR_BUILD_FOLDER%" + - install_ocaml.cmd build_script: - cd "%APPVEYOR_BUILD_FOLDER%" diff --git a/install_ocaml.cmd b/install_ocaml.cmd new file mode 100644 index 00000000..372ec8e0 --- /dev/null +++ b/install_ocaml.cmd @@ -0,0 +1,36 @@ +REM Download and install OCaml and flexlink (unless it was already done). +REM Prepare the environment variables,... to use it. OCaml is installed +REM at %OCAMLROOT% +REM +REM If you are using Cygwin, install it in C:\cygwin first and then +REM execute this script. Execute bash with the option "-l". + +REM set OCAMLROOT=%PROGRAMFILES%/OCaml +set OCAMLROOT=C:/PROGRA~1/OCaml + +set OCAMLURL=https://github.com/Chris00/ocaml-appveyor/releases/download/0.1/ocaml-4.03.zip + +REM Cygwin is always installed on AppVeyor. Its path must come +REM before the one of Git but after those of MSCV and OCaml. +set Path=C:\cygwin\bin;%Path% + +call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 + +set Path=%OCAMLROOT%\bin;%OCAMLROOT%\bin\flexdll;%Path% +set CAML_LD_LIBRARY_PATH=%OCAMLROOT%/lib/stublibs + +set CYGWINBASH=C:\cygwin\bin\bash.exe + +if not exist "%OCAMLROOT%/bin/ocaml.exe" ( + echo Downloading OCaml... + appveyor DownloadFile "%OCAMLURL%" -FileName "C:\PROGRA~1\ocaml.zip" + %CYGWINBASH% -lc "cd /cygdrive/c/Program\ Files && unzip -q ocaml.zip" + del C:\PROGRA~1\ocaml.zip +) + +if exist %CYGWINBASH% ( + REM Make sure that "link" is the MSVC one and not the Cynwin one. + %CYGWINBASH% -lc "eval $(/cygdrive/c/Program\ Files/OCaml/tools/msvs-promote-path)"> ~/.bash_profile" +) + +set