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

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF NOT DEFINED MSBUILD_PATH (
  SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

echo Handling ASP.NET 5 Web Application deployment.

:: Remove wwwroot if deploying to default location
IF "%DEPLOYMENT_TARGET%" == "%WEBROOT_PATH%" (
    FOR /F %%i IN ("%DEPLOYMENT_TARGET%") DO IF "%%~nxi"=="wwwroot" (
    SET DEPLOYMENT_TARGET=%%~dpi
    )
)

:: Remove trailing slash if present
IF "%DEPLOYMENT_TARGET:~-1%"=="\" (
    SET DEPLOYMENT_TARGET=%DEPLOYMENT_TARGET:~0,-1%
)

:: 1. Set DNX Path
set DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
set DNX_RUNTIME="%USERPROFILE%\.dnx\runtimes\dnx-CLR-win-x86.1.0.0-beta6"

:: 2. Install DNX
call :ExecuteCmd PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install 1.0.0-beta6 -arch x86 -r CLR %SCM_DNVM_INSTALL_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 3. Run DNU Restore
call %DNX_RUNTIME%\bin\dnu restore "%DEPLOYMENT_SOURCE%" %SCM_DNU_RESTORE_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 4. Run DNU Publish
call %DNX_RUNTIME%\bin\dnu publish "D:\home\site\repository\src\live.asp.net\project.json" --no-source --configuration Release --runtime %DNX_RUNTIME% --out "%DEPLOYMENT_TEMP%" %SCM_DNU_PUBLISH_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 5. KuduSync
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

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: 0.1.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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

:: Explicitly override MSBUILD_PATH to use C# 6.0 compatible compiler.
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe

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

echo Handling ASP.NET 5 Web Application deployment.

:: Remove wwwroot if deploying to default location
IF "%DEPLOYMENT_TARGET%" == "%WEBROOT_PATH%" (
    FOR /F %%i IN ("%DEPLOYMENT_TARGET%") DO IF "%%~nxi"=="wwwroot" (
    SET DEPLOYMENT_TARGET=%%~dpi
    )
)

:: Remove trailing slash if present
IF "%DEPLOYMENT_TARGET:~-1%"=="\" (
    SET DEPLOYMENT_TARGET=%DEPLOYMENT_TARGET:~0,-1%
)

:: 1. Set DNX Path
set DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
set DNX_RUNTIME="%USERPROFILE%\.dnx\runtimes\dnx-CLR-win-x86.1.0.0-beta6"

:: 2. Install DNX
call :ExecuteCmd PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install 1.0.0-beta6 -arch x86 -r CLR %SCM_DNVM_INSTALL_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 3. Run DNU Restore
call %DNX_RUNTIME%\bin\dnu restore "%DEPLOYMENT_SOURCE%" %SCM_DNU_RESTORE_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 4. Run DNU Publish
call %DNX_RUNTIME%\bin\dnu publish "D:\home\site\repository\src\live.asp.net\project.json" --no-source --configuration Release --runtime %DNX_RUNTIME% --out "%DEPLOYMENT_TEMP%" %SCM_DNU_PUBLISH_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 5. KuduSync
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

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.

Use C# 6.0 compiler

Use C# 6.0 compiler

deploy.cmd is updated to use a msbuild verision that is C# 6.0 compatible
because 'Add to Google Calendar' (Issue #26) uses interpolated strings.


@setlocal
@set canclon12=1
@IF %gitstate% EQU 0 set canclon12=0
@if %cmakestate% EQU 0 set canclon12=0
@IF %canclon12% EQU 1 set /p buildclon12=Build Microsoft OpenCL over D3D12 driver (y/n):
@IF %canclon12% EQU 1 echo.
@IF /I NOT "%buildclon12%"=="y" GOTO skipclon12
@IF EXIST "%devroot%\clon12\" (
@echo Updating CLonD3D12 ICD source code...
@cd %devroot%\clon12
@git pull -v --progress --recurse-submodules origin
)
@IF NOT EXIST "%devroot%\clon12\" (
@echo Getting CLonD3D12 ICD source code...
@git clone https://github.com/microsoft/OpenCLOn12 %devroot%\clon12
)
@echo.

@rem Ask for Ninja use if exists. Load it if opted for it.
@set ninja=n
@if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain, faster and more efficient build:
@if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%devroot%\ninja\;%PATH%

@rem Load cmake into build environment.
@if %cmakestate%==1 set PATH=%devroot%\cmake\bin\;%PATH%

@rem Construct build configuration command.
@set buildconf=cmake %devroot:\=/%/clon12 -G
@if /I NOT "%ninja%"=="y" set buildconf=%buildconf% "Visual Studio %toolset%"
@if %abi%==x86 if /I NOT "%ninja%"=="y" set buildconf=%buildconf% -A Win32
@if %abi%==x64 if /I NOT "%ninja%"=="y" set buildconf=%buildconf% -A x64
@if /I NOT "%ninja%"=="y" IF /I %PROCESSOR_ARCHITECTURE%==AMD64 set buildconf=%buildconf% -Thost=x64
@if /I "%ninja%"=="y" set buildconf=%buildconf%Ninja
@set buildconf=%buildconf% -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="%devroot:\=/%/clon12/build/%abi%"

@echo CLonD3D12 build configuration command^: %buildconf%
@echo.

@rem Always clean build
@cd %devroot%\clon12
@pause
@echo.
@echo Cleanning CLonD3D12 build. Please wait...
@echo.
@if EXIST "build\%abi%\" RD /S /Q build\%abi%
@if EXIST "out\%abi%\" RD /S /Q out\%abi%
@if NOT EXIST "out\" md out
@md out\%abi%
@cd out\%abi%
@pause
@echo.

@rem Load Visual Studio environment. Can only be loaded in the background when using MsBuild.
@if /I "%ninja%"=="y" call %vsenv% %vsabi%
@if /I "%ninja%"=="y" cd %devroot%\clon12\out\%abi%
@if /I "%ninja%"=="y" echo.

@rem Configure and execute the build with the configuration made above.
@%buildconf%
@echo.
@pause
@echo.
@if /I NOT "%ninja%"=="y" cmake --build . -j %throttle% --config Release --target install
@if /I "%ninja%"=="y" ninja -j %throttle% install
@echo.

:skipspvtools
@rem Reset environment after CLonD3D12 build.
@endlocal
@cd %devroot%

@setlocal
@set canclon12=1
@IF %gitstate% EQU 0 set canclon12=0
@if %cmakestate% EQU 0 set canclon12=0
@IF %canclon12% EQU 1 set /p buildclon12=Build Microsoft OpenCL over D3D12 driver (y/n):
@IF %canclon12% EQU 1 echo.
@IF /I NOT "%buildclon12%"=="y" GOTO skipclon12
@IF EXIST "%devroot%\clon12\" (
@echo Updating CLonD3D12 ICD source code...
@cd %devroot%\clon12
@git pull -v --progress --recurse-submodules origin
)
@IF NOT EXIST "%devroot%\clon12\" (
@echo Getting CLonD3D12 ICD source code...
@git clone https://github.com/microsoft/OpenCLOn12 %devroot%\clon12
)
@echo.

@rem Ask for Ninja use if exists. Load it if opted for it.
@set ninja=n
@if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain, faster and more efficient build:
@if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%devroot%\ninja\;%PATH%

@rem Load cmake into build environment.
@if %cmakestate%==1 set PATH=%devroot%\cmake\bin\;%PATH%

@rem Construct build configuration command.
@set buildconf=cmake %devroot:\=/%/clon12 -G
@if /I NOT "%ninja%"=="y" set buildconf=%buildconf% "Visual Studio %toolset%"
@if %abi%==x86 if /I NOT "%ninja%"=="y" set buildconf=%buildconf% -A Win32
@if %abi%==x64 if /I NOT "%ninja%"=="y" set buildconf=%buildconf% -A x64
@if /I NOT "%ninja%"=="y" IF /I %PROCESSOR_ARCHITECTURE%==AMD64 set buildconf=%buildconf% -Thost=x64
@if /I "%ninja%"=="y" set buildconf=%buildconf%Ninja -DCMAKE_BUILD_TYPE=Release
@set buildconf=%buildconf% -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="%devroot:\=/%/clon12/build/%abi%"

