:: Copyright 2008-2012 Mentor Graphics Corporation. All rights reserved.
:: Version:   $Revision: 1.74 $
::

:: THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY
:: INFORMATION WHICH IS THE PROPERTY OF MENTOR
:: GRAPHICS CORPORATION OR ITS LICENSORS AND IS
:: SUBJECT TO LICENSE TERMS.
::

@echo off

echo Starting post-install script
SET BPVER=4.0.3

:: Localization Note: To support UNICODE paths for Source, Target, or MIP
:: location, the scripts should ignore the command line $1, $2 arguments and use
:: the MG_INSTALL_TARGET and MG_INSTALL_MSI_COMMANDER environment variables
:: instead.

:: Exit the bat file if the needed parameters are not passed.
if "%MG_INSTALL_TARGET%"=="" goto end
if "%MG_INSTALL_MSI_COMMANDER%"=="" goto end

:: Set short variable names.  Remove quotes that wrap MG_INSTALL_TARGET
for /f "useback tokens=*" %%a in ('%MG_INSTALL_TARGET%') do set TARGET=%%~a
set MSI_CMD=%MG_INSTALL_MSI_COMMANDER%

echo MG_INSTALL_TARGET is %MG_INSTALL_TARGET%
echo MG_INSTALL_MSI_COMMANDER is %MG_INSTALL_MSI_COMMANDER%
echo TARGET is %TARGET%
echo MSI_CMD is %MSI_CMD%

:: Update the following files to reflect the target location provided by the user...
echo Updating install path in config files
SET BP_PATH=mgc\BridgePoint
SET TGT_PATH=%TARGET:~3%
"%TARGET%\tools\update_text" "%TARGET%\extras\Launcher.bat" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" "%TARGET%\extras\CLI.bat" "%BP_PATH%" "%TGT_PATH%"
SET BP_PATH=C:\mgc\BridgePoint
SET TGT_PATH=%TARGET%
"%TARGET%\tools\update_text" -c "%TARGET%\tools\docgen\docgen.xsl" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" "%TARGET%\MinGW\mingwgnu.bat" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" -c "%TARGET%\extras\links\com.mentor.BridgePoint.ide.link" "%BP_PATH%" "%TGT_PATH%"
IF NOT EXIST "%TARGET%\eclipse\eclipse.ini" GOTO NoBPEclipse
  "%TARGET%\tools\update_text" "%TARGET%\eclipse\eclipse.ini" "%BP_PATH%" "%TGT_PATH%"
  :NoBPEclipse
echo Done
"%TARGET%\tools\update_text" -c "%TARGET%\eclipse_extensions\BridgePoint\eclipse\plugins\com.mentor.nucleus.bp.welcome_%BPVER%\models\GPS Watch\.classpath" "C:/MentorGraphics/BridgePoint" "%TGT_PATH%"

:: Move the eclipse-related files from "extras/" to the eclipse directory specified in "extras/eclipsedir.txt".  This will either
:: be the eclipse installation under the BP install, or the users pre-existing eclipse installation.
echo Updating Eclipse configuration
SET ECLIPSECFGFILE=%TARGET%\extras\eclipsedir.txt
IF EXIST "%ECLIPSECFGFILE%" ECHO Found the Eclipse config file %ECLIPSECFGFILE%
IF NOT EXIST "%ECLIPSECFGFILE%" GOTO EclipseUpdateError
FOR /F "tokens=1 delims=; usebackq" %%a IN ("%ECLIPSECFGFILE%") DO SET ECLIPSEDIR=%%a
IF EXIST "%ECLIPSEDIR%/links" GOTO LinksDirReady
  echo Creating %ECLIPSEDIR%/links
  %MSI_CMD% -d "%ECLIPSEDIR%/links"
  :LinksDirReady
echo Eclipse installation is at: %ECLIPSEDIR%
%MSI_CMD% -m "%TARGET%\extras\links\com.mentor.BridgePoint.ide.link" "%ECLIPSEDIR%/links/"
%MSI_CMD% -m "%TARGET%\extras\Launcher.bat" "%ECLIPSEDIR%/"
%MSI_CMD% -m "%TARGET%\extras\CLI.bat" "%ECLIPSEDIR%/"
GOTO EclipseUpdateDone
:EclipseUpdateError
echo Error during discovery of eclipse location.  %ECLIPSECFGFILE% does not exist.
:EclipseUpdateDone
echo Done

:: Create the Start Menu entries. This creates the shortcut menu start->Mentor Graphics->BridgePoint which is the short cut to
:: Launcher.bat located within the <BP Dir>/eclipse folder.  Also creates desktop shortcut.  If the same named shortcut
:: exists in USERPROFILE as well as ALLUSERSPROFILE, the USERPROFILE one will be used.  Since we are storing these shortcuts
:: in ALLUSERSPROFILE, get rid of any that exist in USERPROFILE.  We also create documentation shortcuts.  Tweak the shortuct
:: we copy to the desktop to run minimized
echo Creating shortcuts
IF EXIST "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint.lnk" DEL "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint.lnk"
IF EXIST "%USERPROFILE%\Desktop\BridgePoint.lnk" DEL "%USERPROFILE%\Desktop\BridgePoint.lnk"
IF EXIST "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint Documentation" RMDIR /S /Q "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint Documentation"
%MSI_CMD% -a "Mentor Graphics" BridgePoint  "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE
echo Done

:: Create desktop shortcut or not depending on their selection in the installer.
echo Create desktop shortcut (or not)
SET CSFLAGFILE=%TARGET%\extras\csflag.txt
IF EXIST "%CSFLAGFILE%" ECHO Found the create shortcut flag file %CSFLAGFILE%
IF NOT EXIST "%CSFLAGFILE%" GOTO CreateShortcutDone
::%MSI_CMD% -k TRUE "BridgePoint" "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE
::"%TARGET%\tools\bp_run_min.vbs"
cscript "%TARGET%\tools\create_shortcut.vbs" TRUE "BridgePoint" "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE
DEL "%CSFLAGFILE%"
GOTO CreateShortcutDone
:CreateShortcutDone
echo Done

:: Show release notes or not depending on their selection in the installer.
echo Release notes display (or not)
SET RNFLAGFILE=%TARGET%\extras\rnflag.txt
IF EXIST "%RNFLAGFILE%" ECHO Found the Release notes flag file %RNFLAGFILE%
IF NOT EXIST "%RNFLAGFILE%" GOTO ReleaseNotesDone
rundll32.exe url.dll,FileProtocolHandler "%TARGET%\eclipse_extensions\BridgePoint\eclipse\plugins\com.mentor.nucleus.bp.doc_%BPVER%\ReleaseNotes\HTML\ReleaseNotes.htm"
DEL "%RNFLAGFILE%"
GOTO ReleaseNotesDone
:ReleaseNotesDone
echo Done

::Run the vcredist_x86.exe to update the runtime libraries. The redist package
::is only installed if the user has admin rights.  We determine this by checking
::the return value of the helper app.
echo Launching vcredist installer
"%TARGET%\tools\CheckPrivileges.exe"
IF %ERRORLEVEL% NEQ 1 "%TARGET%\vcredist_x86_2005SP1.exe" /q:a
echo Done

:: Initialize eclipse p2 and configuration data
echo Initializing eclipse configuration
set BP_JVM=%TARGET%\jre\bin\javaw.exe
"%TARGET%\eclipse\eclipse.exe" -vm %BP_JVM% -initialize
echo Done

:end
echo Post-install script complete

:: Copyright 2008-2012 Mentor Graphics Corporation. All rights reserved.
:: Version:   $Revision: 1.74 $
::

:: THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY
:: INFORMATION WHICH IS THE PROPERTY OF MENTOR
:: GRAPHICS CORPORATION OR ITS LICENSORS AND IS
:: SUBJECT TO LICENSE TERMS.
::

@echo off

echo Starting post-install script
SET BPVER=4.0.3

:: Localization Note: To support UNICODE paths for Source, Target, or MIP
:: location, the scripts should ignore the command line $1, $2 arguments and use
:: the MG_INSTALL_TARGET and MG_INSTALL_MSI_COMMANDER environment variables
:: instead.

:: Exit the bat file if the needed parameters are not passed.
if "%MG_INSTALL_TARGET%"=="" goto end
if "%MG_INSTALL_MSI_COMMANDER%"=="" goto end

:: Set short variable names.  Remove quotes that wrap MG_INSTALL_TARGET
for /f "useback tokens=*" %%a in ('%MG_INSTALL_TARGET%') do set TARGET=%%~a
set MSI_CMD=%MG_INSTALL_MSI_COMMANDER%

echo MG_INSTALL_TARGET is %MG_INSTALL_TARGET%
echo MG_INSTALL_MSI_COMMANDER is %MG_INSTALL_MSI_COMMANDER%
echo TARGET is %TARGET%
echo MSI_CMD is %MSI_CMD%

:: Update the following files to reflect the target location provided by the user...
echo Updating install path in config files
SET BP_PATH=mgc\BridgePoint
SET TGT_PATH=%TARGET:~3%
"%TARGET%\tools\update_text" "%TARGET%\extras\Launcher.bat" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" "%TARGET%\extras\CLI.bat" "%BP_PATH%" "%TGT_PATH%"
SET BP_PATH=C:\mgc\BridgePoint
SET TGT_PATH=%TARGET%
"%TARGET%\tools\update_text" -c "%TARGET%\tools\docgen\docgen.xsl" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" "%TARGET%\MinGW\mingwgnu.bat" "%BP_PATH%" "%TGT_PATH%"
"%TARGET%\tools\update_text" -c "%TARGET%\extras\links\com.mentor.BridgePoint.ide.link" "%BP_PATH%" "%TGT_PATH%"
IF NOT EXIST "%TARGET%\eclipse\eclipse.ini" GOTO NoBPEclipse
  "%TARGET%\tools\update_text" "%TARGET%\eclipse\eclipse.ini" "%BP_PATH%" "%TGT_PATH%"
  :NoBPEclipse
echo Done
"%TARGET%\tools\update_text" -c "%TARGET%\eclipse_extensions\BridgePoint\eclipse\plugins\com.mentor.nucleus.bp.welcome_%BPVER%\models\GPS Watch\.classpath" "C:/MentorGraphics/BridgePoint" "%TGT_PATH%"

