diff --git a/Makefile b/Makefile index 9487b637843..41f21789af8 100644 --- a/Makefile +++ b/Makefile @@ -175,3 +175,7 @@ cold: compiler cold-%: env PATH="`pwd`/bootstrap/ocaml/bin:$$PATH" $(MAKE) $* + +.PHONY: run-appveyor-test +run-appveyor-test: + env PATH="`pwd`/bootstrap/ocaml/bin:$$PATH" ./appveyor_test.sh diff --git a/appveyor.patch b/appveyor.patch new file mode 100644 index 00000000000..6d459f85e21 --- /dev/null +++ b/appveyor.patch @@ -0,0 +1,49 @@ +From 083bae674ad77b6b5b5fafbff25b20473655cb2a Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Wed, 27 Dec 2017 10:37:12 +0200 +Subject: [PATCH] Use dra27 jbuilder/ocaml-mccs/flexdll + + - Need unreleased ocaml-mccs 1.1+5 to build mccs on Windows. + - Need unreleased jbuilder beta17 to build mccs on MSVC. + - Need unreleased flexdll 0.38 to build mccs on mingw. +--- + src_ext/Makefile | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src_ext/Makefile b/src_ext/Makefile +index 64fdd8af..d1457b5f 100644 +--- a/src_ext/Makefile ++++ b/src_ext/Makefile +@@ -28,8 +28,8 @@ MD5_cudf = a4c0e652e56e74c7b388a43f9258d119 + URL_dose3 = https://gforge.inria.fr/frs/download.php/file/36063/dose3-5.0.1.tar.gz + MD5_dose3 = e7d4b1840383c6732f29a47c08ba5650 + +-URL_mccs = https://github.com/AltGr/ocaml-mccs/archive/1.1+4.tar.gz +-MD5_mccs = 1ff2d73ab5c69e1fb58160213fc2d4c9 ++URL_mccs = https://github.com/dra27/ocaml-mccs/archive/1.1+4-dra27.tar.gz ++MD5_mccs = 08e80e39a0d960c01955a970d13afb29 + + URL_opam-file-format = https://github.com/ocaml/opam-file-format/archive/2.0.0-beta5.tar.gz + MD5_opam-file-format = 5408798ca3af6e36379dd34b1b618b9c +@@ -37,14 +37,14 @@ MD5_opam-file-format = 5408798ca3af6e36379dd34b1b618b9c + URL_result = https://github.com/janestreet/result/archive/1.2.tar.gz + MD5_result = 3d5b66c5526918f0f2ca9d6811ef09c8 + +-URL_jbuilder = https://github.com/janestreet/jbuilder/archive/08050696fb701dafcd1372aadfaa800a50bc01ca.tar.gz +-MD5_jbuilder = 53b65232ebb5fd319acf90922342615d ++URL_jbuilder = https://github.com/dra27/jbuilder/archive/fix-copy.tar.gz ++MD5_jbuilder = cbf9d2e783feab1f4a61fea35ec96118 + + URL_ocaml = http://caml.inria.fr/pub/distrib/ocaml-4.04/ocaml-4.04.2.tar.gz + MD5_ocaml = 041b8d1a61abc94981a60b6c011e791e + +-URL_flexdll = http://alain.frisch.fr/flexdll/flexdll-0.35.tar.gz +-MD5_flexdll = e4449eacf020675e763c21551e841642 ++URL_flexdll = https://github.com/dra27/flexdll/archive/linking-c++.tar.gz ++MD5_flexdll = 75bd0efc328ad9f8f2e01414464d217b + + ifndef FETCH + ifneq ($(shell command -v curl 2>/dev/null),) +-- +2.12.0.windows.1 + diff --git a/appveyor.yml b/appveyor.yml index 17333451a21..80109a5eca5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,25 +1,37 @@ platform: - - x86 + - x64 + +image: Visual Studio 2017 environment: global: - CYG_ROOT: C:/cygwin + CYG_ROOT: cygwin64 + CYG_ARCH: x86_64 + OCAML_PORT: CYG_CACHE: C:/cygwin/var/cache/setup CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/ matrix: - - + - CYG_ROOT: cygwin CYG_ARCH: x86 + - CYG_ROOT: cygwin64 + CYG_ARCH: x86_64 + - OCAML_PORT: msvc + - OCAML_PORT: msvc64 + - OCAML_PORT: mingw + - OCAML_PORT: mingw64 + +cache: + - C:\projects\opam\bootstrap + - C:\projects\opam\src_ext\archives init: - - 'echo System architecture: %PLATFORM%' + - "echo System architecture: %PLATFORM%" install: - - 'appveyor DownloadFile http://cygwin.com/setup-%CYG_ARCH%.exe -FileName setup.exe' - - 'setup.exe -gqnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P make,git,gcc-core,gcc-g++,ocaml,ocaml-camlp4,ocaml-compiler-libs,libncurses-devel,unzip,libmpfr-devel,patch,flexdll,libglpk-devel >NUL' - - '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin gcc-core"' + - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" install build_script: - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && env DJDIR="workaround" ./configure && make lib-ext && make && make install"' - - '%CYG_ROOT%/bin/bash -lc "opam init -y -a"' - - '%CYG_ROOT%/bin/bash -lc "opam config env"' - - '%CYG_ROOT%/bin/bash -lc "opam install -y -v ocamlfind"' + - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" build + +test_script: + - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" test diff --git a/appveyor_build.cmd b/appveyor_build.cmd new file mode 100644 index 00000000000..9e3c2f8a9a1 --- /dev/null +++ b/appveyor_build.cmd @@ -0,0 +1,131 @@ +@rem *********************************************************************** +@rem * * +@rem * opam * +@rem * * +@rem * David Allsopp, OCaml Labs, Cambridge. * +@rem * * +@rem * Copyright 2018 MetaStack Solutions Ltd. * +@rem * * +@rem * All rights reserved. This file is distributed under the terms of * +@rem * the GNU Lesser General Public License version 2.1, with the * +@rem * special exception on linking described in the file LICENSE. * +@rem * * +@rem *********************************************************************** + +@rem BE CAREFUL ALTERING THIS FILE TO ENSURE THAT ERRORS PROPAGATE +@rem IF A COMMAND SHOULD FAIL IT PROBABLY NEEDS TO END WITH +@rem || exit /b 1 +@rem BASICALLY, DO THE TESTING IN BASH... + +@rem Do not call setlocal! +@echo off + +set CYG_ROOT=C:\%CYG_ROOT% + +goto %1 + +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-%CYG_ARCH%.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\bash.exe" -lc "%%P --help" > 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-%CYG_ARCH%.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 +cd "%APPVEYOR_BUILD_FOLDER%" + +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 patch curl diffutils tar unzip +set CYGWIN_COMMANDS=cygcheck make patch curl diff tar unzip + +if "%OCAML_PORT%" equ "mingw" ( + set CYGWIN_PACKAGES=%CYGWIN_PACKAGES% mingw64-i686-gcc-g++ + set CYGWIN_COMMANDS=%CYGWIN_COMMANDS% i686-w64-mingw32-g++ +) +if "%OCAML_PORT%" equ "mingw64" ( + set CYGWIN_PACKAGES=%CYGWIN_PACKAGES% mingw64-x86_64-gcc-g++ + set CYGWIN_COMMANDS=%CYGWIN_COMMANDS% x86_64-w64-mingw32-g++ +) +if "%OCAML_PORT%" equ "" ( + set CYGWIN_PACKAGES=%CYGWIN_PACKAGES% gcc-g++ flexdll + set CYGWIN_COMMANDS=%CYGWIN_COMMANDS% g++ flexlink +) + +set CYGWIN_INSTALL_PACKAGES= +set CYGWIN_UPGRADE_REQUIRED=0 + +for %%P in (%CYGWIN_PACKAGES%) do call :CheckPackage %%P +call :UpgradeCygwin + +rem Use dra27 jbuilder/ocaml-mccs/flexdll for native ports +if "%OCAML_PORT%" neq "" git apply appveyor.patch + +set INSTALLED_URL= +for /f "tokens=3" %%U in ('findstr /C:"URL_ocaml = " src_ext\Makefile') do set OCAML_URL=%%U +for /f "tokens=3" %%U in ('findstr /C:"URL_flexdll = " src_ext\Makefile') do set FLEXDLL_URL=%%U +if exist bootstrap\installed-tarball for /f "delims=" %%U in ('type bootstrap\installed-tarball') do set INSTALLED_URL=%%U +if "%INSTALLED_URL%" neq "%OCAML_URL% %FLEXDLL_URL%" if exist bootstrap\nul ( + echo Required: %OCAML_URL% %FLEXDLL_URL% + echo Compiled: %INSTALLED_URL% + echo Re-building bootstrap compiling + rd /s/q bootstrap + if exist src_ext\archives\nul rd /s/q src_ext\archives +) + +"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && make -C src_ext cache-archives" || exit /b 1 + +if not exist bootstrap\nul ( + "%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && make compiler" || exit /b 1 + if "%CYG_ARCH%%OCAML_PORT%" equ "x86_64" ( + "%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && rebase -b 0x7cd20000 bootstrap/ocaml/lib/ocaml/stublibs/dllunix.so" || exit /b 1 + "%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && rebase -b 0x7cd20000 bootstrap/ocaml/lib/ocaml/stublibs/dllthreads.so" || exit /b 1 + ) + if exist bootstrap\ocaml-*.tar.gz del bootstrap\ocaml-*.tar.gz + if "%OCAML_PORT%" neq "" if exist bootstrap\flexdll-*.tar.gz del bootstrap\flexdll-*.tar.gz + del bootstrap\ocaml\bin\*.byte.exe + if "%OCAML_PORT%" equ "" ( + del bootstrap\ocaml\lib\ocaml\expunge.exe + ) else ( + del bootstrap\ocaml\lib\expunge.exe + ) + for /f %%D in ('dir /b/ad bootstrap\ocaml-*') do ( + rd /s/q bootstrap\%%D + if "%OCAML_PORT%" equ "" ( + rem Directory needs to exist, as the Cygwin bootstraps OCAMLLIB refers to it + md bootstrap\%%D + ) + ) +) + +goto :EOF + +:build +if "%OCAML_PORT%" equ "" ( + rem make install doesn't yet work for the native Windows builds + set POST_COMMAND=^&^& make opam-installer install +) +"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && ./configure && make lib-ext && make opam %POST_COMMAND%" || exit /b 1 +goto :EOF + +:test +rem Can't yet do an opam init with the native Windows builds +if "%OCAML_PORT%" equ "" "%CYG_ROOT%\bin\bash.exe" -lc "make -C $APPVEYOR_BUILD_FOLDER run-appveyor-test" || exit /b 1 +goto :EOF diff --git a/appveyor_test.sh b/appveyor_test.sh new file mode 100644 index 00000000000..5a6af18e198 --- /dev/null +++ b/appveyor_test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +opam init -y -a +eval $(opam config env) +opam install -y -v ocamlfind diff --git a/shell/bootstrap-ocaml.sh b/shell/bootstrap-ocaml.sh index c98e928cae1..a29dbd9c8a8 100755 --- a/shell/bootstrap-ocaml.sh +++ b/shell/bootstrap-ocaml.sh @@ -111,3 +111,4 @@ else ${MAKE:-make} world opt.opt ${MAKE:-make} install fi +echo "${URL} ${FV_URL}" > ../installed-tarball