@echo CLonD3D12 build configuration command^: %buildconf%
@echo.

@rem Always clean build
@cd %devroot%\clon12
@pause
@echo.
@echo Cleanning CLonD3D12 build. Please wait...
@echo.
@if EXIST "build\%abi%\" RD /S /Q build\%abi%
@if EXIST "out\%abi%\" RD /S /Q out\%abi%
@if NOT EXIST "out\" md out
@md out\%abi%
@cd out\%abi%
@pause
@echo.

@rem Load Visual Studio environment. Can only be loaded in the background when using MsBuild.
@if /I "%ninja%"=="y" call %vsenv% %vsabi%
@if /I "%ninja%"=="y" cd %devroot%\clon12\out\%abi%
@if /I "%ninja%"=="y" echo.

@rem Configure and execute the build with the configuration made above.
@%buildconf%
@echo.
@pause
@echo.
@if /I NOT "%ninja%"=="y" cmake --build . -j %throttle% --config Release
@if /I "%ninja%"=="y" ninja -j %throttle%
@echo.

@rem Avoid race condition in SPIRV Tools sources checkout.
@pause
@echo.

:skipclon12
@rem Reset environment after CLonD3D12 build.
@endlocal
@cd %devroot%

Apply some corrections to CLonD3D12 build


@ECHO OFF
md buildtmp
::copy localconfig.lua.dist "%~dp0\buildtmp\localconfig.lua"
copy readme.md "%~dp0\buildtmp\readme.txt"
"D:\Program Files\7-Zip\7z" -r a -tzip .\buildtmp\game.love .\love2d\*.*
copy "buildmaterial\lovewin64\*.*" "buildtmp\"
copy /b "buildtmp\love.exe"+"buildtmp\game.love" "buildtmp\tm.exe"
del ".\buildtmp\game.love"
del ".\buildtmp\love.exe"
"D:\Program Files\7-Zip\7z" -r a -tzip .\tm.zip .\buildtmp\*.*
rd /s /q buildtmp
pause

@ECHO OFF

set foldername=lizards-journey-v0.3.1
md %foldername%
copy readme.md "%~dp0\%foldername%\readme.txt"
"D:\Program Files\7-Zip\7z" -r a -tzip .\%foldername%\game.love .\love2d\*.*
copy "buildmaterial\lovewin64\*.*" "%foldername%\"
copy /b "%foldername%\love.exe"+"%foldername%\game.love" "%foldername%\%foldername%.exe"
del ".\%foldername%\game.love"
del ".\%foldername%\love.exe"
"D:\Program Files\7-Zip\7z" -r a -tzip .\%foldername%.zip .\%foldername%
::rd /s /q %foldername%
pause

update build script

update build script


echo off
rem call vc.bat
call ../../../language/src/locatevc.bat

cls

rc rnote.rc
cl /DEBUG rnote.c rnote.res /link advapi32.lib shell32.lib /SUBSYSTEM:WINDOWS,"5.01"

copy rnote.exe ..\..\..\RingNotepad.exe

echo off
rem call vc.bat
call ../../../language/src/locatevc.bat

cls

rc rnote.rc
cl rnote.c rnote.res /link advapi32.lib shell32.lib /SUBSYSTEM:WINDOWS,"5.01"

copy rnote.exe ..\..\..\RingNotepad.exe

Update tools/ringnotepad/rnoteexe/buildvc.bat


@echo off

rem   Licensed to the Apache Software Foundation (ASF) under one or more
rem   contributor license agreements.  See the NOTICE file distributed with
rem   this work for additional information regarding copyright ownership.
rem   The ASF licenses this file to You under the Apache License, Version 2.0
rem   (the "License"); you may not use this file except in compliance with
rem   the License.  You may obtain a copy of the License at
rem
rem       http://www.apache.org/licenses/LICENSE-2.0
rem
rem   Unless required by applicable law or agreed to in writing, software
rem   distributed under the License is distributed on an "AS IS" BASIS,
rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem   See the License for the specific language governing permissions and
rem   limitations under the License.

rem   =====================================================
rem   Environment variables that can be defined externally:
rem
rem   JMETER_BIN - JMeter bin directory (must end in \)
rem   JM_LAUNCH - java.exe (default) or javaw.exe
rem   JVM_ARGS - additional java options, e.g. -Dprop=val
rem
rem   =====================================================

if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe

if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal

rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT

if exist jmeter.bat goto winNT1
if .%JMETER_BIN% == . set JMETER_BIN=%~dp0

:winNT1
rem On NT/2K grab all arguments at once
set JMETER_CMD_LINE_ARGS=%*
goto doneStart

:setup4NT
set JMETER_CMD_LINE_ARGS=%$
goto doneStart

:win9xStart
rem Slurp the command line arguments.  This loop allows for an unlimited number of
rem arguments (up to the command line limit, anyway).

set JMETER_CMD_LINE_ARGS=

:setupArgs
if %1a==a goto doneStart
set JMETER_CMD_LINE_ARGS=%JMETER_CMD_LINE_ARGS% %1
shift
goto setupArgs

:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

rem The following link describes the -XX options:
rem http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
rem http://java.sun.com/developer/TechTips/2000/tt1222.html has some more descriptions
rem Unfortunately TechTips no longer seem to be available

rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set PERM=-XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled
rem set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution

rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError

rem Additional settings that might help improve GUI performance on some platforms
rem See: http://java.sun.com/products/java-media/2D/perf_graphics.html

set DDRAW=
rem  Setting this flag to true turns off DirectDraw usage, which sometimes helps to get rid of a lot of rendering problems on Win32.
rem set DDRAW=%DDRAW% -Dsun.java2d.noddraw=true

rem  Setting this flag to false turns off DirectDraw offscreen surfaces acceleration by forcing all createVolatileImage calls to become createImage calls, and disables hidden acceleration performed on surfaces created with createImage .
rem set DDRAW=%DDRAW% -Dsun.java2d.ddoffscreen=false

rem Setting this flag to true enables hardware-accelerated scaling.
rem set DDRAW=%DDRAW% -Dsun.java2d.ddscale=true

rem Server mode
rem Collect the settings defined above
set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW%

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

rem If the errorlevel is not zero, then display it and pause

if NOT errorlevel 0 goto pause
if errorlevel 1 goto pause

goto end

:pause
echo errorlevel=%ERRORLEVEL%
pause

:end

@echo off

rem   Licensed to the Apache Software Foundation (ASF) under one or more
rem   contributor license agreements.  See the NOTICE file distributed with
rem   this work for additional information regarding copyright ownership.
rem   The ASF licenses this file to You under the Apache License, Version 2.0
rem   (the "License"); you may not use this file except in compliance with
rem   the License.  You may obtain a copy of the License at
rem
rem       http://www.apache.org/licenses/LICENSE-2.0
rem
rem   Unless required by applicable law or agreed to in writing, software
rem   distributed under the License is distributed on an "AS IS" BASIS,
rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem   See the License for the specific language governing permissions and
rem   limitations under the License.

rem   =====================================================
rem   Environment variables that can be defined externally:
rem
rem   JMETER_BIN - JMeter bin directory (must end in \)
rem   JM_LAUNCH - java.exe (default) or javaw.exe
rem   JVM_ARGS - additional java options, e.g. -Dprop=val
rem   JM_START - set this to "start" to launch JMeter in a separate window
rem              this is used by the jmeterw.cmd script.
rem
rem   =====================================================

if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe

if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal

rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT

if exist jmeter.bat goto winNT1
if .%JMETER_BIN% == . set JMETER_BIN=%~dp0

:winNT1
rem On NT/2K grab all arguments at once
set JMETER_CMD_LINE_ARGS=%*
goto doneStart

:setup4NT
set JMETER_CMD_LINE_ARGS=%$
goto doneStart