:: Move the eclipse-related files from "extras/" to the eclipse directory specified in "extras/eclipsedir.txt".  This will either
:: be the eclipse installation under the BP install, or the users pre-existing eclipse installation.
echo Updating Eclipse configuration
SET ECLIPSECFGFILE=%TARGET%\extras\eclipsedir.txt
IF EXIST "%ECLIPSECFGFILE%" ECHO Found the Eclipse config file %ECLIPSECFGFILE%
IF NOT EXIST "%ECLIPSECFGFILE%" GOTO EclipseUpdateError
FOR /F "tokens=1 delims=; usebackq" %%a IN ("%ECLIPSECFGFILE%") DO SET ECLIPSEDIR=%%a
IF EXIST "%ECLIPSEDIR%/links" GOTO LinksDirReady
  echo Creating %ECLIPSEDIR%/links
  %MSI_CMD% -d "%ECLIPSEDIR%/links"
  :LinksDirReady
echo Eclipse installation is at: %ECLIPSEDIR%
%MSI_CMD% -m "%TARGET%\extras\links\com.mentor.BridgePoint.ide.link" "%ECLIPSEDIR%/links/"
%MSI_CMD% -m "%TARGET%\extras\Launcher.bat" "%ECLIPSEDIR%/"
%MSI_CMD% -m "%TARGET%\extras\CLI.bat" "%ECLIPSEDIR%/"
GOTO EclipseUpdateDone
:EclipseUpdateError
echo Error during discovery of eclipse location.  %ECLIPSECFGFILE% does not exist.
:EclipseUpdateDone
echo Done

:: Create the Start Menu entries. This creates the shortcut menu start->Mentor Graphics->BridgePoint which is the short cut to
:: Launcher.bat located within the <BP Dir>/eclipse folder.  Also creates desktop shortcut.  If the same named shortcut
:: exists in USERPROFILE as well as ALLUSERSPROFILE, the USERPROFILE one will be used.  Since we are storing these shortcuts
:: in ALLUSERSPROFILE, get rid of any that exist in USERPROFILE.  We also create documentation shortcuts.  Tweak the shortuct
:: we copy to the desktop to run minimized
echo Creating shortcuts
IF EXIST "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint.lnk" DEL "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint.lnk"
IF EXIST "%USERPROFILE%\Desktop\BridgePoint.lnk" DEL "%USERPROFILE%\Desktop\BridgePoint.lnk"
IF EXIST "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint Documentation" RMDIR /S /Q "%USERPROFILE%\Start Menu\Programs\Mentor Graphics\BridgePoint Documentation"
%MSI_CMD% -a "Mentor Graphics" BridgePoint  "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE
echo Done

:: Create desktop shortcut or not depending on their selection in the installer.
echo Create desktop shortcut (or not)
SET CSFLAGFILE=%TARGET%\extras\csflag.txt
IF EXIST "%CSFLAGFILE%" ECHO Found the create shortcut flag file %CSFLAGFILE%
IF NOT EXIST "%CSFLAGFILE%" GOTO CreateShortcutDone
::"msi_cmd -k <AllUsersDesktop> <name> <command> <params> <workingDir> <iconPath> <nIcon> <shortcut> <replace> <runMinimized>"
%MSI_CMD% -k TRUE "BridgePoint" "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE TRUE
::"%TARGET%\tools\bp_run_min.vbs"
::cscript "%TARGET%\tools\create_shortcut.vbs" TRUE "BridgePoint" "%ECLIPSEDIR%\Launcher.bat" "" "%ECLIPSEDIR%" "%TARGET%\bp.ico" 0 "" TRUE
DEL "%CSFLAGFILE%"
GOTO CreateShortcutDone
:CreateShortcutDone
echo Done

:: Show release notes or not depending on their selection in the installer.
echo Release notes display (or not)
SET RNFLAGFILE=%TARGET%\extras\rnflag.txt
IF EXIST "%RNFLAGFILE%" ECHO Found the Release notes flag file %RNFLAGFILE%
IF NOT EXIST "%RNFLAGFILE%" GOTO ReleaseNotesDone
rundll32.exe url.dll,FileProtocolHandler "%TARGET%\eclipse_extensions\BridgePoint\eclipse\plugins\com.mentor.nucleus.bp.doc_%BPVER%\ReleaseNotes\HTML\ReleaseNotes.htm"
DEL "%RNFLAGFILE%"
GOTO ReleaseNotesDone
:ReleaseNotesDone
echo Done

::Run the vcredist_x86.exe to update the runtime libraries. The redist package
::is only installed if the user has admin rights.  We determine this by checking
::the return value of the helper app.
echo Launching vcredist installer
"%TARGET%\tools\CheckPrivileges.exe"
IF %ERRORLEVEL% NEQ 1 "%TARGET%\vcredist_x86_2005SP1.exe" /q:a
echo Done

:: Initialize eclipse p2 and configuration data
echo Initializing eclipse configuration
set BP_JVM=%TARGET%\jre\bin\javaw.exe
"%TARGET%\eclipse\eclipse.exe" -vm %BP_JVM% -initialize
echo Done

:end
echo Post-install script complete

Update post_install_script.bat

Update post_install_script.bat

job #5 - Update the windows post-install to create the desktop shortcut using the MIP commander built-in command rather than our own VB script app.


@echo Copyright (C) 2005-2006 SIPfoundry Inc.
@echo Licensed by SIPfoundry under the LGPL license.
@echo -
@echo Copyright (C) 2005-2006 SIPez LLC.
@echo Licensed to SIPfoundry under a Contributor Agreement.
@echo -
@echo Building sipX using MS Visual Studio 6.0

@set doClean=
if "%1" == "clean" set doClean="/CLEAN"
if "%1" == "check" goto run_unittests
@set releaseType=Debug
@set libPrefix=d
@echo set releaseType=Release
@echo set libPrefix

@msdev /? > nul
@rem error level: %ERRORLEVEL%
@if %ERRORLEVEL% GTR 0 call "vcvars32"
@rem Add include and library specifiers to the environment, since for some
@rem reason, VMware execution of a guest command via their api doesn't seem
@rem to allow access to HKCU properly ("default" user probably)

cd sipXportLib
del %releaseType%\sipXportLib%libPrefix%.lib
msdev sipXportLib.dsp /MAKE "sipXportLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXportLib
del %releaseType%\sipXportLibTest.exe
msdev sipXportLibTest.dsp /MAKE "sipXportLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXsdpLib
del %releaseType%\sipXsdpLib%libPrefix%.lib
msdev sipXsdpLib.dsp /MAKE "sipXsdpLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXtackLib
del %releaseType%\sipXtackLib%libPrefix%.lib
msdev sipXtackLib.dsp /MAKE "sipXtackLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXsdpLib
del %releaseType%\sipXsdpLibTest.exe
msdev sipXsdpLibTest.dsp /MAKE "sipXsdpLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXtackLib
del %releaseType%\sipXtackLibTest.exe
msdev sipXtackLibTest.dsp /MAKE "sipXtackLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaLib
del %releaseType%\sipXmediaLib%libPrefix%.lib
msdev sipXmediaLib.dsp /MAKE "sipXmediaLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaLib\contrib\libgsm
del %releaseType%\gsm%libPrefix%.lib
msdev libgsm.dsp /MAKE "libgsm - Win32 %releaseType%" %doClean%
cd ..\..\..

cd sipXmediaLib
del %releaseType%\sipXmediaLibTest.exe
msdev sipXmediaLibTest.dsp /MAKE "sipXmediaLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaAdapterLib
del %releaseType%\sipXmediaAdapterLib%libPrefix%.lib
msdev sipXmediaAdapterLib.dsp /MAKE "sipXmediaAdapterLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaAdapterLib
del %releaseType%\sipXmediaAdapterLibTest.exe
msdev sipXmediaAdapterLibTest.dsp /MAKE "sipXmediaAdapterLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del %releaseType%\sipXcallLib%libPrefix%.lib
msdev sipXcallLib.dsp /MAKE "sipXcallLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del %releaseType%\sipXcallLibTest.exe
msdev sipXcallLibTest.dsp /MAKE "sipXcallLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del sipXtapi\%releaseType%\sipXtapiTest.exe
msdev sipXtapiTest.dsp /MAKE "sipXtapiTest - Win32 %releaseType%" %doClean%
cd ..

goto end

cd sipXcallLib\examples\sipXezPhone
del Debug\sipXezPhone.exe
msdev sipXezPhone.dsp /MAKE "sipXezPhone - Win32 Debug" %doClean%
cd ..\..\..

cd sipXcommserverLib
del Debug\sipXcommserverLibd.lib
msdev sipXcommserverLib.dsp /MAKE "sipXcommserverLib - Win32 Debug" %doClean%
cd ..

cd sipXregistry
del Debug\sipXregistry.exe
msdev sipXregistry.dsp /MAKE "sipXregistry - Win32 Debug" %doClean%
cd ..

cd sipXproxy
del Debug\sipXforkingProxy.exe
msdev sipXforkingProxy.dsp /MAKE "sipXforkingProxy - Win32 Debug" %doClean%
cd ..

cd sipXproxy
del Debug\sipXauthproxy.exe
msdev sipXauthproxy.dsp /MAKE "sipXauthproxy - Win32 Debug" %doClean%
cd ..

goto end

:run_unittests
REM Here we run the unit tests
@echo off
set DEPD=C:\build\sipx-depends
set PATH=c:\Program Files\GnuWin32\bin;%DEPD%\cppunit-1.10.2\lib;%DEPD%\pcre\bin;%DEPD%\openssl\out32.dbg;%DEPD%\libgsm\lib;%DEPD%\libspeex\lib;%PATH%

set NAME_PREFIX=test-test-
if not "%1" == "" set NAME_PREFIX=%1
echo logging in %NAME_PREFIX% files
svn info | grep Revision

sipXportLib\Debug\sipXportLibTest.exe 2> %NAME_PREFIX%port.err.txt > %NAME_PREFIX%port.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXportLib - /" %NAME_PREFIX%port.txt

sipXtackLib\Debug\sipXtackLibTest.exe 2> %NAME_PREFIX%stack.err.txt > %NAME_PREFIX%stack.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXtackLib - /" %NAME_PREFIX%stack.txt

sipXmediaLib\Debug\sipXmediaLibTest.exe 2> %NAME_PREFIX%media.err.txt > %NAME_PREFIX%media.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXmediaLib - /" %NAME_PREFIX%media.txt

