diff options
| author | David Allsopp <david.allsopp@metastack.com> | 2017-09-30 12:45:35 +0100 |
|---|---|---|
| committer | David Allsopp <david.allsopp@metastack.com> | 2017-10-01 12:20:11 +0100 |
| commit | 8c613ec4cf849ea153993b09d75ac60faa1132ae (patch) | |
| tree | 529b74ccb888ce9d1a13848225326f1b6454fad1 | |
| parent | 9d6781317890e8ba4ab09497583f8507ea6caa1a (diff) | |
| download | ocaml-8c613ec4cf849ea153993b09d75ac60faa1132ae.tar.gz | |
On AppVeyor, only run Cygwin setup if needed
| -rw-r--r-- | appveyor_build.cmd | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/appveyor_build.cmd b/appveyor_build.cmd index b579cc2d2e..f11bd9dc3e 100644 --- a/appveyor_build.cmd +++ b/appveyor_build.cmd @@ -36,6 +36,25 @@ set LIB=%OCAML_PREV_LIB% set INCLUDE=%OCAML_PREV_INCLUDE% goto :EOF +:CheckPackage +"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc %1" | findstr %1 > nul +if %ERRORLEVEL% equ 1 ( + echo Cygwin package %1 will be installed + set CYGWIN_INSTALL_PACKAGES=%CYGWIN_INSTALL_PACKAGES%,%1 +) +goto :EOF + +:UpgradeCygwin +if "%CYGWIN_INSTALL_PACKAGES%" neq "" "%CYG_ROOT%\setup-x86_64.exe" --quiet-mode --no-shortcuts --no-startmenu --no-desktop --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages %CYGWIN_INSTALL_PACKAGES:~1% > nul +for %%P in (%CYGWIN_COMMANDS%) do "%CYG_ROOT%\bin\%%P.exe" --version > nul || set CYGWIN_UPGRADE_REQUIRED=1 +"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc %CYGWIN_PACKAGES%" +if %CYGWIN_UPGRADE_REQUIRED% equ 1 ( + echo Cygwin package upgrade required - please go and drink coffee + "%CYG_ROOT%\setup-x86_64.exe" --quiet-mode --no-shortcuts --no-startmenu --no-desktop --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --upgrade-also > nul + "%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc %CYGWIN_PACKAGES%" +) +goto :EOF + :install rem Temporarily initialise the submodule in the main (msvc64) build git submodule update --init flexdll @@ -59,9 +78,21 @@ cd "%APPVEYOR_BUILD_FOLDER%\..\flexdll" && unzip -q flexdll.zip rem Make sure the Cygwin path comes before the Git one (otherwise cygpath rem gets confused as to which root it's in). set Path=C:\cygwin64\bin;%OCAMLROOT%\bin\flexdll;%Path% -"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc cygwin" -"%CYG_ROOT%\setup-x86_64.exe" -qgnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P diffutils -P make -P mingw64-i686-gcc-core >NUL || exit /b 1 -"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc cygwin" + +rem CYGWIN_PACKAGES is the list of required Cygwin packages (cygwin is included +rem in the list just so that the Cygwin version is always displayed on the log). +rem CYGWIN_COMMANDS is a corresponding command to run with --version to test +rem whether the package works. This is used to verify whether the installation +rem needs upgrading. +set CYGWIN_PACKAGES=cygwin make diffutils mingw64-i686-gcc-core +set CYGWIN_COMMANDS=cygcheck make diff i686-w64-mingw32-gcc + +set CYGWIN_INSTALL_PACKAGES= +set CYGWIN_UPGRADE_REQUIRED=0 + +for %%P in (%CYGWIN_PACKAGES%) do call :CheckPackage %%P +call :UpgradeCygwin + "%CYG_ROOT%\bin\bash.exe" -lec "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh install" || exit /b 1 call :SaveVars |