:win9xStart
rem Slurp the command line arguments.  This loop allows for an unlimited number of
rem arguments (up to the command line limit, anyway).

set JMETER_CMD_LINE_ARGS=

:setupArgs
if %1a==a goto doneStart
set JMETER_CMD_LINE_ARGS=%JMETER_CMD_LINE_ARGS% %1
shift
goto setupArgs

:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

rem The following link describes the -XX options:
rem http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
rem http://java.sun.com/developer/TechTips/2000/tt1222.html has some more descriptions
rem Unfortunately TechTips no longer seem to be available

rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set PERM=-XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled
rem set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution

rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError

rem Additional settings that might help improve GUI performance on some platforms
rem See: http://java.sun.com/products/java-media/2D/perf_graphics.html

set DDRAW=
rem  Setting this flag to true turns off DirectDraw usage, which sometimes helps to get rid of a lot of rendering problems on Win32.
rem set DDRAW=%DDRAW% -Dsun.java2d.noddraw=true

rem  Setting this flag to false turns off DirectDraw offscreen surfaces acceleration by forcing all createVolatileImage calls to become createImage calls, and disables hidden acceleration performed on surfaces created with createImage .
rem set DDRAW=%DDRAW% -Dsun.java2d.ddoffscreen=false

rem Setting this flag to true enables hardware-accelerated scaling.
rem set DDRAW=%DDRAW% -Dsun.java2d.ddscale=true

rem Server mode
rem Collect the settings defined above
set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW%

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

rem If the errorlevel is not zero, then display it and pause

if NOT errorlevel 0 goto pause
if errorlevel 1 goto pause

goto end

:pause
echo errorlevel=%ERRORLEVEL%
pause

:end

Document JM_START

Document JM_START

git-svn-id: 5ccfe34f605a6c2f9041ff2965ab60012c62539a@1570183 13f79535-47bb-0310-9956-ffa450edef68


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

copy /Y drmemory-env.bat c:\src\
copy /Y env.bat          c:\src\

where git.exe > NUL 2>&1
if errorlevel 1 (
  pushd c:\src
  call env.bat
  popd
  git.exe pull --rebase
  install.bat
)

pushd c:\src
call env.bat
popd

pushd c:\src\dotfiles\
mkdir %APPDATA%\Console\
copy  /Y third_party\console2\console.xml %APPDATA%\Console\
copy  /Y     bash_profile %USERPROFILE%\.bash_profile
copy  /Y     bashrc       %USERPROFILE%\.bashrc
copy  /Y     cvsignore    %USERPROFILE%\.cvsignore
copy  /Y     vimrc        %USERPROFILE%\.vimrc
copy  /Y     zshrc        %USERPROFILE%\.zshrc
xcopy /Y/S/I emacs.d      %USERPROFILE%\.emacs.d
xcopy /Y/S/I third_party  %USERPROFILE%\.third_party
xcopy /Y/S/I vim          %USERPROFILE%\vimfiles
popd

git.exe config --global --replace-all alias.br branch
git.exe config --global --replace-all alias.brv "branch -vv"
git.exe config --global --replace-all alias.can "commit -a --amend --no-edit"
git.exe config --global --replace-all alias.co checkout
git.exe config --global --replace-all alias.ls ls-files
git.exe config --global --replace-all alias.st status
git.exe config --global --replace-all alias.sub "submodule update --init --recursive"
git.exe config --global --replace-all color.ui auto
git.exe config --global --replace-all core.autocrlf false
git.exe config --global --replace-all core.excludesfile %USERPROFILE%\.cvsignore
git.exe config --global --replace-all core.filemode false
git.exe config --global --replace-all http.cookiefile %USERPROFILE%\.gitcookies
git.exe config --global --replace-all push.default simple
git.exe config --global --replace-all user.name "Rouslan Solomakhin"
git.exe config --global --get user.email > NUL 2>&1
if errorlevel 1 (
  git.exe config --global --replace-all user.email "rouslan.solomakhin@gmail.com"
)
git.exe config --replace-all user.email "rouslan.solomakhin@gmail.com"

vim.exe -c ":PlugInstall" -c ":qa"

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

copy /Y drmemory-env.bat c:\src\
copy /Y env.bat          c:\src\

where git.exe > NUL 2>&1
if errorlevel 1 (
  pushd c:\src
  call env.bat
  popd
  git.exe pull --rebase
  install.bat
)

pushd c:\src
call env.bat
popd

pushd c:\src\dotfiles\
mkdir %APPDATA%\Console\
copy  /Y third_party\console2\console.xml %APPDATA%\Console\
copy  /Y     bash_profile %USERPROFILE%\.bash_profile
copy  /Y     bashrc       %USERPROFILE%\.bashrc
copy  /Y     cvsignore    %USERPROFILE%\.cvsignore
copy  /Y     vimrc        %USERPROFILE%\.vimrc
copy  /Y     zshrc        %USERPROFILE%\.zshrc
xcopy /Y/S/I emacs.d      %USERPROFILE%\.emacs.d
xcopy /Y/S/I third_party  %USERPROFILE%\.third_party
xcopy /Y/S/I vim          %USERPROFILE%\vimfiles
popd

git.exe config --global --replace-all alias.br branch
git.exe config --global --replace-all alias.brv "branch -vv"
git.exe config --global --replace-all alias.can "commit -a --amend --no-edit"
git.exe config --global --replace-all alias.co checkout
git.exe config --global --replace-all alias.ls ls-files
git.exe config --global --replace-all alias.st status
git.exe config --global --replace-all alias.sub "submodule update --init --recursive"
git.exe config --global --replace-all color.ui auto
git.exe config --global --replace-all core.autocrlf false
git.exe config --global --replace-all core.excludesfile %USERPROFILE%\.cvsignore
git.exe config --global --replace-all core.filemode false
git.exe config --global --replace-all http.cookiefile %USERPROFILE%\.gitcookies
git.exe config --global --replace-all push.default simple
git.exe config --global --replace-all user.name "Rouslan Solomakhin"
git.exe config --global --get user.email > NUL 2>&1
if errorlevel 1 (
  git.exe config --global --replace-all user.email "rouslan.solomakhin@gmail.com"
)
git.exe config --replace-all user.email "rouslan.solomakhin@gmail.com"

emacs -nw -f install-my-packages --kill
vim.exe -c ":PlugInstall" -c ":qa"

Install my packages in emacs.

Install my packages in emacs.


REM build-vc-programs.cmd

REM This script does the following:
REM     1) Bootstraps (builds) the VCPKG submodule; VCPKG is used to be the
REM        sample and tools programs that rely on Google Protocol Buffers.
REM     2) builds the Visual C++ samples and tools contained in this repository.
REM
REM PRECONDITIONS
REM -------------
REM     - You have recursively cloned this repo; if not, submodules/vcpkg will be empty.
REM     - You have installed Visual Studio 2017 C++ tools. 2015 may also work.
REM     - PowerShell is available on your computer.
REM     - You must run this script from within a Visual Studio Developer Command prompt.
REM     - You must have internet access.
REM
REM POSTCONDITIONS
REM --------------
REM On successful execution of this script the vcpkg tools will be built and
REM the projects built by this script will have been built successfully.

@ECHO OFF

REM ---------------------------------------------------------------------------
REM Bootstrap and build vcpkg

IF "%VisualStudioVersion%" == "" GOTO VSCmdPrompt

pushd submodules\vcpkg
call .\bootstrap-vcpkg.bat
ECHO vcpkg build completed.

REM per https://github.com/Microsoft/vcpkg/issues/645
if not exist downloads mkdir downloads
echo "." > downloads\AlwaysAllowEverything
dir downloads\Always*

vcpkg install protobuf:x86-windows-static
vcpkg install protobuf:x64-windows-static
ECHO Installs completed.

popd

REM ---------------------------------------------------------------------------
REM Build the programs

REM Per https://github.com/NuGet/Home/issues/7386, /t:restore does not support
REM packages.config, and nuget.exe is therefore necessary. However, nuget 3.5.0,
REM as available in vcpkg\downloads, attempts to use the v14 build tools
REM ("Failed to load msbuild Toolset... Microsoft.Build, Version=14.0.0.0").
REM Don't use the old nuget.

