# check if all required nodes are
# up, if at least one fails test will stop
exec 001-alive alpha
exec 001-alive beta
exec 001-alive koppa

# save syscall, no-op when already done
exec 003-save-sysctls alpha
exec 003-save-sysctls beta
exec 003-save-sysctls koppa

# restore sysctls to initial default
exec 003-restore-sysctls alpha
exec 003-restore-sysctls beta
exec 003-restore-sysctls koppa

# start netperf as receiver at TCP port
# 8000 and background process. This applet
# probably copy a local python helper program
# to node beta.
# xxx- prefixed applets are not implemented yet
exec xxx-netperf-sink beta mode:background port:8000

# limit rate at forwarding radio to 10000 byte/sec
exec xxx-netem koppa rate:10000

# set IW at sender to 20
exec xxx-conf-iw alpha 20
# send 10000 byte from to beta (at node alpha)
# do not background, wait in foreground, process
# will block here until all bytes are transmitted
exec xxx-netpert-sender alpha beta 10000

# ok, if the previous process returns the data is transmitted

# now read the data at the sink. This command will
# simple return the data writen with the previous backgrounded
# "exec xxx-netperf-sink beta 8000" call. The data file
# is copied here, the file at beta is removed (cleaned)
exec xxx-netperf-sink beta stop-backgrouding
exec xxx-netperf-sink beta fetch-data

# check if all required nodes are
# up, if at least one fails test will stop
exec 001-alive alpha
exec 001-alive beta
exec 001-alive koppa

# save syscall, no-op when already done
exec 003-save-sysctls alpha
exec 003-save-sysctls beta
exec 003-save-sysctls koppa

# restore sysctls to initial default
exec 003-restore-sysctls alpha
exec 003-restore-sysctls beta
exec 003-restore-sysctls koppa

# set default /proc/sys/net/* variables just to
# make sure we have the constant set of knobs
exec xxx-set-default-net-proc-knobs alpha
exec xxx-set-default-net-proc-knobs beta
exec xxx-set-default-net-proc-knobs koppa

# set some specific sysctl values for sender and receiver
exec xxx-sysctl alpha set net.ipv4.tcp_no_metrics_save:1
exec xxx-sysctl koppa set net.ipv4.tcp_no_metrics_save:1

# disable offloading capabilities for sender and receiver
exec xxx-ethtool alpha "-K tso off gso off gro off sg off"
exec xxx-ethtool beta "-K tso off gso off gro off sg off"

# start netperf as receiver at TCP port
# 8000 and background process. This applet
# probably copy a local python helper program
# to node beta.
# xxx- prefixed applets are not implemented yet
exec xxx-netperf-sink beta mode:background port:8000

# limit rate at forwarding radio to 10000 byte/sec
exec xxx-netem koppa rate:10000

# set IW at sender to 20
exec xxx-conf-iw alpha 20
# send 10000 byte from to beta (at node alpha)
# do not background, wait in foreground, process
# will block here until all bytes are transmitted
exec xxx-netpert-sender alpha beta 10000

# ok, if the previous process returns the data is transmitted

# now read the data at the sink. This command will
# simple return the data writen with the previous backgrounded
# "exec xxx-netperf-sink beta 8000" call. The data file
# is copied here, the file at beta is removed (cleaned)
exec xxx-netperf-sink beta stop-backgrouding
exec xxx-netperf-sink beta fetch-data

add more sysctl and ethtool specific applet examples


@echo off
if "%OS%" == "Windows_NT" setlocal

if not defined JAVA_HOME goto no_java_home
if not defined VTPASS_HOME goto no_vtpass_home

set JAVA=%JAVA_HOME%\bin\java

set PASS_JAR=%VTPASS_HOME%\jars\vt-password-${project.version}.jar

set CLASSPATH=%LIBDIR%\vt-dictionary-3.0-SNAPSHOT.jar;%LIBDIR%\vt-crypt-2.1.1.jar;%LIBDIR%\commons-logging-1.1.1.jar;%PASS_JAR%

call "%JAVA%" -cp "%CLASSPATH%" edu.vt.middleware.password.PasswordValidator %*
goto end

:no_vtpass_home
echo ERROR: VTPASS_HOME environment variable must be set to VT Password install path.
goto end

:no_java_home
echo ERROR: JAVA_HOME environment variable must be set to JRE/JDK install path.

:end

@echo off
if "%OS%" == "Windows_NT" setlocal

if not defined JAVA_HOME goto no_java_home
if not defined VTPASS_HOME goto no_vtpass_home

set JAVA=%JAVA_HOME%\bin\java

set PASS_JAR=%VTPASS_HOME%\jars\vt-password-${project.version}.jar
set LIBDIR=%VTPASS_HOME%\lib

set CLASSPATH=%LIBDIR%\vt-dictionary-3.0.jar;%LIBDIR%\vt-crypt-2.1.1.jar;%LIBDIR%\commons-logging-1.1.1.jar;%PASS_JAR%

call "%JAVA%" -cp "%CLASSPATH%" edu.vt.middleware.password.PasswordValidator %*
goto end

:no_vtpass_home
echo ERROR: VTPASS_HOME environment variable must be set to VT Password install path.
goto end

:no_java_home
echo ERROR: JAVA_HOME environment variable must be set to JRE/JDK install path.

:end

Update script for latest vt-dictionary.

Update script for latest vt-dictionary.


@setlocal EnableDelayedExpansion EnableExtensions
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
@if defined PACKER_DEBUG (@echo on) else (@echo off)

title Enabling Windows Remote Management. Please wait...

echo ==^> Turning off User Account Control (UAC)
:: see http://www.howtogeek.com/howto/windows-vista/enable-or-disable-uac-from-the-windows-vista-command-line/
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

title Enabling Windows Remote Management. Please wait...

echo ==^> Setting the PowerShell ExecutionPolicy to RemoteSigned (64 bit)
powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"

if exist %SystemRoot%\SysWOW64\cmd.exe (
  echo ==^> Setting the PowerShell ExecutionPolicy to RemoteSigned (32 bit)
  %SystemRoot%\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL
  @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL
)

systeminfo 2>nul | findstr /b /c:"OS Name" | findstr /c:"Windows 7" >nul
if errorlevel 1 goto skip_fixnetwork

if not exist a:\fixnetwork.ps1 echo ==^> ERROR: File not found: a:\fixnetwork.ps1

echo ==^> Setting the Network Location to private
:: see http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx
powershell -File a:\fixnetwork.ps1 <NUL
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -File a:\fixnetwork.ps1

:skip_fixnetwork

echo ==^> Changing remote UAC account policy
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

echo ==^> Blocking WinRM port 5985 on the firewall
netsh advfirewall firewall add rule name="winrm"  dir=in action=block protocol=TCP localport=5985
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm"  dir=in action=block protocol=TCP localport=5985

echo ==^> Configuring Windows Remote Management (WinRM) service

call winrm quickconfig -q
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm quickconfig -q

call winrm quickconfig -transport:http
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm quickconfig -transport:http