sipXmediaAdapterLib\Debug\sipXmediaAdapterLibTest.exe 2> %NAME_PREFIX%adapter.err.txt > %NAME_PREFIX%adapter.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXmediaAdapterLib - /" %NAME_PREFIX%adapter.txt

sipXcallLib\Debug\sipXcallLibTest.exe 2> %NAME_PREFIX%call.err.txt > %NAME_PREFIX%call.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXcallLib - /" %NAME_PREFIX%call.txt

sipXcallLib\sipXtapi\Debug\sipXtapiTest.exe 2> %NAME_PREFIX%tapi.err.txt > %NAME_PREFIX%tapi.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXtapi - /" %NAME_PREFIX%tapi.txt

:end
REM Print the current directory
cd

@echo Copyright (C) 2005-2006 SIPfoundry Inc.
@echo Licensed by SIPfoundry under the LGPL license.
@echo -
@echo Copyright (C) 2005-2006 SIPez LLC.
@echo Licensed to SIPfoundry under a Contributor Agreement.
@echo -
@echo Building sipX using MS Visual Studio 6.0

@set doClean=
if "%1" == "clean" set doClean="/CLEAN"
if "%1" == "check" goto run_unittests
@set releaseType=Debug
@set libPrefix=d
@echo set releaseType=Release
@echo set libPrefix

@msdev /? > nul
@rem error level: %ERRORLEVEL%
@if %ERRORLEVEL% GTR 0 call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32"
@rem Add include and library specifiers to the environment, since for some
@rem reason, VMware execution of a guest command via their api doesn't seem
@rem to allow access to HKCU properly ("default" user probably)
set DEPD=c:\build\sipx-depends
set INCLUDE=%DEPD%\cppunit-1.10.2\include;%DEPD%\pcre\include;%DEPD%\openssl\inc32;%DEPD%\libspeex\include;%INCLUDE%
set LIB=%DEPD%\cppunit-1.10.2\lib;%DEPD%\pcre\lib;%DEPD%\openssl\out32.dbg;%DEPD%\libgsm\lib;%DEPD%\libspeex\lib;%LIB%

cd sipXportLib
del %releaseType%\sipXportLib%libPrefix%.lib
msdev sipXportLib.dsp /USEENV /MAKE "sipXportLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXportLib
del %releaseType%\sipXportLibTest.exe
msdev sipXportLibTest.dsp /USEENV /MAKE "sipXportLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXsdpLib
del %releaseType%\sipXsdpLib%libPrefix%.lib
msdev sipXsdpLib.dsp /MAKE "sipXsdpLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXtackLib
del %releaseType%\sipXtackLib%libPrefix%.lib
msdev sipXtackLib.dsp /USEENV /MAKE "sipXtackLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXsdpLib
del %releaseType%\sipXsdpLibTest.exe
msdev sipXsdpLibTest.dsp /MAKE "sipXsdpLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXtackLib
del %releaseType%\sipXtackLibTest.exe
msdev sipXtackLibTest.dsp /USEENV /MAKE "sipXtackLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaLib
del %releaseType%\sipXmediaLib%libPrefix%.lib
msdev sipXmediaLib.dsp /USEENV /MAKE "sipXmediaLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaLib\contrib\libgsm
del %releaseType%\gsm%libPrefix%.lib
msdev libgsm.dsp /USEENV /MAKE "libgsm - Win32 %releaseType%" %doClean%
cd ..\..\..

cd sipXmediaLib
del %releaseType%\sipXmediaLibTest.exe
msdev sipXmediaLibTest.dsp /USEENV /MAKE "sipXmediaLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaAdapterLib
del %releaseType%\sipXmediaAdapterLib%libPrefix%.lib
msdev sipXmediaAdapterLib.dsp /USEENV /MAKE "sipXmediaAdapterLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXmediaAdapterLib
del %releaseType%\sipXmediaAdapterLibTest.exe
msdev sipXmediaAdapterLibTest.dsp /USEENV /MAKE "sipXmediaAdapterLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del %releaseType%\sipXcallLib%libPrefix%.lib
msdev sipXcallLib.dsp /USEENV /MAKE "sipXcallLib - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del %releaseType%\sipXcallLibTest.exe
msdev sipXcallLibTest.dsp /USEENV /MAKE "sipXcallLibTest - Win32 %releaseType%" %doClean%
cd ..

cd sipXcallLib
del sipXtapi\%releaseType%\sipXtapiTest.exe
msdev sipXtapiTest.dsp /USEENV /MAKE "sipXtapiTest - Win32 %releaseType%" %doClean%
cd ..

goto end

cd sipXcallLib\examples\sipXezPhone
del Debug\sipXezPhone.exe
msdev sipXezPhone.dsp /USEENV /MAKE "sipXezPhone - Win32 Debug" %doClean%
cd ..\..\..

cd sipXcommserverLib
del Debug\sipXcommserverLibd.lib
msdev sipXcommserverLib.dsp /USEENV /MAKE "sipXcommserverLib - Win32 Debug" %doClean%
cd ..

cd sipXregistry
del Debug\sipXregistry.exe
msdev sipXregistry.dsp /USEENV /MAKE "sipXregistry - Win32 Debug" %doClean%
cd ..

cd sipXproxy
del Debug\sipXforkingProxy.exe
msdev sipXforkingProxy.dsp /USEENV /MAKE "sipXforkingProxy - Win32 Debug" %doClean%
cd ..

cd sipXproxy
del Debug\sipXauthproxy.exe
msdev sipXauthproxy.dsp /USEENV /MAKE "sipXauthproxy - Win32 Debug" %doClean%
cd ..

goto end

:run_unittests
REM Here we run the unit tests
@echo off
set DEPD=C:\build\sipx-depends
set PATH=c:\Program Files\GnuWin32\bin;%DEPD%\cppunit-1.10.2\lib;%DEPD%\pcre\bin;%DEPD%\openssl\out32.dbg;%DEPD%\libgsm\lib;%DEPD%\libspeex\lib;%PATH%

set NAME_PREFIX=test-test-
if not "%1" == "" set NAME_PREFIX=%1
echo logging in %NAME_PREFIX% files
svn info | grep Revision

sipXportLib\Debug\sipXportLibTest.exe 2> %NAME_PREFIX%port.err.txt > %NAME_PREFIX%port.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXportLib - /" %NAME_PREFIX%port.txt

sipXtackLib\Debug\sipXtackLibTest.exe 2> %NAME_PREFIX%stack.err.txt > %NAME_PREFIX%stack.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXtackLib - /" %NAME_PREFIX%stack.txt

sipXmediaLib\Debug\sipXmediaLibTest.exe 2> %NAME_PREFIX%media.err.txt > %NAME_PREFIX%media.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXmediaLib - /" %NAME_PREFIX%media.txt

sipXmediaAdapterLib\Debug\sipXmediaAdapterLibTest.exe 2> %NAME_PREFIX%adapter.err.txt > %NAME_PREFIX%adapter.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXmediaAdapterLib - /" %NAME_PREFIX%adapter.txt

sipXcallLib\Debug\sipXcallLibTest.exe 2> %NAME_PREFIX%call.err.txt > %NAME_PREFIX%call.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXcallLib - /" %NAME_PREFIX%call.txt

sipXcallLib\sipXtapi\Debug\sipXtapiTest.exe 2> %NAME_PREFIX%tapi.err.txt > %NAME_PREFIX%tapi.txt
sed -e "/^\(OK (\|Run:\)/!d;s/^/sipXtapi - /" %NAME_PREFIX%tapi.txt

:end
REM Print the current directory
cd

Rollback unintended changes to buildmsvs6.bat so that it works with the automated build process again.

git-svn-id: 5274dacc98e2a95d0b0452670772bfdffe61ca90@8992 a612230a-c5fa-0310-af8b-88eea846685b


@ echo off
@ echo Salt Windows Build Script
@ echo.

:: Define Variables
@ echo Defining Variables...
@ echo ---------------------
Set "CurrDir=%cd%"
Set "BinDir=%cd%\buildenv\bin"
Set "InsDir=%cd%\installer"
Set "PyDir=C:\Python27"
Set "Version=%1"

:: Find the NSIS Installer
If Exist "C:\Program Files\NSIS\" (
    Set NSIS="C:\Program Files\NSIS\"
) Else (
    Set NSIS="C:\Program Files (x86)\NSIS\"
)
Set "PATH=%NSIS%;%PATH%"
@ echo.

@ echo Copying C:\Python27 to bin...
@ echo -----------------------------
:: Check for existing bin directory and remove
If Exist "%BinDir%\" rd /S /Q "%BinDir%"

:: Copy the Python27 directory to bin
@echo xcopy /S /E "%PyDir%" "%BinDir%\"
xcopy /S /E "%PyDir%" "%BinDir%\"
@ echo.

:: Remove the fixed path in .exe files
@echo Removing fixed path from .exe files
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\easy_install.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\easy_install-2.7.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip2.7.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip2.exe"

@ echo Cleaning up unused files and directories...
@ echo -------------------------------------------
:: Remove all Compiled Python files (.pyc)
del /S /Q "%BinDir%\*.pyc"
:: Remove all Compiled HTML Help (.chm)
del /S /Q "%BinDir%\*.chm"
:: Remove all empty text files (they are placeholders for git)
del /S /Q "%BinDir%\empty"

:: Delete Unused Docs and Modules
If Exist "%BinDir%\Doc"           rd /S /Q "%BinDir%\Doc"
If Exist "%BinDir%\share"         rd /S /Q "%BinDir%\share"
If Exist "%BinDir%\tcl"           rd /S /Q "%BinDir%\tcl"
If Exist "%BinDir%\Lib\idlelib"   rd /S /Q "%BinDir%\Lib\idlelib"
If Exist "%BinDir%\Lib\lib-tk"    rd /S /Q "%BinDir%\Lib\lib-tk"
If Exist "%BinDir%\Lib\test"      rd /S /Q "%BinDir%\Lib\test"
If Exist "%BinDir%\Lib\unit-test" rd /S /Q "%BinDir%\Lib\unit-test"