REM NOTE
REM We're not currently building arislog or vc-using-framestream from this script,
REM they're built in separate build steps on the build server.

GOTO End

:VSCmdPrompt
ECHO ------------------------------------------------------------------------
ECHO ERROR: Couldn't find environment variable 'VisualStudioVersion'.
ECHO You must run this script form a Visual Studio developer command prompt.
ECHO ------------------------------------------------------------------------
EXIT /B 1

:End

REM build-vc-programs.cmd

REM This script does the following:
REM     1) Bootstraps (builds) the VCPKG submodule; VCPKG is used to be the
REM        sample and tools programs that rely on Google Protocol Buffers.
REM
REM PRECONDITIONS
REM -------------
REM     - You have recursively cloned this repo; if not, submodules/vcpkg will be empty.
REM     - You have installed Visual Studio 2019 C++ tools. 2017 or 2015 are untested.
REM     - PowerShell is installed on your PC.
REM     - You must run this script from within a Visual Studio Developer Command prompt.
REM     - You must have internet access for vcpkg to work properly.
REM
REM POSTCONDITIONS
REM --------------
REM On successful execution of this script the vcpkg tools will be built.

@ECHO OFF

REM ---------------------------------------------------------------------------
REM Bootstrap and build vcpkg

IF "%VisualStudioVersion%" == "" GOTO VSCmdPrompt

pushd submodules\vcpkg
call .\bootstrap-vcpkg.bat
ECHO vcpkg build completed.

REM per https://github.com/Microsoft/vcpkg/issues/645
if not exist downloads mkdir downloads
echo "." > downloads\AlwaysAllowEverything
dir downloads\Always*

vcpkg install protobuf:x86-windows-static
vcpkg install protobuf:x64-windows-static
ECHO Installs completed.

popd

REM ---------------------------------------------------------------------------
REM Build the programs

REM Per https://github.com/NuGet/Home/issues/7386, /t:restore does not support
REM packages.config, and nuget.exe is therefore necessary. However, nuget 3.5.0,
REM as available in vcpkg\downloads, attempts to use the v14 build tools
REM ("Failed to load msbuild Toolset... Microsoft.Build, Version=14.0.0.0").
REM Don't use the old nuget.

REM NOTE
REM We're not currently building arislog or vc-using-framestream from this script,
REM they're built in separate build steps on the build server.

GOTO End

:VSCmdPrompt
ECHO ------------------------------------------------------------------------
ECHO ERROR: Couldn't find environment variable 'VisualStudioVersion'.
ECHO You must run this script form a Visual Studio developer command prompt.
ECHO ------------------------------------------------------------------------
EXIT /B 1

:End

Bring tooling requirements up-to-date.

Bring tooling requirements up-to-date.


SET SQLITE_OPTIONS=/D SQLITE_ENABLE_COLUMN_METADATA /D SQLITE_ENABLE_FTS3_PARENTHESIS /D SQLITE_ENABLE_FTS4 /D SQLITE_ENABLE_JSON1 /D SQLITE_ENABLE_RTREE /D SQLITE_DEFAULT_FOREIGN_KEYS=1 /D "SQLITE_API=__declspec(dllexport)" /D SQLITE_WIN32_FILEMAPPING_API=1

echo "TODO figure out if manifest should be embedded.  looks like WP80 can't"

rem SET LIBS=kernel32.lib user32.lib uuid.lib
rem SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
rem SET MANIFEST_OPTIONS=/MANIFEST /ManifestFile:"obj\Release\e_sqlite3.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
rem SET MANIFEST_OPTIONS=/MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed

SET VCVARSBAT="C:\Program Files (x86)/Microsoft Visual Studio 11.0/VC/WPSDK/WP80/vcvarsphoneall.bat"

echo "-------- Windows Phone 8.0"

SET TOOLCHAIN=x86
SET SUBDIR=v110\wp80\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=
SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\wp80\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=
SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
cmd /c b.bat

SET LIBS=

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"

echo "-------- Win XP"

SET TOOLCHAIN=x86
SET SUBDIR=v110\xp\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\xp\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\xp\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_ /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v110 plain, did not build before"

SET TOOLCHAIN=x86
SET SUBDIR=v110\plain\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\plain\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\plain\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v110 appcontainer, for Win 8.0 store app"

SET TOOLCHAIN=x86
SET SUBDIR=v110\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

echo "-------- v120 appcontainer, for Win 8.1 store app"

SET TOOLCHAIN=x86
SET SUBDIR=v120\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v120\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v120\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

echo "-------- Windows Phone 8.1"

SET TOOLCHAIN=x86
SET SUBDIR=v120\wp81\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v120\wp81\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

echo "-------- v140 plain, not built before"

SET TOOLCHAIN=x86
SET SUBDIR=v140\plain\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v140\plain\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v140\plain\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v140 appcontainer, for uwp"

SET TOOLCHAIN=x86
SET SUBDIR=v140\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v140\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v140\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET SQLITE_OPTIONS=/D SQLITE_ENABLE_COLUMN_METADATA /D SQLITE_ENABLE_FTS3_PARENTHESIS /D SQLITE_ENABLE_FTS4 /D SQLITE_ENABLE_JSON1 /D SQLITE_ENABLE_RTREE /D SQLITE_DEFAULT_FOREIGN_KEYS=1 /D "SQLITE_API=__declspec(dllexport)" /D SQLITE_WIN32_FILEMAPPING_API=1

echo "TODO figure out if manifest should be embedded.  looks like WP80 can't"

rem SET LIBS=kernel32.lib user32.lib uuid.lib
rem SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
rem SET MANIFEST_OPTIONS=/MANIFEST /ManifestFile:"obj\Release\e_sqlite3.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
rem SET MANIFEST_OPTIONS=/MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed

SET VCVARSBAT="C:\Program Files (x86)/Microsoft Visual Studio 11.0/VC/WPSDK/WP80/vcvarsphoneall.bat"

echo "-------- Windows Phone 8.0"

SET TOOLCHAIN=x86
SET SUBDIR=v110\wp80\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=
SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\wp80\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=
SET LIBS=WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
cmd /c b.bat

SET LIBS=

SET MANIFEST_OPTIONS=/MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"

echo "-------- Win XP"

SET TOOLCHAIN=x86
SET SUBDIR=v110\xp\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\xp\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\xp\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _USING_V110_SDK71_ /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v110 plain, did not build before"

SET TOOLCHAIN=x86
SET SUBDIR=v110\plain\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\plain\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\plain\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v110 appcontainer, for Win 8.0 store app"

SET TOOLCHAIN=x86
SET SUBDIR=v110\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v110\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v110\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

echo "-------- v120 appcontainer, for Win 8.1 store app"

SET TOOLCHAIN=x86
SET SUBDIR=v120\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v120\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v120\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

echo "-------- Windows Phone 8.1"

SET TOOLCHAIN=x86
SET SUBDIR=v120\wp81\x86
SET MACHINE=X86
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v120\wp81\arm
SET MACHINE=ARM
SET CRT_OPTION=/MD
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /D SQLITE_OS_WINRT /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

echo "-------- v140 plain, not built before"

SET TOOLCHAIN=x86
SET SUBDIR=v140\plain\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v140\plain\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v140\plain\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=
cmd /c b.bat

echo "-------- v140 appcontainer, for uwp"

SET TOOLCHAIN=x86
SET SUBDIR=v140\appcontainer\x86
SET MACHINE=X86
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_amd64
SET SUBDIR=v140\appcontainer\x64
SET MACHINE=X64
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

SET TOOLCHAIN=x86_arm
SET SUBDIR=v140\appcontainer\arm
SET MACHINE=ARM
SET CRT_OPTION=/MT
SET EXTRA_CL_OPTIONS=/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
SET EXTRA_LINK_OPTIONS=/APPCONTAINER
cmd /c b.bat

add manifest options back in for build_sqlite3 for everything but wp80


