install:
  - set PATH=C:\msys64\usr\bin;%PATH%
  - bash -lc "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
  - bash -lc "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig"
  - bash -lc "pacman-key --init"
  - bash -lc "pacman-key --populate msys2"
  - bash -lc "pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig"
  - bash -lc "pacman --ask 20 -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
  - ps: Get-Process | Where-Object {$_.path -like 'C:\msys64*'} | Stop-Process
  - bash -lc "pacman --needed --ask 20 -Syu"
  - bash -lc "pacman --needed --ask 20 -Sy"
  - bash -lc "pacman --noconfirm -S base-devel"
  - bash -lc "pacman --noconfirm -S msys2-devel"
  - bash -lc "pacman --noconfirm -S mingw-w64-x86_64-toolchain"
  - bash -lc "pacman --noconfirm -S mingw-w64-x86_64-pcre"
  - bash -lc "pacman --noconfirm -S msys2-runtime"
  - bash -lc "pacman --noconfirm -S isl"

build_script:
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; pwd"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; ls -l"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; which gcc"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; gcc --version"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; pacman -Q"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; cat msys2-build.sh"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; bash -x msys2-build.sh || (cat config.log && exit 1)"
  - bash -lc "cd $APPVEYOR_BUILD_FOLDER; cp /usr/bin/msys-2.0.dll ."

artifacts:
  - path: ./c/mlr.exe
    name: Miller executable
  - path: ./msys-2.0.dll
    name: MSYS2 DLL