:: Delete Unused .dll files
If Exist "%BinDir%\DLLs\tcl85.dll"    del /S /Q "%BinDir%\DLLs\tcl85.dll"
If Exist "%BinDir%\DLLs\tclpip85.dll" del /S /Q "%BinDir%\DLLs\tclpip85.dll"
If Exist "%BinDir%\DLLs\tk85.dll"     del /S /Q "%BinDir%\DLLs\tk85.dll"

:: Delete Unused .lib files
If Exist "%BinDir%\libs\_tkinter.lib" del /S /Q "%BinDir%\libs\_tkinter.lib"

:: Delete .txt files
If Exist "%BinDir%\NEWS.txt"   del /q "%BinDir%\NEWS.txt"
If Exist "%BinDir%\README.txt" del /q "%BinDir%\README.txt"
@ echo.

@ echo Building the installer...
@ echo -------------------------
makensis.exe /DSaltVersion=%Version% "%InsDir%\Salt-Minion-Setup.nsi"
@ echo.

@ echo.
@ echo ===================
@ echo Script completed...
@ echo -------------------
@ echo Installation file can be found in the following directory:
@ echo %InsDir%

:done
if [%Version%] == [] pause

@ echo off
@ echo Salt Windows Build Script
@ echo.

:: Define Variables
@ echo Defining Variables...
@ echo ---------------------
Set "CurrDir=%cd%"
Set "BinDir=%cd%\buildenv\bin"
Set "InsDir=%cd%\installer"
Set "PyDir=C:\Python27"
Set "Version=%1"

:: Find the NSIS Installer
If Exist "C:\Program Files\NSIS\" (
    Set NSIS="C:\Program Files\NSIS\"
) Else (
    Set NSIS="C:\Program Files (x86)\NSIS\"
)
Set "PATH=%NSIS%;%PATH%"
@ echo.

@ echo Copying C:\Python27 to bin...
@ echo -----------------------------
:: Check for existing bin directory and remove
If Exist "%BinDir%\" rd /S /Q "%BinDir%"

:: Copy the Python27 directory to bin
@echo xcopy /S /E "%PyDir%" "%BinDir%\"
xcopy /S /E "%PyDir%" "%BinDir%\"
@ echo.

:: Remove the fixed path in .exe files
@echo Removing fixed path from .exe files
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\easy_install.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\easy_install-2.7.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip2.7.exe"
python "%CurrDir%\portable.py" -f "%BinDir%\Scripts\pip2.exe"

@ echo Cleaning up unused files and directories...
@ echo -------------------------------------------
:: Remove all Compiled Python files (.pyc)
del /S /Q "%BinDir%\*.pyc"
:: Remove all Compiled HTML Help (.chm)
del /S /Q "%BinDir%\*.chm"
:: Remove all empty text files (they are placeholders for git)
del /S /Q "%BinDir%\empty.*"

:: Delete Unused Docs and Modules
If Exist "%BinDir%\Doc"           rd /S /Q "%BinDir%\Doc"
If Exist "%BinDir%\share"         rd /S /Q "%BinDir%\share"
If Exist "%BinDir%\tcl"           rd /S /Q "%BinDir%\tcl"
If Exist "%BinDir%\Lib\idlelib"   rd /S /Q "%BinDir%\Lib\idlelib"
If Exist "%BinDir%\Lib\lib-tk"    rd /S /Q "%BinDir%\Lib\lib-tk"
If Exist "%BinDir%\Lib\test"      rd /S /Q "%BinDir%\Lib\test"
If Exist "%BinDir%\Lib\unit-test" rd /S /Q "%BinDir%\Lib\unit-test"

:: Delete Unused .dll files
If Exist "%BinDir%\DLLs\tcl85.dll"    del /S /Q "%BinDir%\DLLs\tcl85.dll"
If Exist "%BinDir%\DLLs\tclpip85.dll" del /S /Q "%BinDir%\DLLs\tclpip85.dll"
If Exist "%BinDir%\DLLs\tk85.dll"     del /S /Q "%BinDir%\DLLs\tk85.dll"

:: Delete Unused .lib files
If Exist "%BinDir%\libs\_tkinter.lib" del /S /Q "%BinDir%\libs\_tkinter.lib"

:: Delete .txt files
If Exist "%BinDir%\NEWS.txt"   del /q "%BinDir%\NEWS.txt"
If Exist "%BinDir%\README.txt" del /q "%BinDir%\README.txt"
@ echo.

@ echo Building the installer...
@ echo -------------------------
makensis.exe /DSaltVersion=%Version% "%InsDir%\Salt-Minion-Setup.nsi"
@ echo.

@ echo.
@ echo ===================
@ echo Script completed...
@ echo -------------------
@ echo Installation file can be found in the following directory:
@ echo %InsDir%

:done
if [%Version%] == [] pause

Remove placeholder files

Remove placeholder files


update minor version

update minor version


@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://cygwin.mirrors.pair.com/
SET SSHD_PORT=13610