@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=n
@where python.exe>pyupd.ini
@set /p makoloc=<pyupd.ini
@set makoloc="%makoloc:python.exe=%Lib\site-packages\mako"
@if NOT EXIST %makoloc% set pyupd=y
@if EXIST %makoloc% set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@set mesapatched=0
@if NOT EXIST mesa set mesapatched=0
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
@if EXIST mesapatched.ini set /p mesapatched=<mesapatched.ini
@if NOT %mesapatched%==1 git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
@if NOT %mesapatched%==1 git apply -v ..\mesa-dist-win\patches\s3tc.patch
@if NOT %mesapatched%==1 git apply -v ..\mesa-dist-win\patches\scons3.patch
@set mesapatched=1
@echo %mesapatched% > mesapatched.ini
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=n
@where python.exe>pyupd.ini
@set /p makoloc=<pyupd.ini
@set makoloc="%makoloc:python.exe=%Lib\site-packages\mako"
@if NOT EXIST %makoloc% set pyupd=y
@if EXIST %makoloc% set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@set mesapatched=0
@set branch=none
@if NOT EXIST mesa set mesapatched=0
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
@if EXIST mesapatched.ini set /p mesapatched=<mesapatched.ini
@if %mesapatched%==1 set branch=master
@if NOT "%branch%"=="master" git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
@if NOT %mesapatched%==1 git apply -v ..\mesa-dist-win\patches\s3tc.patch
@if NOT %mesapatched%==1 git apply -v ..\mesa-dist-win\patches\scons3.patch
@set mesapatched=1
@echo %mesapatched% > mesapatched.ini
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

Build script: Don't apply LLVM 5.0 compatibility patch to master branch It is upstreamed already


@echo off
rem vim: set tw=0:
rem Joseph Harriott - http://momentary.eu/ 26/11/14
rem Convert markdown file to pdf nicely.
rem Put this script in your path (eg C:\Users\jo\AppData\Local\Pandoc),
rem and call it from the markdown file's directory thus: md4pdf basename.
rem ---------------------------------------------------------------------

setlocal & rem all variables now local

rem populate a temporary tex file for the titling:
set bn=%1
set bln=%bn:_=\_% & rem escaped underscores in filename for passing to TeX
set pn=%bn%.pdf
echo \renewcommand\contentsname{%bln%} \renewcommand{\thechapter}{} \usepackage{titlesec} \titleformat{\chapter}{}{}{0em}{\bfseries\LARGE} \titlespacing{\chapter}{0pt}{30pt}{*2} \usepackage{xcolor} \makeevenfoot{plain}{}{\textcolor{lightgray}{%bln%} \quad p.\thepage\ }{} \makeoddfoot{plain}{}{\textcolor{lightgray}{%bln%} \quad p.\thepage\ }{}> md4pdf.tex

rem set the ToC Pandoc switches (the default case) if no 2nd argument was given:
if -%2-==-- set tc=--toc --toc-depth=4

rem if there was a 1st argument given (try to) Pandoc with it:
echo running pandoc on %1.md
if not -%1-==-- start/b/w pandoc -Vdocumentclass:memoir -Vclassoption:article -H md4pdf.tex -Vmainfont:Arial %tc% -f markdown_strict %1.md -o %pn% --latex-engine=xelatex

del md4pdf.tex & rem tidy up, anyway.

rem if a pdf's been made, open it nicely:
if exist %pn% start SumatraPDF -view "continuous facing" -page 1 -reuse-instance %pn%

@echo off
rem vim: set tw=0:
rem Joseph Harriott - http://momentary.eu/ 26/11/14
rem Convert markdown file to pdf nicely.
rem Put this script in your path (eg C:\Users\jo\AppData\Local\Pandoc),
rem and call it from the markdown file's directory thus: md4pdf basename.
rem ---------------------------------------------------------------------

setlocal & rem all variables now local

rem populate a temporary tex file for the titling:
set bn=%~n1
set bln=%bn:_=\_% & rem escaped underscores in filename for passing to TeX
set pn=%bn%.pdf
echo \renewcommand\contentsname{%bln%} \renewcommand{\thechapter}{} \usepackage{titlesec} \titleformat{\chapter}{}{}{0em}{\bfseries\LARGE} \titlespacing{\chapter}{0pt}{30pt}{*2} \usepackage{xcolor} \makeevenfoot{plain}{}{\textcolor{lightgray}{%bln%} \quad p.\thepage\ }{} \makeoddfoot{plain}{}{\textcolor{lightgray}{%bln%} \quad p.\thepage\ }{}> md4pdf.tex

rem set the ToC Pandoc switches (the default case) if no 2nd argument was given:
if -%2-==-- set tc=--toc --toc-depth=4

rem if there was a 1st argument given (try to) Pandoc with it:
echo running pandoc on %bn%.md
if not -%bn%-==-- start/b/w pandoc -Vdocumentclass:memoir -Vclassoption:article -H md4pdf.tex -Vmainfont:Arial %tc% -f markdown_strict %bn%.md -o %pn% --latex-engine=xelatex

del md4pdf.tex & rem tidy up, anyway.

rem if a pdf's been made, open it nicely:
if exist %pn% start SumatraPDF -view "continuous facing" -page 1 -reuse-instance %pn%

allow *.md

allow *.md


add command to help get started debugging faster


@ECHO OFF
set version=4.11.6
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%version%

echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Data\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\css\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\macroScripts\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\masterpages\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\media\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\scripts\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\usercontrols\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\xslt\dummy.txt

NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
NuGet.exe pack NuSpecs\UmbracoCms.nuspec -Version %version%

if ERRORLEVEL 1 goto :showerror

goto :EOF

:showerror
pause

@ECHO OFF
set version=4.11.7
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%version%

echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Data\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\css\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\macroScripts\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\masterpages\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\media\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\scripts\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\usercontrols\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\xslt\dummy.txt

NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
NuGet.exe pack NuSpecs\UmbracoCms.nuspec -Version %version%

if ERRORLEVEL 1 goto :showerror

goto :EOF

:showerror
pause

Update version to 4.11.7

Update version to 4.11.7


@echo off

SET MUMBLE_PREFIX=%~dp0
IF %MUMBLE_PREFIX:~-1%==\ SET MUMBLE_PREFIX=%MUMBLE_PREFIX:~0,-1%
SET MUMBLE_PREFIX_BUILD=%MUMBLE_PREFIX%.build

SET VSVER=10.0
SET XPCOMPAT=1
SET LIB=

set MUMBLE_OPENSSL_PREFIX=%MUMBLE_PREFIX%\OpenSSL
set MUMBLE_SNDFILE_PREFIX=%MUMBLE_PREFIX%\sndfile
set MUMBLE_PROTOBUF_PREFIX=%MUMBLE_PREFIX%\protobuf
SET MUMBLE_QT_PREFIX=%MUMBLE_PREFIX%\Qt4.8
SET MUMBLE_ICE_PREFIX=%MUMBLE_PREFIX%\ZeroC-Ice

:: We want Cygwin's /usr/bin and /usr/local/bin directories
:: to come directly after the the PATH additions we prepend
:: to the PATH in this script.
::
:: We have a very strict PATH ordering we need to follow to
:: get consistent behavior on all systems:
::
::  1. MSVS toolchain and our own tools (mainly because link.exe
::     clashes with /usr/bin/link in Cygwin).
::
::  2. When in Cygwin, we prefer /usr/bin and /usr/local/bin over
::     %WINDIR%\System32. Bash scripts will break horribly if
::     'sort' and 'find' are Windows's variants.
::
::  3. The rest of the systems original %PATH% (including System32).
::
:: To reach that goal, we insert a fake entry in the PATH that we
:: can replace with something useful once we enter a Cygwin shell,
:: which happens via the 'env' script.
::
:: We insert it at this point in the code, because the dx_setenv.cmd
:: script and MSVS's vcvarsall.bat both prepend to the current PATH.
:: Our own PATH additions further down in this file also prepend to
:: PATH. So, to ensure Cygwin's entires come *after* all of those,
:: we have to put it front here.
SET PATH=--cygwin--;%PATH%