call winrm set winrm/config @{MaxTimeoutms="1800000"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config @{MaxTimeoutms="1800000"}

call winrm set winrm/config/winrs @{MaxMemoryPerShellMB="800"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/winrs @{MaxMemoryPerShellMB="1024"}

call winrm set winrm/config/service @{AllowUnencrypted="true"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/service @{AllowUnencrypted="true"}

call winrm set winrm/config/service/auth @{Basic="true"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/service/auth @{Basic="true"}

call winrm set winrm/config/client/auth @{Basic="true"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/client/auth @{Basic="true"}

call winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}

sc config winrm start= auto
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: sc config winrm start= auto

:: wait for winrm service to finish starting
timeout 5

sc query winrm | findstr "RUNNING" >nul
if errorlevel 1 goto winrm_not_running

echo ==^> Stopping winrm service

sc stop winrm

:is_winrm_running

timeout 1

sc query winrm | findstr "STOPPED" >nul
if errorlevel 1 goto is_winrm_running

:winrm_not_running

echo ==^> Unblocking WinRM port 5985 on the firewall
netsh advfirewall firewall delete rule name="winrm"
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall delete rule name="winrm"

netsh advfirewall firewall set rule group="remote administration" new enable=yes
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="remote administration" new enable=yes

echo ==^> Opening WinRM port 5985 on the firewall
:: see http://social.technet.microsoft.com/Forums/windowsserver/en-US/a1e65f0f-2550-49ae-aee2-56a9bdcfb8fb/windows-7-remote-administration-firewall-group?forum=winserverManagement
netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes

netsh advfirewall firewall add rule name="winrm"  dir=in action=allow protocol=TCP localport=5985
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm"  dir=in action=allow protocol=TCP localport=5985

:exit0

ver>nul

goto :exit

:exit1

verify other 2>nul

:exit

add install-wimrm from boxcutter/windows


@echo off

set PATH=c:\Program Files (x86)\WinSCP\;%PATH%

set SELF_PATH=%~dp0
set ROOT=%SELF_PATH%\..\..

for /f "delims=" %%i in ('findstr versionString %ROOT%\version.json') do set VERSION_LINE=%%i
set UNQUOTED=%VERSION_LINE:"='%
for /f "tokens=4 delims='" %%i in ("%UNQUOTED%") do set VERSION=%%i

for /f "delims=" %%i in ('dir /b screen-translator-online*.exe') do set online=%%i
for /f "delims=" %%i in ('dir /b screen-translator-offline*.exe') do set offline=%%i

winscp.com /keygen %SELF_PATH%\sf_key /output=key.ppk
set folder="/home/frs/project/screen-translator/bin/v%VERSION%"
winscp.com /command "open sftp://onemoregres@frs.sourceforge.net/ -privatekey=key.ppk -hostkey=*" "mkdir %folder%" "put %online% %folder%/%online%" "put %offline% %folder%/%offline%" "exit"

set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%online%"
curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url%

set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%offline%"
curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url%

@echo off

set PATH=c:\Program Files (x86)\WinSCP\;%PATH%

set SELF_PATH=%~dp0
set ROOT=%SELF_PATH%\..\..

for /f "delims=" %%i in ('findstr versionString %ROOT%\version.json') do set VERSION_LINE=%%i
set UNQUOTED=%VERSION_LINE:"='%
for /f "tokens=4 delims='" %%i in ("%UNQUOTED%") do set VERSION=%%i

for /f "delims=" %%i in ('dir /b screen-translator-online*.exe') do set online=%%i
for /f "delims=" %%i in ('dir /b screen-translator-offline*.exe') do set offline=%%i

winscp.com /keygen %SELF_PATH%\sf_key /output=key.ppk
set folder="/home/frs/project/screen-translator/bin/v%VERSION%"
set bin_folder="/home/frs/project/screen-translator/bin"
winscp.com /command "open sftp://onemoregres@frs.sourceforge.net/ -privatekey=key.ppk -hostkey=*" ^
 "mkdir %folder%" ^
 "put %online% %folder%/%online%" ^
 "put %offline% %folder%/%offline%" ^
 "put %ROOT%\distr\Changelog_en.txt %bin_folder%/readme.md" ^
 "put %ROOT%\distr\Changelog_ru.txt %bin_folder%/readme_ru.md" ^
 "exit"

set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%online%"
curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url%

set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%offline%"
curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url%

Add changelog to sourceforge.

Add changelog to sourceforge.


mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^
    -DBUILD_TESTING=ON ^
    -DGZ_UTILS_VENDOR_CLI11=OFF ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test
ctest --output-on-failure -C Release
if errorlevel 1 exit 1

Create bld.bat

Create bld.bat


mkdir build
cd build

cmake -G "Ninja" .. \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% \
      -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% \
      -DLLVM_DIR=%LIBRARY_PREFIX%/lib/cmake/llvm

ninja -j%CPU_COUNT%
ninja install
ctest

mkdir build
cd build

cmake -G "Ninja" .. ^
      -DCMAKE_BUILD_TYPE=Release ^
      -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
      -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
      -DLLVM_DIR=%LIBRARY_PREFIX%/lib/cmake/llvm

ninja -j%CPU_COUNT%
ninja install
ctest

Fix bld.bat

Fix bld.bat


@echo on
setlocal EnableDelayedExpansion
set SHORT_VERSION=%PKG_VERSION:~0,-2%

:: You may not always want this when doing dirty builds (debugging late stage
:: problems, but if debugging configure time issues you probably do want this).
if exist config.cache del config.cache

:: if "%DXSDK_DIR%" == "" (
::   echo You do not appear to have the DirectX SDK installed.  Please get it from
::   echo    https://www.microsoft.com/en-us/download/details.aspx?id=6812
::   echo and try this build again.  If you have installed it, and are still seeing
::   echo this message, please open a new console to refresh your environment variables.
::   exit /b 1
:: )

:: Webengine requires either working OpenGL drivers or
:: Angle (therefore DirectX >= 11). This works on some
:: VMs and not others.  Windows 7 VirtualBox instantly
:: aborts when loading Spyder sSo we've had to disable
:: it globally.
:: Using Mesa from MSYS2 is mentioned as a workaround:
::  http://wiki.qt.io/Cross-compiling-Mesa-for-Windows
:: `set QT_OPENGL=software` forces Qt5 to use that but
:: but when I tried it it was too buggy; Spyder crashed a
:: little bit later, though it worked for Carlos.
set WEBBACKEND=qtwebengine
set QT_LIBINFIX=_conda

where perl.exe
if %ERRORLEVEL% neq 0 (
  echo Could not find perl.exe
  exit /b 1
)

:: make sure we can find ICU and openssl:
set "INCLUDE=%LIBRARY_INC%;%INCLUDE%"
set "LIB=%LIBRARY_LIB%;%LIB%"

:: Support systems with neither capable OpenGL (desktop mode) nor DirectX 11 (ANGLE mode) drivers
:: https://github.com/ContinuumIO/anaconda-issues/issues/9142
if not exist "%LIBRARY_BIN%" mkdir "%LIBRARY_BIN%"
copy opengl32sw\opengl32sw.dll  %LIBRARY_BIN%\opengl32sw.dll
if errorlevel 1 exit /b 1
if not exist %LIBRARY_BIN%\opengl32sw.dll exit /b 1

:: WebEngine (Chromium) specific definitions.  Only build this with VS 2015 (no support for python < 3.5)
if "%WEBBACKEND%" == "qtwebengine" (
  set "WSDK8=C:\\Program\ Files\ (x86)\\Windows\ Kits\\8.1"
  set "WDK=C:\\WinDDK\\7600.16385.1"
  set "INCLUDE=%WSDK8%\Include;%WDK%\inc;%INCLUDE%"
  if "%ARCH%"=="32" (
    set "PATH=%WSDK8%\bin\x86;%WDK$%\bin\x86;%PATH%"
    set "LIB=%LIB%;%WSDK8%\Lib\winv6.3\um\x86"
  ) else (
    set "PATH=%WSDK8%\bin\x64;%WDK$%\bin\amd64;%PATH%"
    set "LIB=%LIB%;%WSDK8%\Lib\winv6.3\um\x64"
  )
  set "GYP_DEFINES=windows_sdk_path='%WSDK8%'"
  set GYP_MSVS_VERSION=2015
  set GYP_GENERATORS=ninja
  set GYP_PARALLEL=1
  set "WDK_DIR=%WDK%"
  set "WindowsSDKDir=%WSDK8%"
) else (
  rmdir /s /q qtwebengine
)

set OPENGLVER=dynamic

:: Patch does not apply cleanly.  Copy file.
:: https://codereview.qt-project.org/#/c/141019/
copy %RECIPE_DIR%\tst_compiler.cpp qtbase\tests\auto\other\compiler\

:: Cannot skip this if we want QT_LIBINFIX to work.
:: TODO: should we always be rebuilding configure.exe anyway
:: Mentioned patch no longer applied
:: goto SKIP_REBUILD_CONFIGURE_EXE
:: If applying 0009-Win32-Re-permit-fontconfig-and-qt-freetype.patch (or
:: any patch that changes configureapp.cpp or any of the bootstrap files
:: in any way that alters the configure result) then configure.exe needs
:: to be rebuilt. Here I duplicate logic from configure.bat because that
:: file conflates needing to rebuild configure.exe with using a git repo
:: clone (OK, we should really remove that conflation instead and always
:: just rebuild configure.exe).
pushd qtbase
del /q configure.exe
set QTSRC=%CD%\
pushd tools\configure
set make=jom
set QTVERSION=%PKG_VERSION%
for /f "tokens=1,2,3,4 delims=.= " %%i in ('echo Qt.%QTVERSION%') do (
    set QTVERMAJ=%%j
    set QTVERMIN=%%k
    set QTVERPAT=%%l
)
:: .. end of specifically this bit is untested
echo #### Generated by bld.bat - DO NOT EDIT! ####> Makefile
echo/>> Makefile
set
echo QMAKESPEC = win32-msvc>> Makefile
echo QT_VERSION = %QTVERSION%>> Makefile
rem These must have trailing spaces to avoid misinterpretation as 5>>, etc.
echo QT_MAJOR_VERSION = %QTVERMAJ% >> Makefile
echo QT_MINOR_VERSION = %QTVERMIN% >> Makefile
echo QT_PATCH_VERSION = %QTVERPAT% >> Makefile
echo CXX = cl>>Makefile
:: This is a hack, CFLAGS_CRT becomes part of CFLAGS_EXTRA, overwriting it.
echo CFLAGS_CRT = -DQT_LIBINFIX=\"%QT_LIBINFIX%\" >> Makefile
echo EXTRA_CXXFLAGS =>>Makefile
rem This must have a trailing space.
echo QTSRC = %QTSRC% >> Makefile
echo SOURCE_PATH = %QTSRC% >> Makefile
echo INC_PATH = %QTSRC%\include >> Makefile
set tmpl=win32
echo/>> Makefile
type Makefile.%tmpl% >> Makefile
%make%
:: Attempt to avoid:
:: warning C4651: '/DQT_LIBINFIX="_conda"' specified for precompiled header but not for current compile
:: del qmake_pch.h
del qmake_pch.obj
del qmake_pch.pch
popd
popd
:SKIP_REBUILD_CONFIGURE_EXE

:: See http://doc-snapshot.qt-project.org/qt5-5.4/windows-requirements.html
:: this needs to be CALLed due to an exit statement at the end of configure:
:: optimized-tools is necessary for qtlibinfix, otherwise:
:: qtbase/lib/Qt5Bootstrap.prl
:: ends up containing:
:: QMAKE_PRL_TARGET = Qt5Bootstrap.condad.lib
:: for some odd reason.
call configure ^
     -prefix %LIBRARY_PREFIX% ^
     -libdir %LIBRARY_LIB% ^
     -bindir %LIBRARY_BIN% ^
     -headerdir %LIBRARY_INC%\qt ^
     -archdatadir %LIBRARY_PREFIX% ^
     -datadir %LIBRARY_PREFIX% ^
     -optimized-tools ^
     -L %LIBRARY_LIB% ^
     -I %LIBRARY_INC% ^
     -confirm-license ^
     -no-fontconfig ^
     -icu ^
     -no-separate-debug-info ^
     -no-warnings-are-errors ^
     -nomake examples ^
     -nomake tests ^
     -no-warnings-are-errors ^
     -opengl %OPENGLVER% ^
     -opensource ^
     -openssl ^
     -openssl-runtime ^
     -platform win32-msvc ^
     -release ^
     -shared ^
     -qt-freetype ^
     -system-libjpeg ^
     -system-libpng ^
     -system-sqlite ^
     -system-zlib ^
     -plugin-sql-sqlite ^
     -qtlibinfix %QT_LIBINFIX% ^
     -verbose

if %errorlevel% neq 0 exit /b %errorlevel%

:: re-enable echoing which is disabled by configure
echo on

:: To get a much quicker turnaround you can add this: (remember also to add the hat symbol after -plugin-sql-sqlite)
::     -skip %WEBBACKEND% -skip qtwebsockets -skip qtwebchannel -skip qtwayland -skip qtwinextras -skip qtsvg -skip qtsensors ^
::     -skip qtcanvas3d -skip qtconnectivity -skip declarative -skip multimedia -skip qttools

jom -U all
:: Hooray for racey build systems. You may get a failure about a QtWebengine .stamp file being missing. You may not. Who knows?
jom -U all
if %errorlevel% neq 0 exit /b %errorlevel%
echo Finished `jom -U all`
jom -U install
:: I expect raciness here too:
jom -U install
if %errorlevel% neq 0 exit /b %errorlevel%
echo Finished `jom -U install`
pushd qtbase
  jom -U install_mkspecs
  if %errorlevel% neq 0 exit /b %errorlevel%
  echo Finished `jom -U install_mkspecs`
popd

if exist %LIBRARY_BIN%\qmake.exe goto ok_qmake_exists
echo Warning %LIBRARY_BIN%\qmake.exe does not exist jom -U install failed, very strange. Copying it from qtbase\bin\qmake.exe
copy qtbase\bin\qmake.exe %LIBRARY_BIN%\qmake.exe
:ok_qmake_exists

:: To rewrite qt.conf contents per conda environment
copy "%RECIPE_DIR%\write_qtconf.bat" "%PREFIX%\Scripts\.qt-post-link.bat"
if %errorlevel% neq 0 exit /b %errorlevel%

@echo on
setlocal EnableDelayedExpansion
set SHORT_VERSION=%PKG_VERSION:~0,-2%

:: You may not always want this when doing dirty builds (debugging late stage
:: problems, but if debugging configure time issues you probably do want this).
if exist config.cache del config.cache

:: if "%DXSDK_DIR%" == "" (
::   echo You do not appear to have the DirectX SDK installed.  Please get it from
::   echo    https://www.microsoft.com/en-us/download/details.aspx?id=6812
::   echo and try this build again.  If you have installed it, and are still seeing
::   echo this message, please open a new console to refresh your environment variables.
::   exit /b 1
:: )

:: Webengine requires either working OpenGL drivers or
:: Angle (therefore DirectX >= 11). This works on some
:: VMs and not others.  Windows 7 VirtualBox instantly
:: aborts when loading Spyder sSo we've had to disable
:: it globally.
:: Using Mesa from MSYS2 is mentioned as a workaround:
::  http://wiki.qt.io/Cross-compiling-Mesa-for-Windows
:: `set QT_OPENGL=software` forces Qt5 to use that but
:: but when I tried it it was too buggy; Spyder crashed a
:: little bit later, though it worked for Carlos.
set WEBBACKEND=qtwebengine
set QT_LIBINFIX=_conda

where perl.exe
if %ERRORLEVEL% neq 0 (
  echo Could not find perl.exe
  exit /b 1
)

:: make sure we can find ICU and openssl:
set "INCLUDE=%LIBRARY_INC%;%INCLUDE%"
set "LIB=%LIBRARY_LIB%;%LIB%"

:: Support systems with neither capable OpenGL (desktop mode) nor DirectX 11 (ANGLE mode) drivers
:: https://github.com/ContinuumIO/anaconda-issues/issues/9142
if not exist "%LIBRARY_BIN%" mkdir "%LIBRARY_BIN%"
copy opengl32sw\opengl32sw.dll  %LIBRARY_BIN%\opengl32sw.dll
if errorlevel 1 exit /b 1
if not exist %LIBRARY_BIN%\opengl32sw.dll exit /b 1

:: WebEngine (Chromium) specific definitions.  Only build this with VS 2015 (no support for python < 3.5)
if "%WEBBACKEND%" == "qtwebengine" (
  set "WSDK8=C:\\Program\ Files\ (x86)\\Windows\ Kits\\8.1"
  set "WDK=C:\\WinDDK\\7600.16385.1"
  set "INCLUDE=%WSDK8%\Include;%WDK%\inc;%INCLUDE%"
  if "%ARCH%"=="32" (
    set "PATH=%WSDK8%\bin\x86;%WDK$%\bin\x86;%PATH%"
    set "LIB=%LIB%;%WSDK8%\Lib\winv6.3\um\x86"
  ) else (
    set "PATH=%WSDK8%\bin\x64;%WDK$%\bin\amd64;%PATH%"
    set "LIB=%LIB%;%WSDK8%\Lib\winv6.3\um\x64"
  )
  set "GYP_DEFINES=windows_sdk_path='%WSDK8%'"
  set GYP_MSVS_VERSION=2015
  set GYP_GENERATORS=ninja
  set GYP_PARALLEL=1
  set "WDK_DIR=%WDK%"
  set "WindowsSDKDir=%WSDK8%"
) else (
  rmdir /s /q qtwebengine
)

set OPENGLVER=dynamic

:: Patch does not apply cleanly.  Copy file.
:: https://codereview.qt-project.org/#/c/141019/
copy %RECIPE_DIR%\tst_compiler.cpp qtbase\tests\auto\other\compiler\

:: Cannot skip this if we want QT_LIBINFIX to work.
:: TODO: should we always be rebuilding configure.exe anyway
:: Mentioned patch no longer applied
:: goto SKIP_REBUILD_CONFIGURE_EXE
:: If applying 0009-Win32-Re-permit-fontconfig-and-qt-freetype.patch (or
:: any patch that changes configureapp.cpp or any of the bootstrap files
:: in any way that alters the configure result) then configure.exe needs
:: to be rebuilt. Here I duplicate logic from configure.bat because that
:: file conflates needing to rebuild configure.exe with using a git repo
:: clone (OK, we should really remove that conflation instead and always
:: just rebuild configure.exe).
pushd qtbase
del /q configure.exe
set QTSRC=%CD%\
pushd tools\configure
set make=jom
set QTVERSION=%PKG_VERSION%
for /f "tokens=1,2,3,4 delims=.= " %%i in ('echo Qt.%QTVERSION%') do (
    set QTVERMAJ=%%j
    set QTVERMIN=%%k
    set QTVERPAT=%%l
)
:: .. end of specifically this bit is untested
echo #### Generated by bld.bat - DO NOT EDIT! ####> Makefile
echo/>> Makefile
set
echo QMAKESPEC = win32-msvc>> Makefile
echo QT_VERSION = %QTVERSION%>> Makefile
rem These must have trailing spaces to avoid misinterpretation as 5>>, etc.
echo QT_MAJOR_VERSION = %QTVERMAJ% >> Makefile
echo QT_MINOR_VERSION = %QTVERMIN% >> Makefile
echo QT_PATCH_VERSION = %QTVERPAT% >> Makefile
echo CXX = cl>>Makefile
:: This is a hack, CFLAGS_CRT becomes part of CFLAGS_EXTRA, overwriting it.
echo CFLAGS_CRT = -DQT_LIBINFIX=\"%QT_LIBINFIX%\" >> Makefile
echo EXTRA_CXXFLAGS =>>Makefile
rem This must have a trailing space.
echo QTSRC = %QTSRC% >> Makefile
echo SOURCE_PATH = %QTSRC% >> Makefile
echo INC_PATH = %QTSRC%\include >> Makefile
set tmpl=win32
echo/>> Makefile
type %QTSRC%\qtbase\qmake\Makefile.%tmpl% >> Makefile
%make%
:: Attempt to avoid:
:: warning C4651: '/DQT_LIBINFIX="_conda"' specified for precompiled header but not for current compile
:: del qmake_pch.h
del qmake_pch.obj
del qmake_pch.pch
popd
popd
:SKIP_REBUILD_CONFIGURE_EXE

:: See http://doc-snapshot.qt-project.org/qt5-5.4/windows-requirements.html
:: this needs to be CALLed due to an exit statement at the end of configure:
:: optimized-tools is necessary for qtlibinfix, otherwise:
:: qtbase/lib/Qt5Bootstrap.prl
:: ends up containing:
:: QMAKE_PRL_TARGET = Qt5Bootstrap.condad.lib
:: for some odd reason.
call configure ^
     -prefix %LIBRARY_PREFIX% ^
     -libdir %LIBRARY_LIB% ^
     -bindir %LIBRARY_BIN% ^
     -headerdir %LIBRARY_INC%\qt ^
     -archdatadir %LIBRARY_PREFIX% ^
     -datadir %LIBRARY_PREFIX% ^
     -optimized-tools ^
     -L %LIBRARY_LIB% ^
     -I %LIBRARY_INC% ^
     -confirm-license ^
     -no-fontconfig ^
     -icu ^
     -no-separate-debug-info ^
     -no-warnings-are-errors ^
     -nomake examples ^
     -nomake tests ^
     -no-warnings-are-errors ^
     -opengl %OPENGLVER% ^
     -opensource ^
     -openssl ^
     -openssl-runtime ^
     -platform win32-msvc ^
     -release ^
     -shared ^
     -qt-freetype ^
     -system-libjpeg ^
     -system-libpng ^
     -system-sqlite ^
     -system-zlib ^
     -plugin-sql-sqlite ^
     -qtlibinfix %QT_LIBINFIX% ^
     -verbose

if %errorlevel% neq 0 exit /b %errorlevel%

:: re-enable echoing which is disabled by configure
echo on

:: To get a much quicker turnaround you can add this: (remember also to add the hat symbol after -plugin-sql-sqlite)
::     -skip %WEBBACKEND% -skip qtwebsockets -skip qtwebchannel -skip qtwayland -skip qtwinextras -skip qtsvg -skip qtsensors ^
::     -skip qtcanvas3d -skip qtconnectivity -skip declarative -skip multimedia -skip qttools

jom -U all
:: Hooray for racey build systems. You may get a failure about a QtWebengine .stamp file being missing. You may not. Who knows?
jom -U all
if %errorlevel% neq 0 exit /b %errorlevel%
echo Finished `jom -U all`
jom -U install
:: I expect raciness here too:
jom -U install
if %errorlevel% neq 0 exit /b %errorlevel%
echo Finished `jom -U install`
pushd qtbase
  jom -U install_mkspecs
  if %errorlevel% neq 0 exit /b %errorlevel%
  echo Finished `jom -U install_mkspecs`
popd

if exist %LIBRARY_BIN%\qmake.exe goto ok_qmake_exists
echo Warning %LIBRARY_BIN%\qmake.exe does not exist jom -U install failed, very strange. Copying it from qtbase\bin\qmake.exe
copy qtbase\bin\qmake.exe %LIBRARY_BIN%\qmake.exe
:ok_qmake_exists

:: To rewrite qt.conf contents per conda environment
copy "%RECIPE_DIR%\write_qtconf.bat" "%PREFIX%\Scripts\.qt-post-link.bat"
if %errorlevel% neq 0 exit /b %errorlevel%

Fix makefile location

Fix makefile location


@if "%AV_BUILD%"=="true" (
  call pkg_set_env_av.cmd
  set M_JOBS=2
) else (
  call pkg_set_env.cmd
  set M_JOBS=3
)

@TITLE pkg_build_64 %R_DATE% %R_SVN% %R_VERS%

@set ORIG_PATH=%PATH%

@set SUFFIX=%R_VERS_2%_64
@set LOG_PATH_NAME=%DP0%ruby%SUFFIX%-%R_VERS%-1-x86_64
@set PKG_RUBY=%DP0%pkg/ruby%SUFFIX%/ruby%SUFFIX%

@rem --- git in path for bundled gems with gemspec using git ls-files ?
@PATH=%MSYS2_DIR%/mingw64/bin;%GIT_PATH%;%MSYS2_DIR%/usr/bin;%PATH%
@echo on

@attrib -r %DP0%src/*.* /s /d

@rem --------------------------------------------------------------------- Build
bash.exe --login -c  "cd '%DP0%'; MINGW_INSTALLS=mingw64 makepkg-mingw --nocheck --skippgpcheck -dLf -p PKGBUILD"
@if ERRORLEVEL 1 exit
@set /a ERROR_BLD=ERRORLEVEL

@@PATH=%MSYS2_DIR%/mingw64/bin;%MSYS2_DIR%/usr/bin;%GIT_PATH%;%ORIG_PATH%

@attrib +r %PKG_RUBY%/*.* /s
@rem --- Set bin & gem folders to rw
@attrib -r %PKG_RUBY%/bin/*
@attrib -r %PKG_RUBY%/bin/*.cmd
@attrib -r %PKG_RUBY%/bin/*.bat
@attrib -r %PKG_RUBY%/bin/*.ps1
@attrib -r %PKG_RUBY%/lib/ruby/gems/%R_VERS_INT%/*.* /s /d

@rem --- rename readline.rb so extension is used for tests (ren only works with backslashes)
@ren %~dp0pkg\ruby%SUFFIX%\ruby%SUFFIX%\lib\ruby\site_ruby\readline.rb readline.rb_

@rem ------------------------------------------------------------------ test-all
@cd %DP0%src/build%SUFFIX%
@echo.

@echo ---------------------------------------------------------------------- Running Tests
@echo test-all
@rem make.exe "TESTOPTS=-v -j%M_JOBS% --job-status=normal --show-skip" test-all > %LOG_PATH_NAME%-test-all.log 2>&1
@make.exe "TESTOPTS=-v --show-skip" test-all > %LOG_PATH_NAME%-test-all.log 2>&1

@rem --------------------------------------------------------- btest, test-basic
@cd %DP0%src/build%SUFFIX%
@if "%R_VERS_2%" GEQ "24" (
  @echo btest
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" btest      > %LOG_PATH_NAME%-test-btest.log 2>&1
  @echo test-basic
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" test-basic > %LOG_PATH_NAME%-test-basic.log 2>&1
) else (
  @echo test
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" test       > %LOG_PATH_NAME%-test.log 2>&1
)

@rem ---------------------------------------------------------------------- spec
@attrib -r %DP0%src/build%SUFFIX%/*.* /s /d

@rem just in case...
@@PATH=%MSYS2_DIR%/mingw64/bin;%MSYS2_DIR%/usr/bin;%GIT_PATH%;%ORIG_PATH%

@if "%R_VERS_2%" GEQ "25" (
  @echo test-spec
  make.exe test-spec     > %LOG_PATH_NAME%-test-spec.log 2>&1
) else (
  @echo test-rubyspec
  make.exe test-rubyspec > %LOG_PATH_NAME%-test-spec.log 2>&1
)

@rem --------------------------------------------------------------------- mspec
@attrib -r %DP0%src/ruby/spec/*.* /s /d
@attrib -r %DP0%src/ruby/spec/ruby/*.* /s /d

@PATH=%PKG_RUBY%/bin;%GIT_PATH%;%ORIG_PATH%

@cd %REPO_RUBY%/spec/ruby
@echo mspec
@call ..\mspec\bin\mspec -rdevkit > %LOG_PATH_NAME%-test-mspec.log 2>&1

@PATH=%PKG_RUBY%/bin;%GIT_PATH%;%ORIG_PATH%

@cd %~dp0

@set R_NAME=ruby%SUFFIX%

@rem Parse spec files, add total time file, and zip
@echo.
@echo ---------------------------------------------------------------------- Build ^& Test Times
@call time_log_64.cmd

@rem --- rename readline.rb_ back to readline.rb_
@attrib -r %PKG_RUBY%/lib/ruby/site_ruby/readline.rb_
@rem --- rename seems to only work with backslashes
@ren %~dp0pkg\ruby%SUFFIX%\ruby%SUFFIX%\lib\ruby\site_ruby\readline.rb_ readline.rb
@attrib +r %PKG_RUBY%/lib/ruby/site_ruby/readline.rb

@exit /b 0

@if "%AV_BUILD%"=="true" (
  call pkg_set_env_av.cmd
  set M_JOBS=2
) else (
  call pkg_set_env.cmd
  set M_JOBS=3
)

@TITLE pkg_build_64 %R_DATE% %R_SVN% %R_VERS%

@set ORIG_PATH=%PATH%

@set SUFFIX=%R_VERS_2%_64
@set LOG_PATH_NAME=%DP0%ruby%SUFFIX%-%R_VERS%-1-x86_64
@set PKG_RUBY=%DP0%pkg/ruby%SUFFIX%/ruby%SUFFIX%

@rem --- git in path for bundled gems with gemspec using git ls-files ?
@PATH=%MSYS2_DIR%/mingw64/bin;%GIT_PATH%;%MSYS2_DIR%/usr/bin;%PATH%
@echo on

@attrib -r %DP0%src/*.* /s /d

@rem --------------------------------------------------------------------- Build
bash.exe --login -c  "cd '%DP0%'; MINGW_INSTALLS=mingw64 makepkg-mingw --nocheck --skippgpcheck -dLf -p PKGBUILD"
@if ERRORLEVEL 1 exit
@set /a ERROR_BLD=ERRORLEVEL

@@PATH=%MSYS2_DIR%/mingw64/bin;%MSYS2_DIR%/usr/bin;%GIT_PATH%;%ORIG_PATH%

@attrib +r %PKG_RUBY%/*.* /s
@rem --- Set bin & gem folders to rw
@attrib -r %PKG_RUBY%/bin/*
@attrib -r %PKG_RUBY%/bin/*.cmd
@attrib -r %PKG_RUBY%/bin/*.bat
@attrib -r %PKG_RUBY%/bin/*.ps1
@attrib -r %PKG_RUBY%/lib/ruby/gems/%R_VERS_INT%/*.* /s /d

@rem --- rename readline.rb so extension is used for tests (ren only works with backslashes)
@ren %~dp0pkg\ruby%SUFFIX%\ruby%SUFFIX%\lib\ruby\site_ruby\readline.rb readline.rb_

@rem ------------------------------------------------------------------ test-all
@set SSL_CERT_FILE=%PKG_RUBY%/ssl/cert.pem
@cd %DP0%src/build%SUFFIX%
@echo.
@echo ---------------------------------------------------------------------- Running Tests
@echo test-all
@rem make.exe "TESTOPTS=-v -j%M_JOBS% --job-status=normal --show-skip" test-all > %LOG_PATH_NAME%-test-all.log 2>&1
@make.exe "TESTOPTS=-v --show-skip" test-all > %LOG_PATH_NAME%-test-all.log 2>&1

@rem --------------------------------------------------------- btest, test-basic
@cd %DP0%src/build%SUFFIX%
@if "%R_VERS_2%" GEQ "24" (
  @echo btest
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" btest      > %LOG_PATH_NAME%-test-btest.log 2>&1
  @echo test-basic
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" test-basic > %LOG_PATH_NAME%-test-basic.log 2>&1
) else (
  @echo test
  make.exe -j 1 "TESTOPTS=-v -j%M_JOBS%" test       > %LOG_PATH_NAME%-test.log 2>&1
)

@rem ---------------------------------------------------------------------- spec
@attrib -r %DP0%src/build%SUFFIX%/*.* /s /d

@rem just in case...
@@PATH=%MSYS2_DIR%/mingw64/bin;%MSYS2_DIR%/usr/bin;%GIT_PATH%;%ORIG_PATH%

@if "%R_VERS_2%" GEQ "25" (
  @echo test-spec
  make.exe test-spec     > %LOG_PATH_NAME%-test-spec.log 2>&1
) else (
  @echo test-rubyspec
  make.exe test-rubyspec > %LOG_PATH_NAME%-test-spec.log 2>&1
)

@rem --------------------------------------------------------------------- mspec
@attrib -r %DP0%src/ruby/spec/*.* /s /d
@attrib -r %DP0%src/ruby/spec/ruby/*.* /s /d

@PATH=%PKG_RUBY%/bin;%GIT_PATH%;%ORIG_PATH%

@cd %REPO_RUBY%/spec/ruby
@echo mspec
@call ..\mspec\bin\mspec -rdevkit > %LOG_PATH_NAME%-test-mspec.log 2>&1

@PATH=%PKG_RUBY%/bin;%GIT_PATH%;%ORIG_PATH%

@cd %~dp0

@set R_NAME=ruby%SUFFIX%

@rem Parse spec files, add total time file, and zip
@echo.
@echo ---------------------------------------------------------------------- Build ^& Test Times
@call time_log_64.cmd

@rem --- rename readline.rb_ back to readline.rb_
@attrib -r %PKG_RUBY%/lib/ruby/site_ruby/readline.rb_
@rem --- rename seems to only work with backslashes
@ren %~dp0pkg\ruby%SUFFIX%\ruby%SUFFIX%\lib\ruby\site_ruby\readline.rb_ readline.rb
@attrib +r %PKG_RUBY%/lib/ruby/site_ruby/readline.rb

@exit /b 0

Set ENV['SSL_CERT_FILE'] before testing [ci skip]


MKDIR build\windows
CD build\windows

cmake ..\.. ^
        -G "%CMAKE_GENERATOR%" ^
        -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
        -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
        -DBUILD_STATIC_LIBS=1 ^
        -DBUILD_SHARED_LIBS=1

ECHO VS files have been generated in build\windows

dir

cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target ZERO_CHECK

dir

dir programs\Release

dir libmetis\Release

dir include

dir ..\..

move libmetis\Release\metis.lib %LIBRARY_BIN%

move programs\Release\cmpfillin.exe %LIBRARY_LIB%
move programs\Release\gpmetis.exe %LIBRARY_LIB%
move programs\Release\graphchk.exe %LIBRARY_LIB%
move programs\Release\m2gmetis.exe %LIBRARY_LIB%
move programs\Release\ndmetis.exe %LIBRARY_LIB%
move programs\Release\mpmetis.exe %LIBRARY_LIB%

move include\Release\metis.h %LIBRARY_INC%
move include\Release\gklib_tls.h %LIBRARY_INC%

MKDIR build\windows
CD build\windows

cmake ..\.. ^
        -G "%CMAKE_GENERATOR%" ^
        -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
        -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
        -DBUILD_STATIC_LIBS=1 ^
        -DBUILD_SHARED_LIBS=1

ECHO VS files have been generated in build\windows

cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target ZERO_CHECK

move libmetis\Release\metis.lib %LIBRARY_BIN%
move programs\Release\cmpfillin.exe %LIBRARY_LIB%
move programs\Release\gpmetis.exe %LIBRARY_LIB%
move programs\Release\graphchk.exe %LIBRARY_LIB%
move programs\Release\m2gmetis.exe %LIBRARY_LIB%
move programs\Release\ndmetis.exe %LIBRARY_LIB%
move programs\Release\mpmetis.exe %LIBRARY_LIB%

remove include files

remove include files


@echo off
rem
rem Install or update Cygwin.
rem

setlocal

set _PACKAGES=cron,diffutils,inetutils,ncurses,netcat,openssh,p7zip,procps,python,rsync,screen,unzip,vim,zip,genisoimage,w3m,wodim
set _ROOTDIR=C:\cygwin
set _SITE=http://mirrors.xmission.com/cygwin
set _PREFIX=CYGWIN-SETUP:

goto :main

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
goto :eof

:stop_services
    if not exist "%_ROOTDIR%\bin\cygrunsrv.exe" goto :eof
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        echo %_PREFIX% Stopping %%s
        %_ROOTDIR%\bin\cygrunsrv --stop %%s
    )
goto :eof

:start_services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        echo %_PREFIX% Starting %%s
        %_ROOTDIR%\bin\cygrunsrv --start %%s
    )
goto :eof

:get_setup_exe
    if not exist %_ROOTDIR% (
        echo %_PREFIX% Creating %_ROOTDIR%
        mkdir %_ROOTDIR%
    )
    echo %_PREFIX% Fetching latest setup.exe from cygwin.com
    wget --quiet -O %_ROOTDIR%\setup.exe http://cygwin.com/setup.exe
goto :eof

:setup
    echo %_PREFIX% Running setup.exe to install standard package set
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir --packages %_PACKAGES%
    echo %_PREFIX% Running setup.exe for updates
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir
goto :eof

:create_passwd
    if not exist %_ROOTDIR%\etc\passwd (
        echo %_PREFIX% Creating /etc/passwd
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd'
    )
    if not exist %_ROOTDIR%\etc\group (
        echo %_PREFIX% Creating /etc/group
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkgroup --local > /etc/group'
    )
goto :eof

:config_syslogd
    sc query syslogd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring syslogd
    if not exist %_ROOTDIR%\bin\syslogd-config (
        echo %_PREFIX% ERROR: inetutils not installed
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/syslogd-config"
goto :eof

:config_sshd
    sc query sshd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring sshd
    if not exist %_ROOTDIR%\bin\ssh-host-config (
        echo %_PREFIX% ERROR: opensshd not installed
        goto :eof
    )
    findstr /r "^sshd:" %_ROOTDIR%\etc\passwd
    if %ERRORLEVEL% EQU 0 (
        echo %_PREFIX% ERROR: sshd account found in /etc/passwd
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/ssh-host-config"
    echo %_PREFIX% Disabling reverse DNS lookup by sshd
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/sed -i -e 's/#UseDNS yes/UseDNS no/' /etc/sshd_config"
goto :eof

:config_lsa
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% EQU 0 goto :eof

    echo %_PREFIX% Configuring cyglsa
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/cyglsa-config"
goto :eof

:main
    call :check_admin ||exit /b 1
    call :get_setup_exe
    call :stop_services
    call :setup
    call :create_passwd
    call :config_syslogd
    call :config_sshd
    call :start_services
    rem Do config_lsa last so that reboot message is last
    call :config_lsa

:exit

@echo off
rem
rem Install or update Cygwin.
rem

setlocal

set _PACKAGES=cron,diffutils,inetutils,ncurses,netcat,openssh,p7zip,procps,python,rsync,screen,unzip,vim,zip,genisoimage,w3m,wodim
set _ROOTDIR=C:\cygwin
set _SITE=http://mirrors.xmission.com/cygwin
set _PREFIX=CYGWIN-SETUP:

goto :main

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
goto :eof

:stop_services
    if not exist "%_ROOTDIR%\bin\cygrunsrv.exe" goto :eof
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        echo %_PREFIX% Stopping %%s
        %_ROOTDIR%\bin\cygrunsrv --stop %%s
    )
goto :eof

:start_services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        echo %_PREFIX% Starting %%s
        %_ROOTDIR%\bin\cygrunsrv --start %%s
    )
goto :eof

:get_setup_exe
    if not exist %_ROOTDIR% (
        echo %_PREFIX% Creating %_ROOTDIR%
        mkdir %_ROOTDIR%
    )
    echo %_PREFIX% Fetching latest setup.exe from cygwin.com
    wget --quiet -O %_ROOTDIR%\setup.exe http://cygwin.com/setup.exe
goto :eof

:setup
    echo %_PREFIX% Running setup.exe for updates
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir
    echo %_PREFIX% Running setup.exe to install standard package set
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir --packages %_PACKAGES%
goto :eof

:create_passwd
    if not exist %_ROOTDIR%\etc\passwd (
        echo %_PREFIX% Creating /etc/passwd
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd'
    )
    if not exist %_ROOTDIR%\etc\group (
        echo %_PREFIX% Creating /etc/group
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkgroup --local > /etc/group'
    )
goto :eof

:config_syslogd
    sc query syslogd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring syslogd
    if not exist %_ROOTDIR%\bin\syslogd-config (
        echo %_PREFIX% ERROR: inetutils not installed
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/syslogd-config"
goto :eof

:config_sshd
    sc query sshd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring sshd
    if not exist %_ROOTDIR%\bin\ssh-host-config (
        echo %_PREFIX% ERROR: opensshd not installed
        goto :eof
    )
    findstr /r "^sshd:" %_ROOTDIR%\etc\passwd
    if %ERRORLEVEL% EQU 0 (
        echo %_PREFIX% ERROR: sshd account found in /etc/passwd
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/ssh-host-config"
    echo %_PREFIX% Disabling reverse DNS lookup by sshd
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/sed -i -e 's/#UseDNS yes/UseDNS no/' /etc/sshd_config"
goto :eof

:config_lsa
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% EQU 0 goto :eof

    echo %_PREFIX% Configuring cyglsa
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/cyglsa-config"
goto :eof

:main
    call :check_admin ||exit /b 1
    call :get_setup_exe
    call :stop_services
    call :setup
    call :create_passwd
    call :config_syslogd
    call :config_sshd
    call :start_services
    rem Do config_lsa last so that reboot message is last
    call :config_lsa

:exit

update before installing new packages

cygwin-setup.bat: update before installing new packages


@echo off

:: 32-bit builds not supported as they have not been tested.
set __BuildArch=x64
set __BuildType=Debug

:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "/?" goto Usage

if /i "%1" == "Debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "Release"   (set __BuildType=Release&shift&goto Arg_Loop)

echo Invalid commandline argument: %1
goto Usage

:ArgsDone

:BuildCoreCLR

pushd coreclr
call build.cmd %__BuildArch% %__BuildType%
IF ERRORLEVEL 1 goto Error
popd

mkdir ..\Libs\%__BuildType%\%__BuildArch%\
copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\jit\%__BuildType%\clrjit.lib ..\Libs\%__BuildType%\%__BuildArch%\
copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\utilcode\dyncrt\%__BuildType%\utilcode.lib ..\Libs\%__BuildType%\%__BuildArch%\
copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\gcinfo\%__BuildType%\gcinfo.lib ..\Libs\%__BuildType%\%__BuildArch%\
:BuildPython
cd Python\PCBuild

call get_externals.bat
IF ERRORLEVEL 1 goto Error
call .\build.bat -c %__BuildType% -p %__BuildArch__%
IF ERRORLEVEL 1 goto Error

if /i "%__BuildArch%" == "x64" set arch=amd64
set SUFFIX=
if /i "%__BuildType%" == "Debug" set SUFFIX=_d

copy %arch%\python36%SUFFIX%.lib ..\..\Libs\%__BuildType%\%__BuildArch%\

:Done
echo All built...
exit /b 0

:Error
echo something failed to build...
exit /b 1

:Usage
echo.
echo Usage:
echo %0 BuildType where:
echo.
echo BuildType can be: Debug, Release
exit /b 1

Tweak some formatting

Tweak some formatting


cmake.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX CMakeLists.txt
if errorlevel 1 exit /b 1
cmake.exe --build . --config Release
if errorlevel 1 exit /b 1
if not exist "%PREFIX%\" mkdir "%PREFIX%"
COPY bin\Release\* %PREFIX%\

add blb.bat

add blb.bat


@ECHO OFF
IF %1.==. GOTO No1
set CONFIG=%1

REM set debug parameters
REM set DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"

java -cp ..\lib\* %DEBUG_OPTS% "-Daerobase.config.dir=%CONFIG%" org.jboss.aerogear.unifiedpush.DBMaintenance > initdb-java.log 2>&1

GOTO End1

:No1
  ECHO Missing Config file
GOTO End1

:End1
@ECHO ON

@ECHO OFF
IF %1.==. GOTO No1
set CONFIG=%1

REM set debug parameters
REM set DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"

"%JAVA_HOME%\bin\java" -cp ..\lib\* %DEBUG_OPTS% "-Daerobase.config.dir=%CONFIG%" org.jboss.aerogear.unifiedpush.DBMaintenance > initdb-java.log 2>&1

GOTO End1

:No1
  ECHO Missing Config file
GOTO End1

:End1
@ECHO ON

Use JAVA_HOME for schema creation

Use JAVA_HOME for schema creation


@echo off

:: Init Script for cmd.exe
:: Created as part of cmder project

:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
:: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands

:: Use /v command line arg or set to > 0 for verbose output to aid in debugging.
set verbose_output=0
set debug_output=0
set max_depth=1

:: Find root dir
if not defined CMDER_ROOT (
    if defined ConEmuDir (
        for /f "delims=" %%i in ("%ConEmuDir%\..\..") do (
            set "CMDER_ROOT=%%~fi"
        )
    ) else (
        for /f "delims=" %%i in ("%~dp0\..") do (
            set "CMDER_ROOT=%%~fi"
        )
    )
)

:: Remove trailing '\' from %CMDER_ROOT%
if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"

call "%cmder_root%\vendor\lib\lib_base"
call "%cmder_root%\vendor\lib\lib_path"
call "%cmder_root%\vendor\lib\lib_console"
call "%cmder_root%\vendor\lib\lib_git"
call "%cmder_root%\vendor\lib\lib_profile"

:var_loop
    if "%~1" == "" (
        goto :start
    ) else if /i "%1"=="/v" (
        set verbose_output=1
    ) else if /i "%1"=="/d" (
        set debug_output=1
    ) else if /i "%1" == "/max_depth" (
        if "%~2" geq "1" if "%~2" leq "5" (
            set "max_depth=%~2"
            shift
        ) else (
            %lib_console% show_error "'/max_depth' requires a number between 1 and 5!"
            exit /b
        )
    ) else if /i "%1" == "/c" (
        if exist "%~2" (
            if not exist "%~2\bin" mkdir "%~2\bin"
            set "cmder_user_bin=%~2\bin"
            if not exist "%~2\config\profile.d" mkdir "%~2\config\profile.d"
            set "cmder_user_config=%~2\config"
            shift
        )
    ) else if /i "%1" == "/user_aliases" (
        if exist "%~2" (
            set "user_aliases=%~2"
            shift
        )
    ) else if /i "%1" == "/git_install_root" (
        if exist "%~2" (
            set "GIT_INSTALL_ROOT=%~2"
            shift
        ) else (
            %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!"
            exit /b
        )
    ) else if /i "%1" == "/home" (
        if exist "%~2" (
            set "HOME=%~2"
            shift
        ) else (
            %lib_console% show_error The home folder "%2", you specified does not exist!
            exit /b
        )
    ) else if /i "%1" == "/svn_ssh" (
        set SVN_SSH=%2
        shift
    )
    shift
goto var_loop

:start
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES
%lib_base% cmder_shell
%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%"

if defined CMDER_USER_CONFIG (
    %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!"
)

:: Pick right version of clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set architecture=86
    set architecture_bits=32
) else (
    set architecture=64
    set architecture_bits=64
)

if "%CMDER_CLINK%" == "1" (
  %lib_console% verbose_output "Injecting Clink!"

  :: Run clink
  if defined CMDER_USER_CONFIG (
    if not exist "%CMDER_USER_CONFIG%\settings" (
      echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
      echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
    )
    "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
  ) else (
    if not exist "%CMDER_ROOT%\config\settings" (
      echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
      echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
    )
    "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
  )
) else (
  %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!"
)

:: Prepare for git-for-windows

:: I do not even know, copypasted from their .bat
set PLINK_PROTOCOL=ssh
if not defined TERM set TERM=cygwin

:: The idea:
:: * if the users points as to a specific git, use that
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
:: also check that we have a recent enough version of git by examining the version string
setlocal enabledelayedexpansion
if defined GIT_INSTALL_ROOT (
    if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :SPECIFIED_GIT
)

%lib_console% debug_output init.bat "Looking for Git install root..."

:: get the version information for vendored git binary
%lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd"
%lib_git% validate_version VENDORED %GIT_VERSION_VENDORED%

:: check if git is in path...
for /F "delims=" %%F in ('where git.exe 2^>nul') do (
    :: get the absolute path to the user provided git binary
    pushd %%~dpF
    set "test_dir=!CD!"
    popd

    :: get the version information for the user provided git binary
    %lib_git% read_version USER "!test_dir!"
    %lib_git% validate_version USER !GIT_VERSION_USER!

    if !errorlevel! geq 0 (
        :: compare the user git version against the vendored version
        %lib_git% compare_versions USER VENDORED

        :: use the user provided git if its version is greater than, or equal to the vendored git
        if !errorlevel! geq 0 if exist "!test_dir:~0,-4!\cmd\git.exe" (
            set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
            set test_dir=
            goto :FOUND_GIT
        ) else if !errorlevel! geq 0 (
            set "GIT_INSTALL_ROOT=!test_dir!"
            set test_dir=
            goto :FOUND_GIT
        ) else (
            call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using...
            set test_dir=
        )
    ) else (

        :: if the user provided git executable is not found
        if !errorlevel! equ -255 (
            call :verbose_output No git at "!git_executable!" found.
            set test_dir=
        )

    )
)

:: our last hope: our own git...
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
    %lib_console% debug_output "Using vendored Git from '!GIT_INSTALL_ROOT!..."
    %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd"
    goto :CONFIGURE_GIT
) else (
    goto :NO_GIT
)

:SPECIFIED_GIT
%lib_console% debug_output "Using /GIT_INSTALL_ROOT from '%GIT_INSTALL_ROOT%..."
goto :CONFIGURE_GIT

:FOUND_GIT
%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..."
goto :CONFIGURE_GIT

:CONFIGURE_GIT
:: Add git to the path
if defined GIT_INSTALL_ROOT (
    rem add the unix commands at the end to not shadow windows commands like more
    if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" append
    if exist "!GIT_INSTALL_ROOT!\mingw32" (
        %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32" append
    ) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
        %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64" append
    )
    %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append

    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"

    for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do (
        set "LANG=%%F"
    )
)

endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'"
goto :PATH_ENHANCE

:NO_GIT
:: Skip this if GIT WAS FOUND else we did 'endlocal' above!
endlocal

:PATH_ENHANCE
%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin"
%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth%
if defined CMDER_USER_BIN (
  %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth%
)
%lib_path% enhance_path "%CMDER_ROOT%" append

:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
:: to run them at startup.
%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d"
if defined CMDER_USER_CONFIG (
  %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
)

:: Allows user to override default aliases store using profile.d
:: scripts run above by setting the 'aliases' env variable.
::
:: Note: If overriding default aliases store file the aliases
:: must also be self executing, see '.\user_aliases.cmd.example',
:: and be in profile.d folder.
if not defined user_aliases (
  if defined CMDER_USER_CONFIG (
     set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd"
  ) else (
     set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd"
  )
)

if "%CMDER_ALIASES%" == "1" (
  REM The aliases environment variable is used by alias.bat to id
  REM the default file to store new aliases in.
  if not defined aliases (
    set "aliases=%user_aliases%"
  )

  REM Make sure we have a self-extracting user_aliases.cmd file
  setlocal enabledelayedexpansion
  if not exist "%user_aliases%" (
      echo Creating initial user_aliases store in "%user_aliases%"...
      copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
  ) else (
      type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul
      if "!errorlevel!" == "1" (
          echo Creating initial user_aliases store in "%user_aliases%"...
          if defined CMDER_USER_CONFIG (
              copy "%user_aliases%" "%user_aliases%.old_format"
              copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
          ) else (
              copy "%user_aliases%" "%user_aliases%.old_format"
              copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
          )
      )
  )

  :: Update old 'user_aliases' to new self executing 'user_aliases.cmd'
  if exist "%CMDER_ROOT%\config\aliases" (
    echo Updating old "%CMDER_ROOT%\config\aliases" to new format...
    type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%"
    del "%CMDER_ROOT%\config\aliases"
  ) else if exist "%user_aliases%.old_format" (
    echo Updating old "%user_aliases%" to new format...
    type "%user_aliases%.old_format" >> "%user_aliases%"
    del "%user_aliases%.old_format"
  )
  endlocal
)

:: Add aliases to the environment
call "%user_aliases%"

:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
    %lib_console% verbose_output "Running Git for Windows one time Post Install...."
    pushd "%GIT_INSTALL_ROOT%\"
    "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
    popd
)

:: Set home path
if not defined HOME set "HOME=%USERPROFILE%"
%lib_console% debug_output init.bat "Env Var - HOME=%HOME%"

set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
    REM Create this file and place your own command in there
    call "%CMDER_ROOT%\config\user_profile.cmd"
)

if defined CMDER_USER_CONFIG (
  set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
  if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
      REM Create this file and place your own command in there
      call "%CMDER_USER_CONFIG%\user_profile.cmd"
  )
)

if not exist "%initialConfig%" (
    echo Creating user startup file: "%initialConfig%"
    (
echo :: use this file to run your own startup commands
echo :: use in front of the command to prevent printing the command
echo.
echo :: uncomment this to have the ssh agent load when cmder starts
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
echo.
echo :: uncomment the next two lines to use pageant as the ssh authentication agent
echo :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-pageant.cmd"
echo.
echo :: you can add your plugins to the cmder path like so
echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
echo.
echo @echo off
) >"%initialConfig%"
)

if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" (
  echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd'
  echo to get rid of this message either:
  echo.
  echo Delete the file '%CMDER_ROOT%\bin\alias.bat'
  echo.
  echo or
  echo.
  echo If you have customized it and want to continue using it instead of the included version
  echo   * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'.
  echo   * Search for 'user-aliases' and replace it with 'user_aliases'.
)

set initialConfig=
set CMDER_CONFIGURED=1

exit /b

@echo off

:: Init Script for cmd.exe
:: Created as part of cmder project

:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
:: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands

:: Use /v command line arg or set to > 0 for verbose output to aid in debugging.
set verbose_output=0
set debug_output=0
set max_depth=1

:: Find root dir
if not defined CMDER_ROOT (
    if defined ConEmuDir (
        for /f "delims=" %%i in ("%ConEmuDir%\..\..") do (
            set "CMDER_ROOT=%%~fi"
        )
    ) else (
        for /f "delims=" %%i in ("%~dp0\..") do (
            set "CMDER_ROOT=%%~fi"
        )
    )
)

:: Remove trailing '\' from %CMDER_ROOT%
if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"

call "%cmder_root%\vendor\lib\lib_base"
call "%cmder_root%\vendor\lib\lib_path"
call "%cmder_root%\vendor\lib\lib_console"
call "%cmder_root%\vendor\lib\lib_git"
call "%cmder_root%\vendor\lib\lib_profile"

:var_loop
    if "%~1" == "" (
        goto :start
    ) else if /i "%1"=="/v" (
        set verbose_output=1
    ) else if /i "%1"=="/d" (
        set debug_output=1
    ) else if /i "%1" == "/max_depth" (
        if "%~2" geq "1" if "%~2" leq "5" (
            set "max_depth=%~2"
            shift
        ) else (
            %lib_console% show_error "'/max_depth' requires a number between 1 and 5!"
            exit /b
        )
    ) else if /i "%1" == "/c" (
        if exist "%~2" (
            if not exist "%~2\bin" mkdir "%~2\bin"
            set "cmder_user_bin=%~2\bin"
            if not exist "%~2\config\profile.d" mkdir "%~2\config\profile.d"
            set "cmder_user_config=%~2\config"
            shift
        )
    ) else if /i "%1" == "/user_aliases" (
        if exist "%~2" (
            set "user_aliases=%~2"
            shift
        )
    ) else if /i "%1" == "/git_install_root" (
        if exist "%~2" (
            set "GIT_INSTALL_ROOT=%~2"
            shift
        ) else (
            %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!"
            exit /b
        )
    ) else if /i "%1" == "/home" (
        if exist "%~2" (
            set "HOME=%~2"
            shift
        ) else (
            %lib_console% show_error The home folder "%2", you specified does not exist!
            exit /b
        )
    ) else if /i "%1" == "/svn_ssh" (
        set SVN_SSH=%2
        shift
    )
    shift
goto var_loop

:start
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES
%lib_base% cmder_shell
%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%"

if defined CMDER_USER_CONFIG (
    %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!"
)

:: Pick right version of clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set architecture=86
    set architecture_bits=32
) else (
    set architecture=64
    set architecture_bits=64
)

if "%CMDER_CLINK%" == "1" (
  %lib_console% verbose_output "Injecting Clink!"

  :: Run clink
  if defined CMDER_USER_CONFIG (
    if not exist "%CMDER_USER_CONFIG%\settings" (
      echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
      echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
    )
    "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
  ) else (
    if not exist "%CMDER_ROOT%\config\settings" (
      echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
      echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
    )
    "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
  )
) else (
  %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!"
)

:: Prepare for git-for-windows

:: I do not even know, copypasted from their .bat
set PLINK_PROTOCOL=ssh
if not defined TERM set TERM=cygwin

:: The idea:
:: * if the users points as to a specific git, use that
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
:: also check that we have a recent enough version of git by examining the version string
setlocal enabledelayedexpansion
if defined GIT_INSTALL_ROOT (
    if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :SPECIFIED_GIT
)

%lib_console% debug_output init.bat "Looking for Git install root..."

:: get the version information for vendored git binary
%lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd"
%lib_git% validate_version VENDORED %GIT_VERSION_VENDORED%

:: check if git is in path...
for /F "delims=" %%F in ('where git.exe 2^>nul') do (
    :: get the absolute path to the user provided git binary
    pushd %%~dpF
    set "test_dir=!CD!"
    popd

    :: get the version information for the user provided git binary
    %lib_git% read_version USER "!test_dir!"
    %lib_git% validate_version USER !GIT_VERSION_USER!

    if !errorlevel! geq 0 (
        :: compare the user git version against the vendored version
        %lib_git% compare_versions USER VENDORED

        :: use the user provided git if its version is greater than, or equal to the vendored git
        if !errorlevel! geq 0 if exist "!test_dir:~0,-4!\cmd\git.exe" (
            set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
            set test_dir=
            goto :FOUND_GIT
        ) else if !errorlevel! geq 0 (
            set "GIT_INSTALL_ROOT=!test_dir!"
            set test_dir=
            goto :FOUND_GIT
        ) else (
            call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using...
            set test_dir=
        )
    ) else (

        :: if the user provided git executable is not found
        if !errorlevel! equ -255 (
            call :verbose_output No git at "!git_executable!" found.
            set test_dir=
        )

    )
)

:: our last hope: our own git...
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
    %lib_console% debug_output "Using vendored Git from '!GIT_INSTALL_ROOT!..."
    %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd"
    goto :CONFIGURE_GIT
) else (
    goto :NO_GIT
)

:SPECIFIED_GIT
%lib_console% debug_output "Using /GIT_INSTALL_ROOT from '%GIT_INSTALL_ROOT%..."
goto :CONFIGURE_GIT

:FOUND_GIT
%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..."
goto :CONFIGURE_GIT

:CONFIGURE_GIT
:: Add git to the path
if defined GIT_INSTALL_ROOT (
    rem add the unix commands at the end to not shadow windows commands like more
    if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" append
    if exist "!GIT_INSTALL_ROOT!\mingw32" (
        %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" append
    ) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
        %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" append
    )
    %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append

    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"

    for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do (
        set "LANG=%%F"
    )
)

endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'"
goto :PATH_ENHANCE

:NO_GIT
:: Skip this if GIT WAS FOUND else we did 'endlocal' above!
endlocal

:PATH_ENHANCE
%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin"
%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth%
if defined CMDER_USER_BIN (
  %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth%
)
%lib_path% enhance_path "%CMDER_ROOT%" append

:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
:: to run them at startup.
%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d"
if defined CMDER_USER_CONFIG (
  %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
)

:: Allows user to override default aliases store using profile.d
:: scripts run above by setting the 'aliases' env variable.
::
:: Note: If overriding default aliases store file the aliases
:: must also be self executing, see '.\user_aliases.cmd.example',
:: and be in profile.d folder.
if not defined user_aliases (
  if defined CMDER_USER_CONFIG (
     set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd"
  ) else (
     set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd"
  )
)

if "%CMDER_ALIASES%" == "1" (
  REM The aliases environment variable is used by alias.bat to id
  REM the default file to store new aliases in.
  if not defined aliases (
    set "aliases=%user_aliases%"
  )

  REM Make sure we have a self-extracting user_aliases.cmd file
  setlocal enabledelayedexpansion
  if not exist "%user_aliases%" (
      echo Creating initial user_aliases store in "%user_aliases%"...
      copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
  ) else (
      type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul
      if "!errorlevel!" == "1" (
          echo Creating initial user_aliases store in "%user_aliases%"...
          if defined CMDER_USER_CONFIG (
              copy "%user_aliases%" "%user_aliases%.old_format"
              copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
          ) else (
              copy "%user_aliases%" "%user_aliases%.old_format"
              copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
          )
      )
  )

  :: Update old 'user_aliases' to new self executing 'user_aliases.cmd'
  if exist "%CMDER_ROOT%\config\aliases" (
    echo Updating old "%CMDER_ROOT%\config\aliases" to new format...
    type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%"
    del "%CMDER_ROOT%\config\aliases"
  ) else if exist "%user_aliases%.old_format" (
    echo Updating old "%user_aliases%" to new format...
    type "%user_aliases%.old_format" >> "%user_aliases%"
    del "%user_aliases%.old_format"
  )
  endlocal
)

:: Add aliases to the environment
call "%user_aliases%"

:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
    %lib_console% verbose_output "Running Git for Windows one time Post Install...."
    pushd "%GIT_INSTALL_ROOT%\"
    "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
    popd
)

:: Set home path
if not defined HOME set "HOME=%USERPROFILE%"
%lib_console% debug_output init.bat "Env Var - HOME=%HOME%"

set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
    REM Create this file and place your own command in there
    call "%CMDER_ROOT%\config\user_profile.cmd"
)

if defined CMDER_USER_CONFIG (
  set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
  if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
      REM Create this file and place your own command in there
      call "%CMDER_USER_CONFIG%\user_profile.cmd"
  )
)

if not exist "%initialConfig%" (
    echo Creating user startup file: "%initialConfig%"
    (
echo :: use this file to run your own startup commands
echo :: use in front of the command to prevent printing the command
echo.
echo :: uncomment this to have the ssh agent load when cmder starts
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
echo.
echo :: uncomment the next two lines to use pageant as the ssh authentication agent
echo :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-pageant.cmd"
echo.
echo :: you can add your plugins to the cmder path like so
echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
echo.
echo @echo off
) >"%initialConfig%"
)

if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" (
  echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd'
  echo to get rid of this message either:
  echo.
  echo Delete the file '%CMDER_ROOT%\bin\alias.bat'
  echo.
  echo or
  echo.
  echo If you have customized it and want to continue using it instead of the included version
  echo   * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'.
  echo   * Search for 'user-aliases' and replace it with 'user_aliases'.
)

set initialConfig=
set CMDER_CONFIGURED=1

exit /b

Update init.bat

Update init.bat


cd testsrc
ghc --make -package FilePath -package mtl -package HUnit -fallow-overlapping-instances -fallow-undecidable-instances -fglasgow-exts -cpp -o runtests.exe -i..\dist\build:..\src runtests.hs
cd ..
testsrc\runtests

Make wintest.bat actually run the tests

Make wintest.bat actually run the tests


:: Start with bootstrap
call bootstrap.bat
if errorlevel 1 exit 1

:: Build step
.\b2 install ^
    --build-dir=buildboost ^
    --prefix=%LIBRARY_PREFIX% ^
    toolset=msvc-%VS_MAJOR%.0 ^
    address-model=%ARCH% ^
    variant=release ^
    threading=multi ^
    link=static,shared ^
    --without-python
if errorlevel 1 exit 1

:: Get the major minor version info (e.g. `1_61`)
python -c "import os; print('_'.join(os.environ['PKG_VERSION'].split('.')[:2]))" > temp.txt
set /p MAJ_MIN_VER=<temp.txt

:: Install fix-up for a non version-specific boost include
move %LIBRARY_INC%\boost-%MAJ_MIN_VER%\boost %LIBRARY_INC%
if errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
move %LIBRARY_LIB%\*vc%VS_MAJOR%0-mt-%MAJ_MIN_VER%.dll "%LIBRARY_BIN%"
if errorlevel 1 exit 1

:: Start with bootstrap
call bootstrap.bat
if errorlevel 1 exit 1

:: Build step
.\b2 install ^
    --build-dir=buildboost ^
    --prefix=%LIBRARY_PREFIX% ^
    toolset=msvc-%VS_MAJOR%.0 ^
    address-model=%ARCH% ^
    variant=release ^
    threading=multi ^
    link=static,shared ^
    -j%CPU_COUNT% ^
    --without-python
if errorlevel 1 exit 1

:: Get the major minor version info (e.g. `1_61`)
python -c "import os; print('_'.join(os.environ['PKG_VERSION'].split('.')[:2]))" > temp.txt
set /p MAJ_MIN_VER=<temp.txt

:: Install fix-up for a non version-specific boost include
move %LIBRARY_INC%\boost-%MAJ_MIN_VER%\boost %LIBRARY_INC%
if errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
move %LIBRARY_LIB%\*vc%VS_MAJOR%0-mt-%MAJ_MIN_VER%.dll "%LIBRARY_BIN%"
if errorlevel 1 exit 1

Add missing -jCPU_COUNT

Add missing -jCPU_COUNT


echo Extend drive C to maximum
echo select volume 2 >%TEMP%\extendC.txt
echo extend >>%TEMP%\extendC.txt
diskpart.exe /s %TEMP%\extendC.txt
set WORKDRIVE=C:

echo Ensuring .NET 4.0 is installed
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/StefanScherer/arduino-ide/install/InstallNet4.ps1'))"
echo Installing Chocolatey
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

if "%ChocolateyInstall%x"=="x" set ChocolateyInstall=%SystemDrive%\Chocolatey
where cinst
if ERRORLEVEL 1 goto set_chocolatey
goto inst
:set_chocolatey
set PATH=%PATH%;%ChocolateyInstall%\bin
:inst

call cinst wget

call cinst msysgit
where git
if ERRORLEVEL 1 call :addGitToUserPath
goto GIT_DONE
:addGitToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\Git\cmd" /f
set PATH=%PATH%;C:\Program Files (x86)\Git\cmd
exit /b
:GIT_DONE

set ROECLOUDSRV001=roecloudsrv001.sealsystems.local
set ROECLOUDSRV001=10.100.100.101

call cinst packer
where packer
if ERRORLEVEL 1 call :addPackerToUserPath
goto PACKER_DONE
:addPackerToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\hashicorp\packer" /f
set PATH=%PATH%;C:\hashicorp\packer
exit /b
:PACKER_DONE
call cinst packer-post-processor-vagrant-vmware-ovf

netsh advfirewall firewall add name="packer-builder-vmware-iso" dir=in program="c:\HashiCorp\packer\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add name="packer-builder-virtualbox-iso" dir=in program="c:\HashiCorp\packer\packer-builder-virtualbox-iso.exe" action=allow

echo Install VMware Workstation...
rem Install VMware Workstation
if not exist "%USERPROFILE%\AppData\Roaming\VMWare\preferences.ini" (
  if not exist "%USERPROFILE%\AppData\Roaming\VMWare" mkdir "%USERPROFILE%\AppData\Roaming\VMWare"
  call wget --no-check-certificate -O "%USERPROFILE%\AppData\Roaming\VMWare\preferences.ini" https://raw.github.com/StefanScherer/basebox-slave/master/preferences.ini
)
if not exist "c:\Program Files (x86)\VMware\VMware Workstation" (
  if not exist "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" (
    call wget --no-verbose -O "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" http://%ROECLOUDSRV001%/vmware/workstation10/VMware-workstation-full-10.0.0-1295980.exe
  )
  rem "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" /s /nsr /v EULAS_AGREED=1 SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
  "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" /s /nsr /v EULAS_AGREED=1
  del "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe"
)

cd %WORKDRIVE%\GitHub\packer-windows
packer --version

echo Extend drive C to maximum
echo select volume 2 >%TEMP%\extendC.txt
echo extend >>%TEMP%\extendC.txt
diskpart.exe /s %TEMP%\extendC.txt
set WORKDRIVE=C:

echo Ensuring .NET 4.0 is installed
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/StefanScherer/arduino-ide/install/InstallNet4.ps1'))"
echo Installing Chocolatey
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

if "%ChocolateyInstall%x"=="x" set ChocolateyInstall=%SystemDrive%\Chocolatey
where cinst
if ERRORLEVEL 1 goto set_chocolatey
goto inst
:set_chocolatey
set PATH=%PATH%;%ChocolateyInstall%\bin
:inst

call cinst wget

call cinst msysgit
where git
if ERRORLEVEL 1 call :addGitToUserPath
goto GIT_DONE
:addGitToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\Git\cmd" /f
set PATH=%PATH%;C:\Program Files (x86)\Git\cmd
exit /b
:GIT_DONE

set ROECLOUDSRV001=roecloudsrv001.sealsystems.local
set ROECLOUDSRV001=10.100.100.101

call cinst packer
where packer
if ERRORLEVEL 1 call :addPackerToUserPath
goto PACKER_DONE
:addPackerToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\hashicorp\packer" /f
set PATH=%PATH%;C:\hashicorp\packer
exit /b
:PACKER_DONE
call cinst packer-post-processor-vagrant-vmware-ovf

netsh advfirewall firewall add name="packer-builder-vmware-iso" dir=in program="c:\HashiCorp\packer\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add name="packer-builder-virtualbox-iso" dir=in program="c:\HashiCorp\packer\packer-builder-virtualbox-iso.exe" action=allow

echo Install VMware Workstation...
rem Install VMware Workstation
if not exist "%USERPROFILE%\AppData\Roaming\VMWare\preferences.ini" (
  if not exist "%USERPROFILE%\AppData\Roaming\VMWare" mkdir "%USERPROFILE%\AppData\Roaming\VMWare"
  copy c:\vagrant\preferences.ini "%USERPROFILE%\AppData\Roaming\VMWare\preferences.ini"
)
if not exist "c:\Program Files (x86)\VMware\VMware Workstation" (
  if not exist "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" (
    call wget --no-verbose -O "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" http://%ROECLOUDSRV001%/vmware/workstation10/VMware-workstation-full-10.0.0-1295980.exe
  )
  rem "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" /s /nsr /v EULAS_AGREED=1 SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
  "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe" /s /nsr /v EULAS_AGREED=1
  del "%TEMP%\VMware-workstation-full-10.0.0-1295980.exe"
)

use synced folder for local repo files

use synced folder for local repo files


cd /d "%~dp0"
cd ..
rmdir /s /q install
rmdir /s /q build
mkdir build
cd build
cmake .. -G "Visual Studio 12" "-DCMAKE_INSTALL_PREFIX=%WORKSPACE%\install" %*
cmake --build . --config Debug
cmake --build . --config RelWithDebInfo

call "%WORKSPACE%\vendor\jenkins-ctest-plugin\run-test-and-save.bat" -C Debug
call "%WORKSPACE%\vendor\jenkins-ctest-plugin\run-test-and-save.bat" -C RelWithDebInfo

cmake --build . --config Debug --target INSTALL
cmake --build . --config RelWithDebInfo --target INSTALL

cmake --build . --config RelWithDebInfo --target ogvrPluginKit -- /p:RunCodeAnalysis=True

rem bin\Debug\LoadTest.exe --gtest_output=xml:test_details.Debug.xml
rem bin\RelWithDebInfo\LoadTest.exe --gtest_output=xml:test_details.RelWithDebInfo.xml

pause

cd /d "%~dp0"
cd ..
rmdir /s /q install
rmdir /s /q build
mkdir build
cd build
cmake .. -G "Visual Studio 12" "-DCMAKE_INSTALL_PREFIX=%WORKSPACE%\install" -DCPACK_GENERATOR=ZIP %*
cmake --build . --config Debug
cmake --build . --config RelWithDebInfo

rem Build external docs for packaging.
cmake --build . --config RelWithDebInfo --target doc_external

call "%WORKSPACE%\vendor\jenkins-ctest-plugin\run-test-and-save.bat" -C Debug
call "%WORKSPACE%\vendor\jenkins-ctest-plugin\run-test-and-save.bat" -C RelWithDebInfo

cmake --build . --config Debug --target INSTALL
cmake --build . --config RelWithDebInfo --target INSTALL

cmake --build . --config RelWithDebInfo --target ogvrPluginKit -- /p:RunCodeAnalysis=True

cmake --build . --config RelWithDebInfo --target PACKAGE

rem bin\Debug\LoadTest.exe --gtest_output=xml:test_details.Debug.xml
rem bin\RelWithDebInfo\LoadTest.exe --gtest_output=xml:test_details.RelWithDebInfo.xml

pause

Update cibuild script.

Update cibuild script.


:: Copyright 2015 Rouslan Solomakhin
::
:: Licensed under the Apache License, Version 2.0 (the "License")
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::     http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

set ALTERNATE_EDITOR=emacs
set EDITOR=emacs
set GYP_DEFINES=component=shared_library fastbuild=2 disable_nacl=1 disable_pnacl=1
set GYP_GENERATORS=ninja
set HOME=%USERPROFILE%
set JAVA_HOME=%SYSTEMDRIVE%\java\jdk

doskey e=start /b emacsclient.exe $*
doskey v=start /b gvim.exe $*

if not "%PATH%" == "%PATH:depot_tools=%" (
  goto skip_path
)

for /d %%g in (%SYSTEMDRIVE%\src\depot_tools\git*chromium*) do set PATH=%PATH%;%%g\cmd
set PATH=%PATH%;%HOME%\.third_party\cask\bin
set PATH=%PATH%;%JAVA_HOME%\bin
set PATH=%PATH%;%SYSTEMDRIVE%\console2
set PATH=%PATH%;%SYSTEMDRIVE%\emacs\bin
set PATH=%PATH%;%SYSTEMDRIVE%\Go\bin
set PATH=%PATH%;%SYSTEMDRIVE%\go_appengine
set PATH=%PATH%;%SYSTEMDRIVE%\maven\bin
set PATH=%PATH%;%SYSTEMDRIVE%\Program Files (x86)\Vim\vim74
set PATH=%PATH%;%SYSTEMDRIVE%\src\depot_tools

:skip_path

where cl > NUL 2>&1
if errorlevel 1 (
  if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
    call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
  )
)

if not exist c:\src\depot_tools\win_toolchain\vs2013_files (
  set DEPOT_TOOLS_WIN_TOOLCHAIN=0
)

if exist local-env.bat (
  call local-env.bat
)

:: Copyright 2015 Rouslan Solomakhin
::
:: Licensed under the Apache License, Version 2.0 (the "License")
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::     http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

set ALTERNATE_EDITOR=emacs
set EDITOR=emacs
set GYP_DEFINES=component=shared_library fastbuild=2 disable_nacl=1 disable_pnacl=1
set GYP_GENERATORS=ninja
set HOME=%USERPROFILE%
set JAVA_HOME=%SYSTEMDRIVE%\java\jdk
set GOPATH=%SYSTEMDRIVE%\src\go

doskey e=start /b emacsclient.exe $*
doskey v=start /b gvim.exe $*

if not "%PATH%" == "%PATH:depot_tools=%" (
  goto skip_path
)

for /d %%g in (%SYSTEMDRIVE%\src\depot_tools\git*chromium*) do set PATH=%PATH%;%%g\cmd
set PATH=%PATH%;%GOPATH%\bin
set PATH=%PATH%;%HOME%\.third_party\cask\bin
set PATH=%PATH%;%JAVA_HOME%\bin
set PATH=%PATH%;%SYSTEMDRIVE%\console2
set PATH=%PATH%;%SYSTEMDRIVE%\emacs\bin
set PATH=%PATH%;%SYSTEMDRIVE%\Go\bin
set PATH=%PATH%;%SYSTEMDRIVE%\go_appengine
set PATH=%PATH%;%SYSTEMDRIVE%\maven\bin
set PATH=%PATH%;%SYSTEMDRIVE%\Program Files (x86)\Vim\vim74
set PATH=%PATH%;%SYSTEMDRIVE%\src\depot_tools

:skip_path

where cl > NUL 2>&1
if errorlevel 1 (
  if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
    call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
  )
)

if not exist c:\src\depot_tools\win_toolchain\vs2013_files (
  set DEPOT_TOOLS_WIN_TOOLCHAIN=0
)

if exist local-env.bat (
  call local-env.bat
)

Add gopath.

Add gopath.