REM -- Additional variables
SET ADD_ARGS=""
SET LOCALDIR="%ROOTDIR%\setup"
set HSTART_URL=http://files.ntwind.com/download/Hstart_4.2-bin.zip
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
	SET SETUP_NAME=setup-x86.exe
	SET HSTART_BIN=hstart.exe
) else (
	SET SETUP_NAME=setup-x86_64.exe
	SET HSTART_BIN=hstart64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs
REM -- Get the user's startup directory
for /F "skip=2 tokens=2*" %%j in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Startup"') do set STARTUP_DIR=%%k

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO 	WScript.Echo "FAILED to download: HTTP Status " ^& status       >> %DLOAD_SCRIPT%
ECHO 	WScript.Quit 1                                                  >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,cygutils-extra,git,git-completion,git-svn,gnupg
SET PACKAGES=%PACKAGES%,inetutils,nc,nc6,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,GraphicsMagick,ImageMagick,aspell,aspell-en,bzip2,fdupes,heimdal,mkisofs,p7zip

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%"
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" -P "%PACKAGES%"

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/UsePrivilegeSeparation no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo > /etc/motd"

REM -- download hstart
IF NOT EXIST "%ROOTDIR%\startup\%HSTART_BIN%" (
	"%ROOTDIR%\bin\bash.exe" --login -c "mkdir /startup"
	"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /tmp/hstart.zip %HSTART_URL% && unzip -p /tmp/hstart.zip %HSTART_BIN% > /startup/%HSTART_BIN%"
	"%ROOTDIR%\bin\bash.exe" --login -c "rm -f /tmp/hstart.zip"
)

REM -- create the startup entry for ssh to run on login
IF NOT EXIST "%ROOTDIR%\startup\sshd.cmd" (
echo ^
SET PATH=%%PATH%%;%ROOTDIR%\bin^

chdir %ROOTDIR%^

start "" "%ROOTDIR%\startup\%HSTART_BIN%" /noconsole /elevate "%ROOTDIR%\bin\bash.exe --login -c '/usr/sbin/sshd.exe -D'"^
 > "%ROOTDIR%\startup\sshd.cmd"
)

IF NOT EXIST "%STARTUP_DIR%\sshd.cmd" (
	mklink "%STARTUP_DIR%\sshd.cmd" "%ROOTDIR%\startup\sshd.cmd"
)

IF NOT EXIST "%ROOTDIR%\cygsetup.cmd" (
	echo "%ROOTDIR%\%SETUP_NAME%" -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" > "%ROOTDIR%\cygsetup.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://mirrors.kernel.org/sourceware/cygwin/
SET SSHD_PORT=13610

REM -- Additional variables
SET ADD_ARGS=""
SET LOCALDIR="%ROOTDIR%\setup"
set HSTART_URL=http://files.ntwind.com/download/Hstart_4.2-bin.zip
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
	SET SETUP_NAME=setup-x86.exe
	SET HSTART_BIN=hstart.exe
) else (
	SET SETUP_NAME=setup-x86_64.exe
	SET HSTART_BIN=hstart64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs
REM -- Get the user's startup directory
for /F "skip=2 tokens=2*" %%j in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Startup"') do set STARTUP_DIR=%%k

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO 	WScript.Echo "FAILED to download: HTTP Status " ^& status       >> %DLOAD_SCRIPT%
ECHO 	WScript.Quit 1                                                  >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,cygutils-extra,git,git-completion,git-svn,gnupg
SET PACKAGES=%PACKAGES%,inetutils,nc,nc6,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,GraphicsMagick,ImageMagick,aspell,aspell-en,bzip2,fdupes,heimdal,mkisofs,p7zip

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" %ADD_ARGS%
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" -P "%PACKAGES%" %ADD_ARGS%

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/UsePrivilegeSeparation no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo > /etc/motd"

REM -- download hstart
IF NOT EXIST "%ROOTDIR%\startup\%HSTART_BIN%" (
	"%ROOTDIR%\bin\bash.exe" --login -c "mkdir /startup"
	"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /tmp/hstart.zip %HSTART_URL% && unzip -p /tmp/hstart.zip %HSTART_BIN% > /startup/%HSTART_BIN%"
	"%ROOTDIR%\bin\bash.exe" --login -c "rm -f /tmp/hstart.zip"
)

REM -- create the startup entry for ssh to run on login
IF NOT EXIST "%ROOTDIR%\startup\sshd.cmd" (
echo ^
SET PATH=%%PATH%%;%ROOTDIR%\bin^

chdir %ROOTDIR%^

start "" "%ROOTDIR%\startup\%HSTART_BIN%" /noconsole /elevate ""%ROOTDIR%\bin\bash.exe" --login -c '/usr/sbin/sshd.exe -D'"^
 > "%ROOTDIR%\startup\sshd.cmd"
)

IF NOT EXIST "%STARTUP_DIR%\sshd.cmd" (
	mklink "%STARTUP_DIR%\sshd.cmd" "%ROOTDIR%\startup\sshd.cmd"
)

IF NOT EXIST "%ROOTDIR%\cygsetup.cmd" (
	echo "%ROOTDIR%\%SETUP_NAME%" -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" > "%ROOTDIR%\cygsetup.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

Fix cygwin package installation issues with windows 10


MKDIR build\windows
CD build\windows

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

ECHO VS files have been generated in build\windows

dir

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

dir

move libmetis/libmetis.a %LIBRARY_BIN%
move programs/cmpfillin %LIBRARY_LIB%
move programs/gpmetis %LIBRARY_LIB%
move programs/graphchk %LIBRARY_LIB%
move programs/m2gmetis %LIBRARY_LIB%
move programs/ndmetis %LIBRARY_LIB%
move programs/mpmetis %LIBRARY_LIB%
move include/metis.h %LIBRARY_INC%/
move include/gklib_tls.h %LIBRARY_INC%/

move files

move files


SET builddir=%SRC_DIR%\..\build_dir
if errorlevel 1 exit 1

rmdir /s /q %builddir%
if errorlevel 1 exit 1
mkdir  %builddir%
if errorlevel 1 exit 1
cd %builddir%
if errorlevel 1 exit 1

cmake %SRC_DIR%
if errorlevel 1 exit 1

cmake --build %builddir% --config Release --target install
if errorlevel 1 exit 1

"%PYTHON%" setup.py install
if errorlevel 1 exit 1

SET builddir=%SRC_DIR%\..\build_dir

if "%ARCH%" == "64" (
  set cmake_gen="Visual Studio 14 2015 Win64"
) else (
  set cmake_gen="Visual Studio 14 2015"
)

rmdir /s /q %builddir%
if errorlevel 1 exit 1
mkdir  %builddir%
if errorlevel 1 exit 1
cd %builddir%
if errorlevel 1 exit 1

cmake %SRC_DIR% -G %cmake_gen%
if errorlevel 1 exit 1

cmake --build %builddir% --config Release --target install
if errorlevel 1 exit 1

"%PYTHON%" setup.py install
if errorlevel 1 exit 1

fix Windows cmake generator

fix Windows cmake generator


ring ..\codegen\parsec.ring qt.cf ring_qt.cpp ring_qt.ring
ring qtevents.ring

Add file gencode.bat

Add file gencode.bat


echo on

set PATH=C:\Windows\system32;C:\Windows;%PYTHON3_PATH%;%PYTHON3_PATH%\Scripts;%CMAKE_PATH%;

if not "%VCVARSALL_DIR%" == "" CALL "%VCVARSALL_DIR%\vcvarsall.bat" amd64

if not "%MINGW_PATH%" == "" SET PATH=%PATH%%MINGW_PATH%;

setx PATH "%PATH%"

mkdir C:\Fruit\build-%CONFIGURATION%
cd C:\Fruit\build-%CONFIGURATION%

cmake.exe -G "%CMAKE_GENERATOR%" .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DBUILD_TESTS_IN_RELEASE_MODE=True %ADDITIONAL_CMAKE_ARGS% || exit /b 1

IF "%CMAKE_GENERATOR%"=="MinGW Makefiles" (
  mingw32-make -j12 || exit /b 1
) ELSE (
  msbuild ALL_BUILD.vcxproj || exit /b 1
)

pip3 install pytest
pip3 install pytest-xdist

ctest.exe -j 1 --output-on-failure -C %CONFIGURATION% || exit /b 1

echo on

set PATH=C:\Windows\system32;C:\Windows;%PYTHON3_PATH%;%PYTHON3_PATH%\Scripts;%CMAKE_PATH%;

if not "%VCVARSALL_DIR%" == "" CALL "%VCVARSALL_DIR%\vcvarsall.bat" amd64

if not "%MINGW_PATH%" == "" SET PATH=%PATH%%MINGW_PATH%;

setx PATH "%PATH%"

mkdir C:\Fruit\build-%CONFIGURATION%
cd C:\Fruit\build-%CONFIGURATION%

cmake.exe -G "%CMAKE_GENERATOR%" .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DBUILD_TESTS_IN_RELEASE_MODE=True %ADDITIONAL_CMAKE_ARGS% || exit /b 1

echo "Content of CMakeFiles\CMakeError.log:"
if exist "CMakeFiles\CMakeError.log"
   type "CMakeFiles\CMakeError.log"
fi

IF "%CMAKE_GENERATOR%"=="MinGW Makefiles" (
  mingw32-make -j12 || exit /b 1
) ELSE (
  msbuild ALL_BUILD.vcxproj || exit /b 1
)

pip3 install pytest
pip3 install pytest-xdist

ctest.exe -j 1 --output-on-failure -C %CONFIGURATION% || exit /b 1

Print the contents of CMakeError.log after running CMake for CI tests on Windows. This helps investigate why a CHECK_CXX_SOURCE_COMPILES check failed.


md include
md include\google
md include\google\protobuf
md include\google\protobuf\stubs
md include\google\protobuf\io
md include\google\protobuf\compiler
md include\google\protobuf\compiler\cpp
md include\google\protobuf\compiler\java
md include\google\protobuf\compiler\python
copy ..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h
copy ..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
copy ..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h
copy ..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h
copy ..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h
copy ..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h
copy ..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h
copy ..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h
copy ..\src\google\protobuf\message.h include\google\protobuf\message.h
copy ..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
copy ..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
copy ..\src\google\protobuf\service.h include\google\protobuf\service.h
copy ..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h
copy ..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
copy ..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
copy ..\src\google\protobuf\wire_format_inl.h include\google\protobuf\wire_format_inl.h
copy ..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h
copy ..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h
copy ..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h
copy ..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h
copy ..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h
copy ..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h
copy ..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h
copy ..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h
copy ..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h
copy ..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h
copy ..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h
copy ..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h

md include
md include\google
md include\google\protobuf
md include\google\protobuf\stubs
md include\google\protobuf\io
md include\google\protobuf\compiler
md include\google\protobuf\compiler\cpp
md include\google\protobuf\compiler\java
md include\google\protobuf\compiler\python
copy ..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h
copy ..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
copy ..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h
copy ..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h
copy ..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h
copy ..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h
copy ..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h
copy ..\src\google\protobuf\generated_message_util.h include\google\protobuf\generated_message_util.h
copy ..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h
copy ..\src\google\protobuf\message.h include\google\protobuf\message.h
copy ..\src\google\protobuf\message_lite.h include\google\protobuf\message_lite.h
copy ..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
copy ..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
copy ..\src\google\protobuf\service.h include\google\protobuf\service.h
copy ..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h
copy ..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
copy ..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
copy ..\src\google\protobuf\wire_format_lite.h include\google\protobuf\wire_format_lite.h
copy ..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.h
copy ..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h
copy ..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h
copy ..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h
copy ..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h
copy ..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl_lite.h include\google\protobuf\io\zero_copy_stream_impl_lite.h
copy ..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h
copy ..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h
copy ..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h
copy ..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h
copy ..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h
copy ..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h
copy ..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h

Add new headers to extract_includes.bat.

git-svn-id: 54a00c96d7caad0f188abf6e0ebede48f6547068@212 630680e5-0e50-0410-840e-4b1c322b438d


@ECHO OFF

SET PYTHON=%1
SET DIST_EGGS=%2
SET MB_EGGS=%3
SET ENV_DIR=%4

IF NOT "%PYTHON%"=="" GOTO CONTINUE
SET PYTHON=2.7
:CONTINUE

IF NOT "%DIST_EGGS%"=="" GOTO CONTINUE
SET DIST_EGGS=python
:CONTINUE

IF NOT "%MB_EGGS%"=="" GOTO CONTINUE
SET MB_EGGS=%DIST_EGGS%
:CONTINUE

IF NOT "%ENV_DIR%"==" " GOTO CONTINUE
SET ENV_DIR=virtualenv
:CONTINUE

IF EXIST %ENV_DIR% GOTO MODULES

%PYTHON% virtualenv.py --extra-search-dir=%DIST_EGGS% --never-download %ENV_DIR%

:MODULES
CALL virtualenv\Scripts\activate
easy_install -q %DIST_EGGS%\mock-1.0.1-py2.7.egg
easy_install -q %DIST_EGGS%\argparse-1.2.1-py2.7.egg
easy_install -q %DIST_EGGS%\unittest2-0.5.1-py2.7.egg
easy_install -q %DIST_EGGS%\lockfile-0.9.1-py2.7.egg

pip install -q --use-mirrors coverage doxypy unittest-xml-reporting

easy_install -q %MB_EGGS%/pyserial-2.7_mb2.1-py2.7.egg

IF EXIST %MB_EGGS%\makerbot_driver-0.1.1-py2.7.egg easy_install -q %MB_EGGS%/makerbot_driver-0.1.1-py2.7.egg

SET PYTHONPATH=%PYTHONPATH%;%CD%

:DONE

@ECHO OFF

SET PYTHON=%1
SET DIST_EGGS=%2
SET MB_EGGS=%3
SET ENV_DIR=%4

IF NOT "%PYTHON%"=="" GOTO CONTINUE
SET PYTHON=2.7
:CONTINUE

IF NOT "%DIST_EGGS%"=="" GOTO CONTINUE
SET DIST_EGGS=python
:CONTINUE

IF NOT "%MB_EGGS%"=="" GOTO CONTINUE
SET MB_EGGS=%DIST_EGGS%
:CONTINUE

IF NOT "%ENV_DIR%"==" " GOTO CONTINUE
SET ENV_DIR=virtualenv
:CONTINUE

IF EXIST %ENV_DIR% GOTO MODULES

%PYTHON% virtualenv.py --extra-search-dir=%DIST_EGGS% --never-download %ENV_DIR%

:MODULES
CALL virtualenv\Scripts\activate
easy_install -q %DIST_EGGS%\mock-1.0.1-py2.7.egg
easy_install -q %DIST_EGGS%\argparse-1.2.1-py2.7.egg
easy_install -q %DIST_EGGS%\unittest2-0.5.1-py2.7.egg
easy_install -q %DIST_EGGS%\lockfile-0.9.1-py2.7.egg

pip install -q --use-mirrors coverage doxypy unittest-xml-reporting

easy_install -q %MB_EGGS%/pyserial-2.7_mb2.1-py2.7.egg

IF NOT EXIST %MB_EGGS%\makerbot_driver-0.1.1-py2.7.egg GOTO NOINSTALL
easy_install -q %MB_EGGS%/makerbot_driver-0.1.1-py2.7.egg
:NOINSTALL

SET PYTHONPATH=%PYTHONPATH%;%CD%

:DONE

Fix logic for avoiding installing an egg we haven't built yet


@echo off
set READMINEPATH=C:\Users\user\Desktop\redmine-2.5.2
pushd %READMINEPATH%
bundle exec ruby script/rails server webrick -e production

pause

@echo off
set READMINEPATH=C:\usr\local\lib\redmine-2.5.2
pushd %READMINEPATH%
bundle exec ruby script/rails server webrick -e production

pause

change redmine directory

change redmine directory


@ECHO OFF
@node "node_modules/jake/bin/cli.js" %*

Add [jake.bat] so that users can type jake normally even on Windows.


regedit /s x64\VC_OBJECTS_PLATFORM_INFO.reg

regedit /s x64\600dd186-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd187-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd188-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd189-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d875f-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8760-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8763-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8766-2429-11d7-8bf6-00b0d03daa06.reg

copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\AMD64.VCPlatform.config" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\AMD64.VCPlatform.Express.config"
copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\Itanium.VCPlatform.config" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\Itanium.VCPlatform.Express.config"

md "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64"
copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"

regedit /s x64\VC_OBJECTS_PLATFORM_INFO.reg

regedit /s x64\600dd186-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd187-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd188-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\600dd189-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d875f-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8760-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8763-2429-11d7-8bf6-00b0d03daa06.reg
regedit /s x64\656d8766-2429-11d7-8bf6-00b0d03daa06.reg

copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\AMD64.VCPlatform.config" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\AMD64.VCPlatform.Express.config"
copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\Itanium.VCPlatform.config" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\Itanium.VCPlatform.Express.config"

mkdir "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64"
copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"

replace command: md -> mkdir

replace command: md -> mkdir


@ECHO OFF

REM Start Nginx
tasklist /FI "IMAGENAME eq nginx.exe" 2>NUL | find /I /N "nginx.exe">NUL
IF NOT "%ERRORLEVEL%"=="0" (
   REM Nginx is NOT running, so start it
   c:
   cd \nginx
   start nginx.exe
   ECHO Nginx started.
) else (
   ECHO Nginx is already running.
)

Create start_nginx.bat

Create start_nginx.bat


@echo off

SET TERM=dumb
SET EXITCODE=0

ocaml.exe -I scripts -w -3 str.cma unix.cma .\scripts\ocp_build_glob.ml ocp_build_hack.ocp.fb ocp_build_hack.ocp
ocaml.exe -I scripts -w -3 str.cma unix.cma .\scripts\ocp_build_glob.ml ocp_build_flow.ocp.fb ocp_build_flow.ocp

if "%1" == "" goto build
if "%1" == "build" goto build
if "%1" == "all" goto build
if "%1" == "init" goto init
if "%1" == "clean" goto clean
REM Invalid argument
echo Invalid argument, please check README.win32
goto end

REM initialize ocp-build and create _obuild directory
:init
if not exist "_obuild/" ocp-build init
goto end

REM 1/ check if ocp-build init has already be done
REM 2/ generate get_build_id.gen.c
REM 3/ start build hack with ocp-build
:build
if not exist "_obuild/" ocp-build init
ocaml.exe -I scripts -w -3 unix.cma .\scripts\gen_build_id.ml .\hack\utils\get_build_id.gen.c
ocaml.exe -I scripts -w -3 unix.cma .\scripts\gen_index.ml flowlib.rc lib
ocp-build
REM If the build failed then give up
if %ERRORLEVEL% neq 0 (
  SET EXITCODE=%ERRORLEVEL%
  goto build_end
)
md bin 2>NUL
copy _obuild\flow\flow.asm.exe bin\flow.exe

:build_end
del lib\INDEX

goto end

REM clean _obuild directory and executables in bin/
:clean
ocp-build clean
del bin\flow.exe 2>NUL
goto end

REM execute the Flow testsuite

:end
del ocp_build_flow.ocp
del ocp_build_hack.ocp
exit /B %EXITCODE%

REM No echo arguments will be printed in the current state
@echo off

REM Set env variables
SET TERM=dumb
SET EXITCODE=0

REM Run ocaml.exe
ocaml.exe -I scripts -w -3 str.cma unix.cma .\scripts\ocp_build_glob.ml ocp_build_hack.ocp.fb ocp_build_hack.ocp
ocaml.exe -I scripts -w -3 str.cma unix.cma .\scripts\ocp_build_glob.ml ocp_build_flow.ocp.fb ocp_build_flow.ocp

if "%1" == "" goto build
if "%1" == "build" goto build
if "%1" == "all" goto build
if "%1" == "init" goto init
if "%1" == "clean" goto clean
REM Invalid argument
echo Invalid argument, please check README.win32
goto end

REM initialize ocp-build and create _obuild directory
:init
if not exist "_obuild/" ocp-build init
goto end

REM 1/ check if ocp-build init has already be done
REM 2/ generate get_build_id.gen.c
REM 3/ start build hack with ocp-build
:build
if not exist "_obuild/" ocp-build init
ocaml.exe -I scripts -w -3 unix.cma .\scripts\gen_build_id.ml .\hack\utils\get_build_id.gen.c
ocaml.exe -I scripts -w -3 unix.cma .\scripts\gen_index.ml flowlib.rc lib
ocp-build
REM If the build failed then give up
if %ERRORLEVEL% neq 0 (
  SET EXITCODE=%ERRORLEVEL%
  goto build_end
)
md bin 2>NUL
copy _obuild\flow\flow.asm.exe bin\flow.exe

:build_end
del lib\INDEX

goto end

REM clean _obuild directory and executables in bin/
:clean
ocp-build clean
del bin\flow.exe 2>NUL
goto end

REM execute the Flow testsuite

:end
del ocp_build_flow.ocp
del ocp_build_hack.ocp
exit /B %EXITCODE%

Add REM comments

Add REM comments

Summary:
facebook / mroch int3 gabelevi

----

I add some **REM comments**. :pencil2:

*Yours,*
[**Suriyaa Kudo**](https://github.com/SuriyaaKudoIsc) :octocat:
Closes https://github.com/facebook/flow/pull/1999

Differential Revision: D3482316

Pulled By: gabelevi

fbshipit-source-id: b94abaf617b56e99096952885dc7cda6b6dd6803


SET BIN=%CD%\bin
SET PATH=%BIN%;%PATH%

:: enable some features
SET dism=%WINDIR%\SysNative\dism.exe
%dism% /online /Enable-Feature /FeatureName:IIS-WebServer /All /NoRestart
%dism% /online /Enable-Feature /FeatureName:IIS-WebSockets /All /NoRestart
%dism% /online /Enable-Feature /FeatureName:Application-Server-WebServer-Support /FeatureName:AS-NET-Framework /All /NoRestart
%dism% /online /Enable-Feature /FeatureName:IIS-HostableWebCore /All /NoRestart

del /F /Q windows_app_lifecycle.tgz
rmdir /S /Q packages
nuget restore || exit /b 1

MSBuild WindowsCircus.sln /t:Rebuild /p:Configuration=Release || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Builder.Tests\bin\Release\BuilderTests.dll || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Launcher.Tests\bin\Release\LauncherTests.dll || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe WebAppServer.Tests\bin\Release\WebAppServer.Tests.dll || exit /b 1
bsdtar -czvf windows_app_lifecycle.tgz --exclude log -C Builder\bin . -C ..\..\Launcher\bin . -C ..\..\Healthcheck\bin . -C ..\..\WebAppServer\bin . || exit /b 1

SET PATH=%PATH%;%WINDIR%\Microsoft.NET\Framework64\v4.0.30319

:: enable some features
dism /online /Enable-Feature /FeatureName:IIS-WebServer /All /NoRestart || exit /b 1
dism /online /Enable-Feature /FeatureName:IIS-WebSockets /All /NoRestart || exit /b 1
dism /online /Enable-Feature /FeatureName:Application-Server-WebServer-Support /FeatureName:AS-NET-Framework /All /NoRestart || exit /b 1
dism /online /Enable-Feature /FeatureName:IIS-HostableWebCore /All /NoRestart || exit /b 1

del /F /Q windows_app_lifecycle.tgz
rmdir /S /Q packages
bin\nuget restore || exit /b 1

MSBuild WindowsCircus.sln /t:Rebuild /p:Configuration=Release || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Builder.Tests\bin\Release\BuilderTests.dll || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Launcher.Tests\bin\Release\LauncherTests.dll || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe WebAppServer.Tests\bin\Release\WebAppServer.Tests.dll || exit /b 1
bin\bsdtar -czvf windows_app_lifecycle.tgz --exclude log -C Builder\bin . -C ..\..\Launcher\bin . -C ..\..\Healthcheck\bin . -C ..\..\WebAppServer\bin . || exit /b 1

Update make.bat

Update make.bat

Use dism from path, and add .NetFramework to path for MSBuild.exe

[#90928968]


echo on

git pull
if %errorlevel% == 1 pause

set t=%temp%\build-dir-ptc

set actualDir=%CD%

rmdir %t% /s /q
mkdir %t%\src
mkdir %t%\target

if x%java_home%x == xx set java_home=c:\programs\currentJDK
%java_home%\bin\java -version 2>src\main\resources\make-info.txt
if %errorlevel% == 1 goto noJDK

type src\main\resources\make-info.txt

echo %date% >src\main\resources\version.txt
git add src/main/resources/version.txt
git add src/main/resources/make-info.txt
git commit -m %date%
git push
if %errorlevel% == 1 pause

xcopy src\*.* %t%\src /s
copy pom.xml %t% /y

cd /D %t%

call mvn -U clean install source:jar
if %errorlevel% == 1 goto ende
echo on

del %actualDir%\target\*.jar
copy target\*.jar %actualDir%\target\ /y

goto ende

:noJDK
echo off
echo ERROR:
echo there is no link to the newest JDK in c:\programs\currentJDK
echo you can create it via c:\Programs\SysinternalsSuite\junction.exe c:\programs\currentjdk "%currentjdk%"
echo see https://technet.microsoft.com/de-de/sysinternals
goto ende

:ende

cd /D %actualDir%

echo on

git pull
if %errorlevel% == 1 pause

set t=%temp%\build-dir-ptc

set actualDir=%CD%

rmdir %t% /s /q
mkdir %t%\src
mkdir %t%\target

if x%java_home%x == xx set java_home=c:\programs\currentJDK
%java_home%\bin\java -version 2>src\main\resources\make-info.txt
if %errorlevel% == 1 goto noJDK

type src\main\resources\make-info.txt

echo %date% >src\main\resources\version.txt
git add src/main/resources/version.txt
git add src/main/resources/make-info.txt
git commit -m %date%
git push
if %errorlevel% == 1 pause

xcopy src\*.* %t%\src /s
copy pom.xml %t% /y

cd /D %t%

call mvn -U clean install source:jar
if %errorlevel% == 1 goto ende
echo on

del %actualDir%\target\*.jar
copy target\*.jar %actualDir%\target\ /y
copy target\*.jar c:\temp\ /y

goto ende

:noJDK
echo off
echo ERROR:
echo there is no link to the newest JDK in c:\programs\currentJDK
echo you can create it via c:\Programs\SysinternalsSuite\junction.exe c:\programs\currentjdk "%currentjdk%"
echo see https://technet.microsoft.com/de-de/sysinternals
goto ende

:ende

cd /D %actualDir%

copy jars to temp folder

copy jars to temp folder


REM Add other things if could be automated, RUN THIS AS ADMIN
@echo off
REM Windows Defender scan
cd C:\Program Files\Windows Defender\
MpCmdRun.exe -Scan 2
REM Listing possible penetrations
wmic process list brief > brief.txt
PAUSE
wmic process list full >fullprocess.txt
PAUSE
wmic startup list full > startuplists.txt
PAUSE

REM Add other things if could be automated, RUN THIS AS ADMIN
@echo off
REM Windows Defender scan
cd C:\Program Files\Windows Defender\
MpCmdRun.exe -Scan 2
REM Listing possible penetrations
echo Staring to output active processes!
wmic process list brief > brief.txt
wmic process list full >fullprocess.txt
wmic startup list full > startuplists.txt

Update IntruderDetection.bat

Update IntruderDetection.bat


@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET UPSTREAMURL=https://github.com/ShiftMediaProject
SET DEPENDENCIES=( ^
freetype2, ^
fontconfig, ^
fribidi, ^
harfbuzz, ^
libiconv ^
)

REM Get passed in list of dependencies to skip
SET PASSDEPENDENCIES=%~1

REM Check if git is installed and available
IF "%MSVC_VER%"=="" (
    git status >NUL 2>&1
    IF ERRORLEVEL 1 (
        ECHO A working copy of git was not found. To use this script you must first install git for windows.
        GOTO exitOnError
    )
)

REM Store current directory and ensure working directory is the location of current .bat
SET CURRDIR="%CD%"
cd "%~dp0"

REM Initialise error check value
SET ERROR=0

cd ..\..
FOR %%I IN %DEPENDENCIES% DO (
    ECHO !PASSDEPENDENCIES! | FINDSTR /C:"%%I" >NUL 2>&1 || (
        REM Check if MSVC_VER environment variable is set
        IF "%MSVC_VER%"=="" (
            CALL :cloneOrUpdateRepo "%%I" || GOTO exitOnError
        ) ELSE (
            CALL :downloadLibs "%%I" || GOTO exitOnError
        )
    )
)
cd "%CURRDIR%" >NUL
GOTO exit

REM Function to clone or update a repo
REM  cloneOrUpdateRepo: RepoName
REM    RepoName = Name of the repository
:cloneOrUpdateRepo
SET REPONAME=%~1
REM Check if the repo folder already exists
IF EXIST "%REPONAME%" (
    ECHO %REPONAME%: Existing folder found. Checking for updates...
    cd %REPONAME%
    REM Check if any updates are available
    FOR /f %%J IN ('git rev-parse HEAD') do set CURRHEAD=%%J
    FOR /f %%J IN ('git ls-remote origin HEAD') do set ORIGHEAD=%%J
    IF "!CURRHEAD!"=="!ORIGHEAD!" (
        ECHO %REPONAME%: Repository up to date.
    ) ELSE (
        REM Stash any uncommited changes then update from origin
        ECHO %REPONAME%: Updates available. Updating repository...
        git checkout master --quiet
        git stash --quiet
        git pull origin master --quiet -ff
        git stash pop --quiet
    )
    cd ..\
) ELSE (
    ECHO %REPONAME%: Existing folder not found. Cloning repository...
    REM Clone from the origin repo
    SET REPOURL=%UPSTREAMURL%/%REPONAME%.git
    git clone !REPOURL! --quiet
    IF ERRORLEVEL 1 (
        ECHO %REPONAME%: Git clone failed.
        GOTO exitOnError
    )
    REM Initialise autocrlf options to fix cross platform interoperation
    REM  Once updated the repo needs to be reset to correct the local line endings
    cd %REPONAME%
    git config --local core.autocrlf false
    git rm --cached -r . --quiet
    git reset --hard --quiet
    cd ..\
)
REM Add current repo to list of already passed dependencies
SET PASSDEPENDENCIES=%PASSDEPENDENCIES% %REPONAME%
REM Check if the repo itself has required dependencies
IF EXIST "%REPONAME%\SMP\project_get_dependencies.bat" (
    ECHO %REPONAME%: Found additional dependencies...
    ECHO.
    cd %REPONAME%\SMP
    project_get_dependencies.bat "!PASSDEPENDENCIES!" || EXIT /B 1
    cd ..\..
)
ECHO.
EXIT /B %ERRORLEVEL%

REM Function to download existing prebuilt libraries
REM  downloadLibs: RepoName
REM    RepoName = Name of the repository
:downloadLibs
SET REPONAME=%~1
REM Get latest release
ECHO %REPONAME%: Getting latest release...
SET UPSTREAMAPIURL=%UPSTREAMURL:github.com=api.github.com/repos%
REM Check if secure OAuth is available
IF "%GITHUBTOKEN%" == "" (
    powershell -nologo -noprofile -command "try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest > latest.json } catch {exit 1}"
) ELSE (
    powershell -nologo -noprofile -command "try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest -Headers @{'Authorization' = 'token %GITHUBTOKEN%'} > latest.json } catch {exit 1}"
)
IF ERRORLEVEL 1 ( ECHO Failed getting latest %REPONAME% release & EXIT /B 1 )
REM Get tag for latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR /B "tag_name"`) DO SET TAG=%%F
FOR /F "tokens=2 delims=: " %%F in ("%TAG%") DO SET TAG=%%F
IF "%TAG%"=="" ( ECHO Failed getting latest %REPONAME% release tag information & EXIT /B 1 )
REM Get download name of latest release
SET LIBNAME=
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR "name="`) DO ( SET TEMPF=%%F
    SET TEMPF=!TEMPF:*name=!
    IF "!TEMPF:~1,3!"=="lib" ( SET LIBNAME=!TEMPF:~1! )
)
FOR /F "tokens=1 delims=_" %%F in ("%LIBNAME%") DO SET LIBNAME=%%F
IF "%LIBNAME%"=="" ( ECHO Failed getting latest %REPONAME% release name information & EXIT /B 1 )
DEL /F /Q latest.json
REM Get the download location for the required tag
SET TAG2=%TAG:+=.%
SET DLURL=%UPSTREAMURL%/%REPONAME%/releases/download/%TAG%/%LIBNAME%_%TAG2%_msvc%MSVC_VER%.zip
REM Download a pre-built archive and extract
ECHO %REPONAME%: Downloading %LIBNAME%_%TAG%_msvc%MSVC_VER%.zip...
SET PREBUILTDIR=prebuilt
MKDIR %PREBUILTDIR% >NUL 2>&1
powershell -nologo -noprofile -command "try { (New-Object Net.WebClient).DownloadFile('%DLURL%', '%PREBUILTDIR%\temp.zip') } catch {exit 1}"
IF ERRORLEVEL 1 ( ECHO Failed downloading %DLURL% & EXIT /B 1 )
powershell -nologo -noprofile -command "Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip=[System.IO.Compression.ZipFile]::OpenRead('%PREBUILTDIR%\temp.zip'); foreach ($item in $zip.Entries) { try {$file=(Join-Path -Path .\%PREBUILTDIR% -ChildPath $item.FullName); $null=[System.IO.Directory]::CreateDirectory((Split-Path -Path $file)); [System.IO.Compression.ZipFileExtensions]::ExtractToFile($item,$file,$true)} catch {exit 1} }"
IF ERRORLEVEL 1 ( ECHO Failed extracting downloaded archive & EXIT /B 1 )
DEL /F /Q %PREBUILTDIR%\\temp.zip
ECHO.
EXIT /B %ERRORLEVEL%

:exitOnError
cd "%CURRDIR%"
SET ERROR=1

:exit
REM Directly exit if an AppVeyor build
IF NOT "%APPVEYOR%"=="" (
    GOTO return
)
REM Return the passed dependency list
(
    ENDLOCAL
    SET PASSDEPENDENCIES=%PASSDEPENDENCIES%
)

REM Check if this was launched from an existing terminal or directly from .bat
REM  If launched by executing the .bat then pause on completion
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
IF %ERRORLEVEL% == 0 IF "%~1"=="" PAUSE

:return
EXIT /B %ERROR%

@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET UPSTREAMURL=https://github.com/ShiftMediaProject
SET DEPENDENCIES=( ^
freetype2, ^
fontconfig, ^
fribidi, ^
harfbuzz, ^
libiconv ^
)

REM Get passed in list of dependencies to skip
SET PASSDEPENDENCIES=%~1

REM Check if git is installed and available
IF "%MSVC_VER%"=="" (
    git status >NUL 2>&1
    IF ERRORLEVEL 1 (
        ECHO A working copy of git was not found. To use this script you must first install git for windows.
        GOTO exitOnError
    )
)

REM Store current directory and ensure working directory is the location of current .bat
SET CURRDIR="%CD%"
cd "%~dp0"

REM Initialise error check value
SET ERROR=0

cd ..\..
FOR %%I IN %DEPENDENCIES% DO (
    ECHO !PASSDEPENDENCIES! | FINDSTR /C:"%%I" >NUL 2>&1 || (
        REM Check if MSVC_VER environment variable is set
        IF "%MSVC_VER%"=="" (
            CALL :cloneOrUpdateRepo "%%I" || GOTO exitOnError
        ) ELSE (
            CALL :downloadLibs "%%I" || GOTO exitOnError
        )
    )
)
cd "%CURRDIR%" >NUL
GOTO exit

REM Function to clone or update a repo
REM  cloneOrUpdateRepo: RepoName
REM    RepoName = Name of the repository
:cloneOrUpdateRepo
SET REPONAME=%~1
REM Check if the repo folder already exists
IF EXIST "%REPONAME%" (
    ECHO %REPONAME%: Existing folder found. Checking for updates...
    cd %REPONAME%
    REM Check if any updates are available
    FOR /f %%J IN ('git rev-parse HEAD') do set CURRHEAD=%%J
    FOR /f %%J IN ('git ls-remote origin HEAD') do set ORIGHEAD=%%J
    IF "!CURRHEAD!"=="!ORIGHEAD!" (
        ECHO %REPONAME%: Repository up to date.
    ) ELSE (
        REM Stash any uncommited changes then update from origin
        ECHO %REPONAME%: Updates available. Updating repository...
        git checkout master --quiet
        git stash --quiet
        git pull origin master --quiet -ff
        git stash pop --quiet
    )
    cd ..\
) ELSE (
    ECHO %REPONAME%: Existing folder not found. Cloning repository...
    REM Clone from the origin repo
    SET REPOURL=%UPSTREAMURL%/%REPONAME%.git
    git clone !REPOURL! --quiet
    IF ERRORLEVEL 1 (
        ECHO %REPONAME%: Git clone failed.
        GOTO exitOnError
    )
    REM Initialise autocrlf options to fix cross platform interoperation
    REM  Once updated the repo needs to be reset to correct the local line endings
    cd %REPONAME%
    git config --local core.autocrlf false
    git rm --cached -r . --quiet
    git reset --hard --quiet
    cd ..\
)
REM Add current repo to list of already passed dependencies
SET PASSDEPENDENCIES=%PASSDEPENDENCIES% %REPONAME%
REM Check if the repo itself has required dependencies
IF EXIST "%REPONAME%\SMP\project_get_dependencies.bat" (
    ECHO %REPONAME%: Found additional dependencies...
    ECHO.
    cd %REPONAME%\SMP
    project_get_dependencies.bat "!PASSDEPENDENCIES!" || EXIT /B 1
    cd ..\..
)
ECHO.
EXIT /B %ERRORLEVEL%

REM Function to download existing prebuilt libraries
REM  downloadLibs: RepoName
REM    RepoName = Name of the repository
:downloadLibs
SET REPONAME=%~1
REM Get latest release
ECHO %REPONAME%: Getting latest release...
SET UPSTREAMAPIURL=%UPSTREAMURL:github.com=api.github.com/repos%
REM Check if secure OAuth is available
IF "%GITHUBTOKEN%" == "" (
    powershell -nologo -noprofile -command "$currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls };try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest > latest.json } catch {exit 1}"
) ELSE (
    powershell -nologo -noprofile -command "$currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls };try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest -Headers @{'Authorization' = 'token %GITHUBTOKEN%'} > latest.json } catch {exit 1}"
)
IF ERRORLEVEL 1 ( ECHO Failed getting latest %REPONAME% release & EXIT /B 1 )
REM Get tag for latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR /B "tag_name"`) DO SET TAG=%%F
FOR /F "tokens=2 delims=: " %%F in ("%TAG%") DO SET TAG=%%F
IF "%TAG%"=="" ( ECHO Failed getting latest %REPONAME% release tag information & EXIT /B 1 )
REM Get download name of latest release
SET LIBNAME=
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR "name="`) DO ( SET TEMPF=%%F
    SET TEMPF=!TEMPF:*name=!
    IF "!TEMPF:~1,3!"=="lib" ( SET LIBNAME=!TEMPF:~1! )
)
FOR /F "tokens=1 delims=_" %%F in ("%LIBNAME%") DO SET LIBNAME=%%F
IF "%LIBNAME%"=="" ( ECHO Failed getting latest %REPONAME% release name information & EXIT /B 1 )
DEL /F /Q latest.json
REM Get the download location for the required tag
SET TAG2=%TAG:+=.%
SET DLURL=%UPSTREAMURL%/%REPONAME%/releases/download/%TAG%/%LIBNAME%_%TAG2%_msvc%MSVC_VER%.zip
REM Download a pre-built archive and extract
ECHO %REPONAME%: Downloading %LIBNAME%_%TAG%_msvc%MSVC_VER%.zip...
SET PREBUILTDIR=prebuilt
MKDIR %PREBUILTDIR% >NUL 2>&1
powershell -nologo -noprofile -command "$currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls };try { (New-Object Net.WebClient).DownloadFile('%DLURL%', '%PREBUILTDIR%\temp.zip') } catch {exit 1}"
IF ERRORLEVEL 1 ( ECHO Failed downloading %DLURL% & EXIT /B 1 )
powershell -nologo -noprofile -command "Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip=[System.IO.Compression.ZipFile]::OpenRead('%PREBUILTDIR%\temp.zip'); foreach ($item in $zip.Entries) { try {$file=(Join-Path -Path .\%PREBUILTDIR% -ChildPath $item.FullName); $null=[System.IO.Directory]::CreateDirectory((Split-Path -Path $file)); [System.IO.Compression.ZipFileExtensions]::ExtractToFile($item,$file,$true)} catch {exit 1} }"
IF ERRORLEVEL 1 ( ECHO Failed extracting downloaded archive & EXIT /B 1 )
DEL /F /Q %PREBUILTDIR%\\temp.zip
ECHO.
EXIT /B %ERRORLEVEL%

:exitOnError
cd "%CURRDIR%"
SET ERROR=1

:exit
REM Directly exit if an AppVeyor build
IF NOT "%APPVEYOR%"=="" (
    GOTO return
)
REM Return the passed dependency list
(
    ENDLOCAL
    SET PASSDEPENDENCIES=%PASSDEPENDENCIES%
)

REM Check if this was launched from an existing terminal or directly from .bat
REM  If launched by executing the .bat then pause on completion
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
IF %ERRORLEVEL% == 0 IF "%~1"=="" PAUSE

:return
EXIT /B %ERROR%

project: Update get_dependencies script to uses latest available TLS.


@rem Script to build LuaJIT with MSVC.
@rem Copyright (C) 2005-2010 Mike Pall. See Copyright Notice in luajit.h
@rem
@rem Either open a "Visual Studio .NET Command Prompt"
@rem (Note that the Express Edition does not contain an x64 compiler)
@rem -or-
@rem Open a "Windows SDK Command Shell" and set the compiler environment:
@rem     setenv /release /x86
@rem   -or-
@rem     setenv /release /x64
@rem
@rem Then cd to this directory and run this script.

@if not defined INCLUDE goto :FAIL

@setlocal
@set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
@set LJLINK=link /nologo
@set LJMT=mt /nologo
@set DASMDIR=..\dynasm
@set DASM=lua %DASMDIR%\dynasm.lua
@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c

if not exist buildvm_x86.h^
  %DASM% -LN -o buildvm_x86.h buildvm_x86.dasc
if not exist buildvm_x64win.h^
  %DASM% -LN -D X64 -D X64WIN -o buildvm_x64win.h buildvm_x86.dasc

%LJCOMPILE% /I "." /I %DASMDIR% buildvm*.c
%LJLINK% /out:buildvm.exe buildvm*.obj
if exist buildvm.exe.manifest^
  %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe

buildvm -m peobj -o lj_vm.obj
buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
buildvm -m libdef -o lj_libdef.h %ALL_LIB%
buildvm -m recdef -o lj_recdef.h %ALL_LIB%
buildvm -m vmdef -o ..\lib\vmdef.lua %ALL_LIB%
buildvm -m folddef -o lj_folddef.h lj_opt_fold.c

@if "%1"=="amalg" goto :AMALGDLL
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
%LJLINK% /DLL /out:lua51.dll lj_*.obj lib_*.obj
@goto :MTDLL
:AMALGDLL
%LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
%LJLINK% /DLL /out:lua51.dll ljamalg.obj lj_vm.obj
:MTDLL
if exist lua51.dll.manifest^
  %LJMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2

%LJCOMPILE% luajit.c
%LJLINK% /out:luajit.exe luajit.obj lua51.lib
if exist luajit.exe.manifest^
  %LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe

del *.obj *.manifest buildvm.exe

@goto :END
:FAIL
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
:END

@rem Script to build LuaJIT with MSVC.
@rem Copyright (C) 2005-2010 Mike Pall. See Copyright Notice in luajit.h
@rem
@rem Either open a "Visual Studio .NET Command Prompt"
@rem (Note that the Express Edition does not contain an x64 compiler)
@rem -or-
@rem Open a "Windows SDK Command Shell" and set the compiler environment:
@rem     setenv /release /x86
@rem   -or-
@rem     setenv /release /x64
@rem
@rem Then cd to this directory and run this script.

@if not defined INCLUDE goto :FAIL

@setlocal
@set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
@set LJLINK=link /nologo
@set LJMT=mt /nologo
@set LJLIB=lib /nologo
@set DASMDIR=..\dynasm
@set DASM=lua %DASMDIR%\dynasm.lua
@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c

if not exist buildvm_x86.h^
  %DASM% -LN -o buildvm_x86.h buildvm_x86.dasc
if not exist buildvm_x64win.h^
  %DASM% -LN -D X64 -D X64WIN -o buildvm_x64win.h buildvm_x86.dasc

%LJCOMPILE% /I "." /I %DASMDIR% buildvm*.c
%LJLINK% /out:buildvm.exe buildvm*.obj
if exist buildvm.exe.manifest^
  %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe

buildvm -m peobj -o lj_vm.obj
buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
buildvm -m libdef -o lj_libdef.h %ALL_LIB%
buildvm -m recdef -o lj_recdef.h %ALL_LIB%
buildvm -m vmdef -o ..\lib\vmdef.lua %ALL_LIB%
buildvm -m folddef -o lj_folddef.h lj_opt_fold.c

@if "%1"=="amalg" goto :AMALGDLL
@if "%1"=="static" goto :STATIC
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
%LJLINK% /DLL /out:lua51.dll lj_*.obj lib_*.obj
@goto :MTDLL
:STATIC
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
%LJLIB% /OUT:lua51.lib lj_*.obj lib_*.obj
@goto :MTDLL
:AMALGDLL
%LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
%LJLINK% /DLL /out:lua51.dll ljamalg.obj lj_vm.obj
:MTDLL
if exist lua51.dll.manifest^
  %LJMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2

%LJCOMPILE% luajit.c
%LJLINK% /out:luajit.exe luajit.obj lua51.lib
if exist luajit.exe.manifest^
  %LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe

del *.obj *.manifest buildvm.exe

@goto :END
:FAIL
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
:END

Add static target to msvcbuild.bat.

Add static target to msvcbuild.bat.