IF DEFINED %PROGRAMFILES(X86)% (
  GOTO amd64
) ELSE (
  GOTO x86
)

:amd64
SET PROGPATH=%PROGRAMFILES(X86)%
GOTO SDKVars

:x86
SET PROGPATH=%PROGRAMFILES%
GOTO SDKVars

:SDKVars
CALL "%PROGPATH%\Microsoft Visual Studio %VSVER%\VC\vcvarsall.bat" x86 >NUL

:: We call dx_setenv after vcvarsall to avoid accidently using the
:: DirectX bundled with MSVC2013's Windows 8 SDK.
::
:: When building using the v120_xp toolset, the latest supported
:: Windows SDK is the Windows v7.1A SDK, which is a specially
:: re-packaged version of the Windows 7 SDK meant for use in the
:: XP compatibility toolsets for Visual Studio 2012 and 2013
:: (i.e. v120_xp).
::
:: Since the Windows 8 SDK is unsupported, the SDK-bundled DirectX is probably
:: also off-limits. To ensure we're using the non-bundled "June 2010" variant,
:: we call its dx_setenv.cmd *after* vcvarsall, to ensure the bin, lib and include
:: environment variables come before the ones from the Windows 8 SDK.
CALL "%DXSDK_DIR%\Utilities\bin\dx_setenv.cmd" x86 >NUL

IF %VSVER%==10.0 GOTO VS2010
IF %VSVER%==12.0 GOTO VS2013

:VSUNKNOWN
ECHO.
ECHO Unknown version of Visual Studio detected. (VSVER is set to `%VSVER%`)
ECHO Unable to initialize build environment. Aborting...
ECHO.
PAUSE
EXIT

:VS2010
TITLE MumbleBuild MSVS2010 (v100)
SET MUMBLE_VSTOOLSET=v100
GOTO FINALIZE

:VS2013
IF %XPCOMPAT%==1 GOTO VS2013XP
TITLE MumbleBuild MSVC2013 (v120)
SET MUMBLE_VSTOOLSET=v120
GOTO FINALIZE

:VS2013XP
TITLE MumbleBuild MSVS2013 (v120_xp)
SET MUMBLE_VSTOOLSET=v120_xp
:: Set up the environment such that using cl.exe and friends
:: from the command line will work as if we were using the "v120_xp"
:: toolset in Visual Studio.
::
:: Technically, this uses a specially re-packaged Windows 7 SDK
:: called "v7.1A", and sets a preprocessor define, _USING_V110_SDK71_
:: (it's called V110 for both v110_xp and v120_xp).
set INCLUDE=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
set PATH=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
set LIB=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_ %CL%
GOTO FINALIZE

:FINALIZE
SET PATH=%MUMBLE_QT_PREFIX%\bin;%MUMBLE_OPENSSL_PREFIX%\bin;%MUMBLE_OPENSSL_PREFIX%\bin;%MUMBLE_PROTOBUF_PREFIX%\vsprojects\Release;%MUMBLE_ICE_PREFIX%\bin;%PATH%
cmd /V:ON /K %*
exit /b

@echo off

SET MUMBLE_PREFIX=%~dp0
IF %MUMBLE_PREFIX:~-1%==\ SET MUMBLE_PREFIX=%MUMBLE_PREFIX:~0,-1%
SET MUMBLE_PREFIX_BUILD=%MUMBLE_PREFIX%.build

SET VSVER=12.0
SET XPCOMPAT=1
SET LIB=

set MUMBLE_OPENSSL_PREFIX=%MUMBLE_PREFIX%\OpenSSL
set MUMBLE_SNDFILE_PREFIX=%MUMBLE_PREFIX%\sndfile
set MUMBLE_PROTOBUF_PREFIX=%MUMBLE_PREFIX%\protobuf
SET MUMBLE_QT_PREFIX=%MUMBLE_PREFIX%\Qt4.8
SET MUMBLE_ICE_PREFIX=%MUMBLE_PREFIX%\ZeroC-Ice

:: We want Cygwin's /usr/bin and /usr/local/bin directories
:: to come directly after the the PATH additions we prepend
:: to the PATH in this script.
::
:: We have a very strict PATH ordering we need to follow to
:: get consistent behavior on all systems:
::
::  1. MSVS toolchain and our own tools (mainly because link.exe
::     clashes with /usr/bin/link in Cygwin).
::
::  2. When in Cygwin, we prefer /usr/bin and /usr/local/bin over
::     %WINDIR%\System32. Bash scripts will break horribly if
::     'sort' and 'find' are Windows's variants.
::
::  3. The rest of the systems original %PATH% (including System32).
::
:: To reach that goal, we insert a fake entry in the PATH that we
:: can replace with something useful once we enter a Cygwin shell,
:: which happens via the 'env' script.
::
:: We insert it at this point in the code, because the dx_setenv.cmd
:: script and MSVS's vcvarsall.bat both prepend to the current PATH.
:: Our own PATH additions further down in this file also prepend to
:: PATH. So, to ensure Cygwin's entires come *after* all of those,
:: we have to put it front here.
SET PATH=--cygwin--;%PATH%

IF DEFINED %PROGRAMFILES(X86)% (
  GOTO amd64
) ELSE (
  GOTO x86
)

:amd64
SET PROGPATH=%PROGRAMFILES(X86)%
GOTO SDKVars

:x86
SET PROGPATH=%PROGRAMFILES%
GOTO SDKVars

:SDKVars
CALL "%PROGPATH%\Microsoft Visual Studio %VSVER%\VC\vcvarsall.bat" x86 >NUL

:: We call dx_setenv after vcvarsall to avoid accidently using the
:: DirectX bundled with MSVC2013's Windows 8 SDK.
::
:: When building using the v120_xp toolset, the latest supported
:: Windows SDK is the Windows v7.1A SDK, which is a specially
:: re-packaged version of the Windows 7 SDK meant for use in the
:: XP compatibility toolsets for Visual Studio 2012 and 2013
:: (i.e. v120_xp).
::
:: Since the Windows 8 SDK is unsupported, the SDK-bundled DirectX is probably
:: also off-limits. To ensure we're using the non-bundled "June 2010" variant,
:: we call its dx_setenv.cmd *after* vcvarsall, to ensure the bin, lib and include
:: environment variables come before the ones from the Windows 8 SDK.
CALL "%DXSDK_DIR%\Utilities\bin\dx_setenv.cmd" x86 >NUL

IF %VSVER%==10.0 GOTO VS2010
IF %VSVER%==12.0 GOTO VS2013

:VSUNKNOWN
ECHO.
ECHO Unknown version of Visual Studio detected. (VSVER is set to `%VSVER%`)
ECHO Unable to initialize build environment. Aborting...
ECHO.
PAUSE
EXIT

:VS2010
TITLE MumbleBuild MSVS2010 (v100)
SET MUMBLE_VSTOOLSET=v100
GOTO FINALIZE

:VS2013
IF %XPCOMPAT%==1 GOTO VS2013XP
TITLE MumbleBuild MSVC2013 (v120)
SET MUMBLE_VSTOOLSET=v120
GOTO FINALIZE

:VS2013XP
TITLE MumbleBuild MSVS2013 (v120_xp)
SET MUMBLE_VSTOOLSET=v120_xp
:: Set up the environment such that using cl.exe and friends
:: from the command line will work as if we were using the "v120_xp"
:: toolset in Visual Studio.
::
:: Technically, this uses a specially re-packaged Windows 7 SDK
:: called "v7.1A", and sets a preprocessor define, _USING_V110_SDK71_
:: (it's called V110 for both v110_xp and v120_xp).
set INCLUDE=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
set PATH=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
set LIB=%PROGPATH%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_ %CL%
GOTO FINALIZE

:FINALIZE
SET PATH=%MUMBLE_QT_PREFIX%\bin;%MUMBLE_OPENSSL_PREFIX%\bin;%MUMBLE_OPENSSL_PREFIX%\bin;%MUMBLE_PROTOBUF_PREFIX%\vsprojects\Release;%MUMBLE_ICE_PREFIX%\bin;%PATH%
cmd /V:ON /K %*
exit /b

buildenv/win32-static: update prep.cmd to use MSVS 2013 by default.


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

@rem TODO(jtattermusch): make this generate less output
choco install bazel -y --version 0.23.2 --limit-output

cd github/grpc
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem Generate a random UUID and store in "bazel_invocation_ids" artifact file
powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids

@rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE.
bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --incompatible_disallow_filetype=false --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json
set BAZEL_EXITCODE=%errorlevel%

@rem TODO(jtattermusch): upload results to bigquery

exit /b %BAZEL_EXITCODE%

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

@rem TODO(jtattermusch): make this generate less output
@rem TODO(jtattermusch): use tools/bazel.sh script to keep the versions in sync
choco install bazel -y --version 0.24.1 --limit-output

cd github/grpc
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem Generate a random UUID and store in "bazel_invocation_ids" artifact file
powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids

@rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE.
bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --incompatible_disallow_filetype=false --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json
set BAZEL_EXITCODE=%errorlevel%

@rem TODO(jtattermusch): upload results to bigquery

exit /b %BAZEL_EXITCODE%

update bazel_rbe.bat

update bazel_rbe.bat


@echo off

SET SCRIPTPATH=%~dp0
CD /D %~dp0

setlocal

SET ICU_MAJOR_VER=58
SET ICU_MINOR_VER=2

SET VC=%ProgramFiles%\Microsoft Visual Studio 14.0\VC
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC
if exist %VC64% (
	SET VC=%VC64%
)

SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
if exist %UNSIP_PROGRAMM2% (
	SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
)

if defined BUILD_PLATFORM (
	if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
		SET "BUILD_PLATFORMS=win_64 win_32"
		GOTO :found
	)
)

SET "BUILD_PLATFORMS=win_32"
if defined ProgramFiles(x86) (
	SET "BUILD_PLATFORMS=win_64"
	GOTO :found
)
if defined TARGET (
	SET "BUILD_PLATFORMS=%TARGET%"
	GOTO :found
)

echo "error"
GOTO :end

:found
for %%a in (%BUILD_PLATFORMS%) do (
	cd "%SCRIPTPATH%"
	if not exist "%%a" (
		md "%%a"
	)
	if not exist "%%a\build" (
		md "%%a\build"
	)
	cd "%SCRIPTPATH%%%a"
	if exist "icu" (
		echo "icu already exported"
	) else (
		svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
	)

	if "%%a" == "win_64" (
		call "%VC%\vcvarsall.bat" x64
		MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
		XCOPY /Y "icu\bin64\icudt%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\lib64\icudt.lib" "build\"
		XCOPY /Y "icu\lib64\icuuc.lib" "build\"
	) else (
		call "%VC%\vcvarsall.bat" x86
		MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
		XCOPY /Y "icu\bin\icudt%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\bin\icuuc%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\lib\icudt.lib" "build\"
		XCOPY /Y "icu\lib\icuuc.lib" "build\"
	)
)
cd "%SCRIPTPATH%"

:end
endlocal

@echo on

@echo off

SET SCRIPTPATH=%~dp0
CD /D %~dp0

setlocal

SET ICU_MAJOR_VER=58
SET ICU_MINOR_VER=2

SET VC=%ProgramFiles%\Microsoft Visual Studio 14.0\VC
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC
if exist %VC64% (
	SET VC=%VC64%
)

SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
if exist %UNSIP_PROGRAMM2% (
	SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
)

if defined BUILD_PLATFORM (
	if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
		SET "BUILD_PLATFORMS=win_64 win_32"
		GOTO :found
	)
	if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
		SET "BUILD_PLATFORMS=win_64 win_32"
		GOTO :found
	)
)

SET "BUILD_PLATFORMS=win_32"
if defined ProgramFiles(x86) (
	SET "BUILD_PLATFORMS=win_64"
	GOTO :found
)
if defined TARGET (
	SET "BUILD_PLATFORMS=%TARGET%"
	GOTO :found
)

echo "error"
GOTO :end

:found
for %%a in (%BUILD_PLATFORMS%) do (
	cd "%SCRIPTPATH%"
	if not exist "%%a" (
		md "%%a"
	)
	if not exist "%%a\build" (
		md "%%a\build"
	)
	cd "%SCRIPTPATH%%%a"
	if exist "icu" (
		echo "icu already exported"
	) else (
		svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
	)

	if "%%a" == "win_64" (
		call "%VC%\vcvarsall.bat" x64
		MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
		XCOPY /Y "icu\bin64\icudt%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\lib64\icudt.lib" "build\"
		XCOPY /Y "icu\lib64\icuuc.lib" "build\"
	) else (
		call "%VC%\vcvarsall.bat" x86
		MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
		XCOPY /Y "icu\bin\icudt%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\bin\icuuc%ICU_MAJOR_VER%.dll" "build\"
		XCOPY /Y "icu\lib\icudt.lib" "build\"
		XCOPY /Y "icu\lib\icuuc.lib" "build\"
	)
)
cd "%SCRIPTPATH%"

:end
endlocal

@echo on

Build icu with only xp target (#167)

Build icu with only xp target (#167)


"%sdkverpath%" -q -version:"%sdkver%"
call setenv /x64

rem install python packages
pip install --cache-dir c:/temp nose
pip install --cache-dir c:/temp coverage

rem install mayavi
python setup.py develop

"%sdkverpath%" -q -version:"%sdkver%"
call setenv /x64

rem install python packages
pip install --cache-dir c:/egg_cache nose
pip install --cache-dir c:/egg_cache coverage

rem install mayavi
python setup.py develop

fix cache folder name

fix cache folder name


python "%~dp0mkdd-collision-creator.py" %1
pause

python "%~dp0mkdd-collision-creator.py" %*
pause

allow taking multiple arguments for bat

allow taking multiple arguments for bat


call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
msbuild /nologo /property:Configuration=Debug /target:win32 luvit.sln

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
msbuild /nologo /property:Configuration=Debug /target:luvit luvit.sln

use luvit target

use luvit target


@setlocal EnableExtensions EnableDelayedExpansion
@echo off

set current-path=%~dp0
rem // remove trailing slash
set current-path=%current-path:~0,-1%

set build-root=%current-path%\..\..
rem // resolve to fully qualified path
for %%i in ("%build-root%") do set build-root=%%~fi

rem -----------------------------------------------------------------------------
rem -- "Release" all the libraries that are used by the clients
rem -----------------------------------------------------------------------------

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_amqp_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_http_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_mqtt_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_client
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-uamqp-c\build
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-umqtt-c\build
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-c-shared-utility\build
if not %errorlevel%==0 exit /b %errorlevel%

rem -----------------------------------------------------------------------------
rem -- build iothub client samples
rem -----------------------------------------------------------------------------

call :compile iothub_client_sample_amqp %build-root%\samples\iothub_client_sample_amqp\mbed
if not %errorlevel%==0 exit /b %errorlevel%

call :compile iothub_client_sample_http %build-root%\samples\iothub_client_sample_http\mbed
if not %errorlevel%==0 exit /b %errorlevel%

call :compile iothub_client_sample_mqtt %build-root%\samples\iothub_client_sample_mqtt\mbed
if not %errorlevel%==0 exit /b %errorlevel%

rem -----------------------------------------------------------------------------
rem -- build iothub longhaul tests
rem -----------------------------------------------------------------------------

call :compile longhaul_tests %build-root%\tests\longhaul_tests\mbed
if not %errorlevel%==0 exit /b %errorlevel%

goto:eof

rem -----------------------------------------------------------------------------
rem -- helper subroutines
rem -----------------------------------------------------------------------------

:compile
setlocal EnableExtensions
set "project_name=%~1"
set "project_path=%~2"
set "cmake_project_bin_path=%project_name%_cmake_build"

mkdir %cmake_project_bin_path%
cd %cmake_project_bin_path%
cmake %project_path%
set CMAKE_ERROR_CODE=%ERRORLEVEL%
cd ..
exit /b %CMAKE_ERROR_CODE%
goto:eof

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

set current-path=%~dp0
rem // remove trailing slash
set current-path=%current-path:~0,-1%

set build-root=%current-path%\..\..
rem // resolve to fully qualified path
for %%i in ("%build-root%") do set build-root=%%~fi

rem -----------------------------------------------------------------------------
rem -- "Release" all the libraries that are used by the clients
rem -----------------------------------------------------------------------------

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_amqp_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_http_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_mqtt_transport
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\build\iothub_client
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-uamqp-c\build
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-umqtt-c\build
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\azure-c-shared-utility\build
if not %errorlevel%==0 exit /b %errorlevel%

call %build-root%\..\..\build\release\release_mbed_project.cmd %build-root%\..\serializer\build
if not %errorlevel%==0 exit /b %errorlevel%

rem -----------------------------------------------------------------------------
rem -- build iothub client samples
rem -----------------------------------------------------------------------------

call :compile iothub_client_sample_amqp %build-root%\samples\iothub_client_sample_amqp\mbed
if not %errorlevel%==0 exit /b %errorlevel%

call :compile iothub_client_sample_http %build-root%\samples\iothub_client_sample_http\mbed
if not %errorlevel%==0 exit /b %errorlevel%

call :compile iothub_client_sample_mqtt %build-root%\samples\iothub_client_sample_mqtt\mbed
if not %errorlevel%==0 exit /b %errorlevel%

rem -----------------------------------------------------------------------------
rem -- build a serializer client sample
rem -----------------------------------------------------------------------------

call :compile simplesample_amqp %build-root%\..\serializer\samples\simplesample_amqp\mbed
if not %errorlevel%==0 exit /b %errorlevel%

rem -----------------------------------------------------------------------------
rem -- build iothub longhaul tests (FOR NOW DON'T DO THIS)
rem -----------------------------------------------------------------------------

rem call :compile longhaul_tests %build-root%\tests\longhaul_tests\mbed
rem if not %errorlevel%==0 exit /b %errorlevel%

goto:eof

rem -----------------------------------------------------------------------------
rem -- helper subroutines
rem -----------------------------------------------------------------------------

:compile
setlocal EnableExtensions
set "project_name=%~1"
set "project_path=%~2"
set "cmake_project_bin_path=%project_name%_cmake_build"

mkdir %cmake_project_bin_path%
cd %cmake_project_bin_path%
cmake -Dmbed_repo_name:string=%project_name% %project_path%
set CMAKE_ERROR_CODE=%ERRORLEVEL%
cd ..
exit /b %CMAKE_ERROR_CODE%
goto:eof

Add release of libs and also build a serializer sample.


@echo off
: Param1 - Win7 | Wlh | Wnet | XP
: Param2 - x86|x64
: Param3 - sys name
: Param3 - inf name

if "%2"=="x64" set %%2=amd64

if /i "%1"=="Win7" goto :checkarch
if /i "%1"=="Wlh" goto :checkarch
if /i "%1"=="Wnet" goto :checkarch
if /i "%1"=="WXp" goto :checkarch
goto :printerr
:checkarch
if /i "%2"=="x86" goto :makeinstall
if /i "%2"=="x64" goto :makeinstall
:printerr
echo wrong parameters (1)%1 (2)%2 (3)%3
pause
goto :eof

:makeinstall
if "%DDKVER%"=="" set DDKVER=7600.16385.0
set BUILDROOT=C:\WINDDK\%DDKVER%

set INST_OS=%1
set INST_ARC=%2
set SYS_NAME=%3
set INF_NAME=%4
rem set INST_EXT=INST_ARC

if /i "%INST_ARC%"=="x64" goto :set_x64

set INST_EXT=i386
goto :startcopy

:set_x64
set INST_ARC=amd64
set INST_EXT=amd64

:startcopy
set SYS_PATH_AND_NAME=objfre_%INST_OS%_%INST_ARC%\%INST_EXT%\%SYS_NAME%.sys
set PDB_PATH_AND_NAME=objfre_%INST_OS%_%INST_ARC%\%INST_EXT%\%SYS_NAME%.pdb
set INF_PATH_AND_NAME=%INF_NAME%.inf

rem echo makeinstall %1 %2 %3 %4
mkdir ..\Install\%INST_OS%\%INST_ARC%
del /Q ..\Install\%INST_OS%\%INST_ARC%\%FILE_NAME%.*
copy /Y %SYS_PATH_AND_NAME% ..\Install\%INST_OS%\%INST_ARC%
copy /Y %PDB_PATH_AND_NAME% ..\Install\%INST_OS%\%INST_ARC%
copy /Y %INF_PATH_AND_NAME% ..\Install\%INST_OS%\%INST_ARC%\%SYS_NAME%.inf

set INST_OS=
set INST_ARC=
set SYS_NAME=
set INF_NAME=
set SYS_PATH_AND_NAME=
set PDB_PATH_AND_NAME=
set INF_PATH_AND_NAME=
set DDKVER=
set BUILDROOT=

@echo off
: Param1 - Win7 | Wlh | Wnet | XP
: Param2 - x86|x64
: Param3 - sys name
: Param3 - inf name

if "%2"=="x64" set %%2=amd64

if /i "%1"=="Win7" goto :checkarch
if /i "%1"=="Wlh" goto :checkarch
if /i "%1"=="Wnet" goto :checkarch
if /i "%1"=="WXp" goto :checkarch
goto :printerr
:checkarch
if /i "%2"=="x86" goto :makeinstall
if /i "%2"=="x64" goto :makeinstall
:printerr
echo wrong parameters (1)%1 (2)%2 (3)%3
pause
goto :eof

:makeinstall
if "%DDKVER%"=="" set DDKVER=7600.16385.0
set BUILDROOT=C:\WINDDK\%DDKVER%

set INST_OS=%1
set INST_ARC=%2
set SYS_NAME=%3
set INF_NAME=%4
rem set INST_EXT=INST_ARC

if /i "%INST_ARC%"=="x64" goto :set_x64

set INST_EXT=i386
goto :startcopy

:set_x64
set INST_ARC=amd64
set INST_EXT=amd64

:startcopy
set SYS_PATH_AND_NAME=objfre_%INST_OS%_%INST_ARC%\%INST_EXT%\%SYS_NAME%.sys
set PDB_PATH_AND_NAME=objfre_%INST_OS%_%INST_ARC%\%INST_EXT%\%SYS_NAME%.pdb
set INF_PATH_AND_NAME=%INF_NAME%.inf

rem echo makeinstall %1 %2 %3 %4
mkdir .\Install\%INST_OS%\%INST_ARC%
del /Q .\Install\%INST_OS%\%INST_ARC%\%FILE_NAME%.*
copy /Y %SYS_PATH_AND_NAME% .\Install\%INST_OS%\%INST_ARC%
copy /Y %PDB_PATH_AND_NAME% .\Install\%INST_OS%\%INST_ARC%
copy /Y %INF_PATH_AND_NAME% .\Install\%INST_OS%\%INST_ARC%\%SYS_NAME%.inf

set INST_OS=
set INST_ARC=
set SYS_NAME=
set INF_NAME=
set SYS_PATH_AND_NAME=
set PDB_PATH_AND_NAME=
set INF_PATH_AND_NAME=
set DDKVER=
set BUILDROOT=

[viostor] Create install dir under viostor directory.


@echo off

rem #
rem #Performs administrative operations on the LX subsystem
rem #
rem #Usage:
rem #    /install - Installs the subsystem
rem #        Optional arguments:
rem #            /y - Do not prompt user to accept
rem #    /uninstall - Uninstalls the subsystem
rem #        Optional arguments:
rem #            /full - Perform a full uninstall
rem #            /y - Do not prompt user to accept
rem #    /update - Updates the subsystem
rem #        Optional arguments:
rem #            /critical - Perform critical update. This option will close all running LX processes when the update completes.
rem #

rem C:\> lxrun /install /y
rem C:\> lxrun /uninstall /y

Create lxrun.bat

Create lxrun.bat