@ECHO OFF
rem ************* <auto-copyright.pl BEGIN do not edit this line> *************
rem
rem VR Juggler is (C) Copyright 1998-2006 by Iowa State University
rem
rem Original Authors:
rem   Allen Bierbaum, Christopher Just,
rem   Patrick Hartling, Kevin Meinert,
rem   Carolina Cruz-Neira, Albert Baker
rem
rem This library is free software; you can redistribute it and/or
rem modify it under the terms of the GNU Library General Public
rem License as published by the Free Software Foundation; either
rem version 2 of the License, or (at your option) any later version.
rem
rem This library is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rem Library General Public License for more details.
rem
rem You should have received a copy of the GNU Library General Public
rem License along with this library; if not, write to the
rem Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rem Boston, MA 02111-1307, USA.
rem
rem ************** <auto-copyright.pl END do not edit this line> **************
IF NOT "%JAVA_HOME%" == "" GOTO TEST_JAVA_EXIST
IF "%JDK_HOME%" == "" GOTO JAVA_ERR
ECHO [NOTE] Setting JAVA_HOME to "%JDK_HOME%"
set JAVA_HOME=%JDK_HOME%
GOTO TEST_JAVA_EXIST
:JAVA_ERR
ECHO [ERR] Neither JAVA_HOME nor JDK_HOME is set.  One of these environment
ECHO [ERR] variables must be set to a valid Java 1.4 or newer installation
ECHO [ERR] directory to run VRJConfig.
GOTO ERREXIT
:TEST_JAVA_EXIST
IF EXIST "%JAVA_HOME%\bin\java.exe" GOTO TEST_VJ_BASE
ECHO [ERR] %JAVA_HOME%\bin\java.exe does not exist, so VRJConfig cannot be
ECHO [ERR] started.
:TEST_VJ_BASE
IF NOT "%VJ_BASE_DIR%" == "" GOTO TEST_VJ_EXIST
ECHO [ERR] VJ_BASE_DIR unset; please set the environment variable VJ_BASE_DIR to
ECHO [ERR] point to your VR Juggler installation directory.  For more information,
ECHO [ERR] please see INSTALL.html
GOTO ERREXIT
:TEST_VJ_EXIST
IF EXIST "%VJ_BASE_DIR%" GOTO TEST_TWEEK_BASE
ECHO [ERR] The VJ_BASE_DIR %VJ_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_TWEEK_BASE
IF NOT "%TWEEK_BASE_DIR%" == "" GOTO TEST_TWEEK_EXIST
ECHO  NOTE: Setting TWEEK_BASE_DIR to "%VJ_BASE_DIR%"
set TWEEK_BASE_DIR=%VJ_BASE_DIR%
:TEST_TWEEK_EXIST
IF EXIST "%TWEEK_BASE_DIR%" GOTO TEST_JCCL_BASE
ECHO [ERR] The TWEEK_BASE_DIR %TWEEK_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_JCCL_BASE
IF NOT "%JCCL_BASE_DIR%" == "" GOTO TEST_JCCL_EXIST
ECHO  NOTE: Setting JCCL_BASE_DIR to "%VJ_BASE_DIR%"
set JCCL_BASE_DIR=%VJ_BASE_DIR%
:TEST_JCCL_EXIST
IF EXIST "%JCCL_BASE_DIR%" GOTO TEST_JCCL_DEF
ECHO [ERR] The JCCL_BASE_DIR %JCCL_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_JCCL_DEF
IF NOT "%JCCL_DEFINITION_PATH%" == "" GOTO RUNJAVA
set jccl_def_arg=-DJCCL_DEFINITION_PATH="%JCCL_DEFINITION_PATH%"
:RUNJAVA
"%JAVA_HOME%\bin\java" -Dsun.java2d.opengl=True -DTWEEK_BASE_DIR="%TWEEK_BASE_DIR%" -DJCCL_BASE_DIR="%JCCL_BASE_DIR%" -DVJ_BASE_DIR="%VJ_BASE_DIR%" %jccl_def_arg% -Djava.library.path="%TWEEK_BASE_DIR%\share\tweek\java\%PROCESSOR_ARCHITECTURE%" -Djava.security.policy="%TWEEK_BASE_DIR%\share\tweek\java\java.security.policy.txt" -cp "%TWEEK_BASE_DIR%\share\tweek\java\jaxen-core.jar;%TWEEK_BASE_DIR%\share\tweek\java\jaxen-jdom.jar;%TWEEK_BASE_DIR%\share\tweek\java\jdom.jar;%TWEEK_BASE_DIR%\share\tweek\java\saxpath.jar;%TWEEK_BASE_DIR%\share\tweek\java\xalan.jar;%TWEEK_BASE_DIR%\share\tweek\java\xerces.jar;%TWEEK_BASE_DIR%\share\tweek\java\xml-apis.jar;%TWEEK_BASE_DIR%\share\tweek\java\Tweek.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekBeans.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekEvents.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekNet.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekBeanDelivery.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekServices.jar;%TWEEK_BASE_DIR%\share\tweek\java\kunststoff-mod.jar;%TWEEK_BASE_DIR%\share\tweek\java\liquidlnf.jar;%TWEEK_BASE_DIR%\share\tweek\java\metouia.jar;%TWEEK_BASE_DIR%\share\tweek\java\looks.jar" org.vrjuggler.tweek.Tweek --beanpath="%JCCL_BASE_DIR%\share\jccl\beans" --beanpath="%VJ_BASE_DIR%\share\vrjuggler\beans" --defaultbean="Configuration Editor" %*
GOTO DONE
:ERREXIT
ECHO [ERR] VRJConfig exiting due to previous errors.
:DONE

@ECHO OFF
rem ************* <auto-copyright.pl BEGIN do not edit this line> *************
rem
rem VR Juggler is (C) Copyright 1998-2006 by Iowa State University
rem
rem Original Authors:
rem   Allen Bierbaum, Christopher Just,
rem   Patrick Hartling, Kevin Meinert,
rem   Carolina Cruz-Neira, Albert Baker
rem
rem This library is free software; you can redistribute it and/or
rem modify it under the terms of the GNU Library General Public
rem License as published by the Free Software Foundation; either
rem version 2 of the License, or (at your option) any later version.
rem
rem This library is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rem Library General Public License for more details.
rem
rem You should have received a copy of the GNU Library General Public
rem License along with this library; if not, write to the
rem Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rem Boston, MA 02111-1307, USA.
rem
rem ************** <auto-copyright.pl END do not edit this line> **************
IF NOT "%JAVA_HOME%" == "" GOTO TEST_JAVA_EXIST
IF "%JDK_HOME%" == "" GOTO JAVA_ERR
ECHO [NOTE] Setting JAVA_HOME to "%JDK_HOME%"
set JAVA_HOME=%JDK_HOME%
GOTO TEST_JAVA_EXIST
:JAVA_ERR
ECHO [ERR] Neither JAVA_HOME nor JDK_HOME is set.  One of these environment
ECHO [ERR] variables must be set to a valid Java 1.4 or newer installation
ECHO [ERR] directory to run VRJConfig.
GOTO ERREXIT
:TEST_JAVA_EXIST
IF EXIST "%JAVA_HOME%\bin\java.exe" GOTO TEST_VJ_BASE
ECHO [ERR] %JAVA_HOME%\bin\java.exe does not exist, so VRJConfig cannot be
ECHO [ERR] started.
:TEST_VJ_BASE
IF NOT "%VJ_BASE_DIR%" == "" GOTO TEST_VJ_EXIST
ECHO [ERR] VJ_BASE_DIR unset; please set the environment variable VJ_BASE_DIR to
ECHO [ERR] point to your VR Juggler installation directory.  For more information,
ECHO [ERR] please see INSTALL.html
GOTO ERREXIT
:TEST_VJ_EXIST
IF EXIST "%VJ_BASE_DIR%" GOTO TEST_TWEEK_BASE
ECHO [ERR] The VJ_BASE_DIR %VJ_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_TWEEK_BASE
IF NOT "%TWEEK_BASE_DIR%" == "" GOTO TEST_TWEEK_EXIST
ECHO  NOTE: Setting TWEEK_BASE_DIR to "%VJ_BASE_DIR%"
set TWEEK_BASE_DIR=%VJ_BASE_DIR%
:TEST_TWEEK_EXIST
IF EXIST "%TWEEK_BASE_DIR%" GOTO TEST_JCCL_BASE
ECHO [ERR] The TWEEK_BASE_DIR %TWEEK_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_JCCL_BASE
IF NOT "%JCCL_BASE_DIR%" == "" GOTO TEST_JCCL_EXIST
ECHO  NOTE: Setting JCCL_BASE_DIR to "%VJ_BASE_DIR%"
set JCCL_BASE_DIR=%VJ_BASE_DIR%
:TEST_JCCL_EXIST
IF EXIST "%JCCL_BASE_DIR%" GOTO TEST_JCCL_DEF
ECHO [ERR] The JCCL_BASE_DIR %JCCL_BASE_DIR% does not appear to exist.  Please
ECHO [ERR] check the path and try again.
GOTO ERREXIT
:TEST_JCCL_DEF
IF NOT "%JCCL_DEFINITION_PATH%" == "" GOTO RUNJAVA
set jccl_def_arg=-DJCCL_DEFINITION_PATH="%JCCL_DEFINITION_PATH%"
:RUNJAVA
"%JAVA_HOME%\bin\java" -Dsun.java2d.opengl=True -DTWEEK_BASE_DIR="%TWEEK_BASE_DIR%" -DTWEEK_DATA_DIR="share\tweek" -DJCCL_BASE_DIR="%JCCL_BASE_DIR%" -DJCCL_DATA_DIR="share\jccl" -DVJ_BASE_DIR="%VJ_BASE_DIR%" -DVRJ_DATA_DIR="share\vrjuggler" %jccl_def_arg% -Djava.library.path="%TWEEK_BASE_DIR%\share\tweek\java\%PROCESSOR_ARCHITECTURE%" -Djava.security.policy="%TWEEK_BASE_DIR%\share\tweek\java\java.security.policy.txt" -cp "%TWEEK_BASE_DIR%\share\tweek\java\jaxen-core.jar;%TWEEK_BASE_DIR%\share\tweek\java\jaxen-jdom.jar;%TWEEK_BASE_DIR%\share\tweek\java\jdom.jar;%TWEEK_BASE_DIR%\share\tweek\java\saxpath.jar;%TWEEK_BASE_DIR%\share\tweek\java\xalan.jar;%TWEEK_BASE_DIR%\share\tweek\java\xerces.jar;%TWEEK_BASE_DIR%\share\tweek\java\xml-apis.jar;%TWEEK_BASE_DIR%\share\tweek\java\Tweek.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekBeans.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekEvents.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekNet.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekBeanDelivery.jar;%TWEEK_BASE_DIR%\share\tweek\java\TweekServices.jar;%TWEEK_BASE_DIR%\share\tweek\java\kunststoff-mod.jar;%TWEEK_BASE_DIR%\share\tweek\java\liquidlnf.jar;%TWEEK_BASE_DIR%\share\tweek\java\metouia.jar;%TWEEK_BASE_DIR%\share\tweek\java\looks.jar" org.vrjuggler.tweek.Tweek --beanpath="%JCCL_BASE_DIR%\share\jccl\beans" --beanpath="%VJ_BASE_DIR%\share\vrjuggler\beans" --defaultbean="Configuration Editor" %*
GOTO DONE
:ERREXIT
ECHO [ERR] VRJConfig exiting due to previous errors.
:DONE

Fix VRJConfig on Windows.

Fix VRJConfig on Windows.

git-svn-id: a341ccba1312b2efdbe34f40faf90581f48aa49f@19266 08b38cba-cd3b-11de-854e-f91c5b6e4272


@rem Builds C# artifacts on Windows

@call vsprojects\build_vs2013.bat %* || goto :error

mkdir artifacts
copy /Y vsprojects\Release\grpc_csharp_ext.dll artifacts || goto :error

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

@rem Builds C# artifacts on Windows

@call vsprojects\build_vs2013.bat %* || goto :error

mkdir artifacts
copy /Y vsprojects\Release\grpc_csharp_ext.dll artifacts || copy /Y vsprojects\x64\Release\grpc_csharp_ext.dll artifacts || goto :error

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

fix artifact copying

fix artifact copying


cd ..\src

..\build\tools\nuget.exe restore DeploymentCockpit.sln

set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v4.0.30319
call %msBuildDir%\msbuild.exe DeploymentCockpit.sln /p:Configuration=Release /t:Clean,Build /l:FileLogger,Microsoft.Build.Engine;logfile=..\build\build.log
set msBuildDir=

cd ..\build

rd .\BuildOutput /S /Q
md .\BuildOutput

md .\BuildOutput\Database
copy .\GenerateChangeScript.bat .\BuildOutput\Database
copy ..\src\DeploymentCockpit.Database\bin\Release\DeploymentCockpit.Database.dacpac .\BuildOutput\Database
copy ..\src\DeploymentCockpit.Database\bin\Release\DeploymentCockpit.Database_Create.sql .\BuildOutput\Database

md .\BuildOutput\Server
xcopy ..\src\DeploymentCockpit.Server\bin\*.dll .\BuildOutput\Server\bin /I
xcopy ..\src\DeploymentCockpit.Server\App_Start\*.cs .\BuildOutput\Server\App_Start /I
copy ..\src\DeploymentCockpit.Server\Web.config .\BuildOutput\Server
copy ..\src\DeploymentCockpit.Server\AppSettings.config .\BuildOutput\Server\AppSettings.config.sample
copy ..\src\DeploymentCockpit.Server\ConnectionStrings.config .\BuildOutput\Server\ConnectionStrings.config.sample
copy ..\src\DeploymentCockpit.Server\index.html .\BuildOutput\Server
xcopy ..\src\DeploymentCockpit.Server\app\* .\BuildOutput\Server\app /I /S /EXCLUDE:exclusions.txt
xcopy ..\src\DeploymentCockpit.Server\assets\* .\BuildOutput\Server\assets /I /S /EXCLUDE:exclusions.txt
xcopy ..\src\DeploymentCockpit.Server\ext\* .\BuildOutput\Server\ext /I /S /EXCLUDE:exclusions.txt

md .\BuildOutput\JobRunner
xcopy ..\src\DeploymentCockpit.JobRunner\bin\Release\DeploymentCockpit.JobRunner.exe* .\BuildOutput\JobRunner
xcopy ..\src\DeploymentCockpit.JobRunner\bin\Release\*.dll .\BuildOutput\JobRunner
copy ..\src\DeploymentCockpit.JobRunner\AppSettings.config .\BuildOutput\JobRunner\AppSettings.config.sample
copy ..\src\DeploymentCockpit.JobRunner\ConnectionStrings.config .\BuildOutput\JobRunner\ConnectionStrings.config.sample

md .\BuildOutput\Target
xcopy ..\src\DeploymentCockpit.Target\bin\Release\DeploymentCockpit.Target.exe* .\BuildOutput\Target
xcopy ..\src\DeploymentCockpit.Target\bin\Release\*.dll .\BuildOutput\Target
copy ..\src\DeploymentCockpit.Target\AppSettings.config .\BuildOutput\Target\AppSettings.config.sample
copy ..\src\DeploymentCockpit.Target\ConnectionStrings.config .\BuildOutput\Target\ConnectionStrings.config.sample

.\tools\7z.exe a .\BuildOutput\DeploymentCockpit.zip .\BuildOutput\*
rd .\BuildOutput\Database /S /Q
rd .\BuildOutput\Server /S /Q
rd .\BuildOutput\JobRunner /S /Q
rd .\BuildOutput\Target /S /Q

cd ..\src

..\build\tools\nuget.exe restore DeploymentCockpit.sln

set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v4.0.30319
call %msBuildDir%\msbuild.exe DeploymentCockpit.sln /p:Configuration=Release /t:Clean,Build /l:FileLogger,Microsoft.Build.Engine;logfile=..\build\build.log
set msBuildDir=

cd ..\build

rd .\BuildOutput /S /Q
md .\BuildOutput

md .\BuildOutput\Database
copy .\GenerateChangeScript.bat .\BuildOutput\Database
copy ..\src\DeploymentCockpit.Database\bin\Release\DeploymentCockpit.Database.dacpac .\BuildOutput\Database
copy ..\src\DeploymentCockpit.Database\bin\Release\DeploymentCockpit.Database_Create.sql .\BuildOutput\Database
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {(Get-Content .\BuildOutput\Database\DeploymentCockpit.Database_Create.sql) | ForEach-Object { $_ -replace 'DeploymentCockpit.Database', 'DeploymentCockpit' } | Set-Content .\BuildOutput\Database\DeploymentCockpit.Database_Create.sql}"

md .\BuildOutput\Server
xcopy ..\src\DeploymentCockpit.Server\bin\*.dll .\BuildOutput\Server\bin /I
xcopy ..\src\DeploymentCockpit.Server\App_Start\*.cs .\BuildOutput\Server\App_Start /I
copy ..\src\DeploymentCockpit.Server\Web.config .\BuildOutput\Server
copy ..\src\DeploymentCockpit.Server\AppSettings.config .\BuildOutput\Server\AppSettings.config.sample
copy ..\src\DeploymentCockpit.Server\ConnectionStrings.config .\BuildOutput\Server\ConnectionStrings.config.sample
copy ..\src\DeploymentCockpit.Server\index.html .\BuildOutput\Server
xcopy ..\src\DeploymentCockpit.Server\app\* .\BuildOutput\Server\app /I /S /EXCLUDE:exclusions.txt
xcopy ..\src\DeploymentCockpit.Server\assets\* .\BuildOutput\Server\assets /I /S /EXCLUDE:exclusions.txt
xcopy ..\src\DeploymentCockpit.Server\ext\* .\BuildOutput\Server\ext /I /S /EXCLUDE:exclusions.txt

md .\BuildOutput\JobRunner
xcopy ..\src\DeploymentCockpit.JobRunner\bin\Release\DeploymentCockpit.JobRunner.exe* .\BuildOutput\JobRunner
xcopy ..\src\DeploymentCockpit.JobRunner\bin\Release\*.dll .\BuildOutput\JobRunner
copy ..\src\DeploymentCockpit.JobRunner\AppSettings.config .\BuildOutput\JobRunner\AppSettings.config.sample
copy ..\src\DeploymentCockpit.JobRunner\ConnectionStrings.config .\BuildOutput\JobRunner\ConnectionStrings.config.sample

md .\BuildOutput\Target
xcopy ..\src\DeploymentCockpit.Target\bin\Release\DeploymentCockpit.Target.exe* .\BuildOutput\Target
xcopy ..\src\DeploymentCockpit.Target\bin\Release\*.dll .\BuildOutput\Target
copy ..\src\DeploymentCockpit.Target\AppSettings.config .\BuildOutput\Target\AppSettings.config.sample
copy ..\src\DeploymentCockpit.Target\ConnectionStrings.config .\BuildOutput\Target\ConnectionStrings.config.sample

.\tools\7z.exe a .\BuildOutput\DeploymentCockpit.zip .\BuildOutput\*
rd .\BuildOutput\Database /S /Q
rd .\BuildOutput\Server /S /Q
rd .\BuildOutput\JobRunner /S /Q
rd .\BuildOutput\Target /S /Q

Fix database name in creation script

Fix database name in creation script


cmake ^
      -G "%CMAKE_GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX=%PREFIX% ^
      -DWITH_INCHI=ON ^
      -DPYTHON_EXECUTABLE=%PYTHON% ^
      -DPYTHON_BINDINGS=ON ^
      -DRUN_SWIG=ON ^
      -DCMAKE_BUILD_TYPE=Release ^
      .

cmake --build . --target install --config Release

:: Where should BABEL_DATADIR go?
xcopy %PREFIX%\bin\data %PREFIX%\share\openbabel /e /c
rmdir /s /q %PREFIX%\bin\data

xcopy %PREFIX%\bin %PREFIX%\Library\bin /e /c
rmdir /s /q %PREFIX%\bin

Create bld.bat

Create bld.bat

copied from https://github.com/openbabel/conda-openbabel/blob/master/recipe/bld.bat


:: Start with bootstrap
cd .\tools\build
ECHO .\bootstrap.bat
CALL .\bootstrap.bat
:: IF errorlevel 1 exit 1
ECHO .\bootstrap.bat mingw
CALL .\bootstrap.bat mingw
:: IF errorlevel 1 exit 1
:: ECHO .\b2.exe install toolset=gcc --prefix=%SRC_DIR%\b2_for_mingw
:: CALL .\b2.exe install toolset=gcc --prefix=%SRC_DIR%\b2_for_mingw
:: ECHO cd %SRCDIR%
:: cd %SRCDIR%
:: set PATH=%PATH%;%SRCDIR%\b2_for_mingw\bin
:: ECHO b2 toolset=gcc --build-type=complete stage ^
::      --build-dir=buildboost ^
::      --prefix=%LIBRARY_PREFIX% ^
::      address-model=%ARCH% ^
::      variant=release ^
::      threading=multi ^
::      link=shared ^
::      -j%CPU_COUNT% ^
::      -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::      -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::      --with-python
:: CALL b2 toolset=gcc --build-type=complete stage ^
::      --build-dir=buildboost ^
::      --prefix=%LIBRARY_PREFIX% ^
::      address-model=%ARCH% ^
::      variant=release ^
::      threading=multi ^
::      link=shared ^
::      -j%CPU_COUNT% ^
::      -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::      -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::      --with-python

:: cd ..\..
:: dir .
:: CALL .\tools\build\b2.exe install toolset=gcc --prefix=%LIBRARY_PREFIX%
:: dir .
:: set PATH=%PATH%;%LIBRARY_BIN%
::
:: Build step
:: CALL b2 install ^
::     --build-dir=buildboost ^
::     --prefix=%LIBRARY_PREFIX% ^
::     toolset=gcc ^
::     address-model=%ARCH% ^
::     variant=release ^
::     threading=multi ^
::     link=shared ^
::     -j%CPU_COUNT% ^
::     -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::     -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::     --with-python
:: IF errorlevel 1 exit 1
::
:: :: Install fix-up for a non version-specific boost include
:: move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
:: IF errorlevel 1 exit 1
::
:: Move dll's to LIBRARY_BIN
:: move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
:: IF errorlevel 1 exit 1
:: Status API Training Shop Blog About

:: Start with bootstrap
:: cd .\tools\build
ECHO .\bootstrap.bat
CALL .\bootstrap.bat
:: IF errorlevel 1 exit 1
ECHO .\bootstrap.bat mingw
CALL .\bootstrap.bat mingw
:: IF errorlevel 1 exit 1
:: ECHO .\b2.exe install toolset=gcc --prefix=%SRC_DIR%\b2_for_mingw
:: CALL .\b2.exe install toolset=gcc --prefix=%SRC_DIR%\b2_for_mingw
:: ECHO cd %SRCDIR%
:: cd %SRCDIR%
:: set PATH=%PATH%;%SRCDIR%\b2_for_mingw\bin
:: ECHO b2 toolset=gcc --build-type=complete stage ^
::      --build-dir=buildboost ^
::      --prefix=%LIBRARY_PREFIX% ^
::      address-model=%ARCH% ^
::      variant=release ^
::      threading=multi ^
::      link=shared ^
::      -j%CPU_COUNT% ^
::      -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::      -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::      --with-python
:: CALL b2 toolset=gcc --build-type=complete stage ^
::      --build-dir=buildboost ^
::      --prefix=%LIBRARY_PREFIX% ^
::      address-model=%ARCH% ^
::      variant=release ^
::      threading=multi ^
::      link=shared ^
::      -j%CPU_COUNT% ^
::      -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::      -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::      --with-python

:: cd ..\..
:: dir .
:: CALL .\tools\build\b2.exe install toolset=gcc --prefix=%LIBRARY_PREFIX%
:: dir .
:: set PATH=%PATH%;%LIBRARY_BIN%
::
:: Build step
:: CALL b2 install ^
::     --build-dir=buildboost ^
::     --prefix=%LIBRARY_PREFIX% ^
::     toolset=gcc ^
::     address-model=%ARCH% ^
::     variant=release ^
::     threading=multi ^
::     link=shared ^
::     -j%CPU_COUNT% ^
::     -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::     -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::     --with-python
:: IF errorlevel 1 exit 1
::
:: :: Install fix-up for a non version-specific boost include
:: move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
:: IF errorlevel 1 exit 1
::
:: Move dll's to LIBRARY_BIN
:: move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
:: IF errorlevel 1 exit 1
:: Status API Training Shop Blog About

Update bld.bat

Update bld.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.

%~dp0kafka-run-class.bat kafka.admin.BrokerApiVersionsCommand %*

KAFKA-5143: add kafka-broker-api-version.bat for Windows platform

Added kafka-broker-api-versions.bat for Windows platform

Author: amethystic <huxi_2b@hotmail.com>

Reviewers: Vahid Hashemian, Ismael Juma, Guozhang Wang

Closes #2943 from amethystic/kafka-5143_offer_broker_api_versions_bat


@rem Do not use "echo off" to not affect any child calls.
@setlocal

@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@curl.exe %*

create curl.cmd follow the instruction of vundle


call "%~dp0elasticsearch-env.bat" || exit /b 1

if defined ES_ADDITIONAL_SOURCES (
  for %%a in ("%ES_ADDITIONAL_SOURCES:;=","%") do (
    call %~dp0%%a
  )
)

if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
  for %%a in ("%ES_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do (
    set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/%%a/*
  )
)

%JAVA% ^
  %ES_JAVA_OPTS% ^
  -Des.path.home="%ES_HOME%" ^
  -Des.path.conf="%ES_PATH_CONF%" ^
  -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
  -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
  -cp "%ES_CLASSPATH%" ^
  "%ES_MAIN_CLASS%" ^
  %*

call "%~dp0elasticsearch-env.bat" || exit /b 1

if defined ES_ADDITIONAL_SOURCES (
  for %%a in ("%ES_ADDITIONAL_SOURCES:;=","%") do (
    call "%~dp0%%a"
  )
)

if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
  for %%a in ("%ES_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do (
    set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/%%a/*
  )
)

%JAVA% ^
  %ES_JAVA_OPTS% ^
  -Des.path.home="%ES_HOME%" ^
  -Des.path.conf="%ES_PATH_CONF%" ^
  -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
  -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
  -cp "%ES_CLASSPATH%" ^
  "%ES_MAIN_CLASS%" ^
  %*

Use quotes in the call invocation (#31249)

Adding quotes around call invocation as paths can contain spaces that
otherwise would cause the command to fail


REM install db
call C:\funda_components\reports_manager\report_manager_database\reports_manager_test_db\install_reports_manager_test_db.bat

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d reports_manager_test_db  -p 5432 -f ..\action_enter_edit_folders.sql 1> test_action_enter_edit_folders.log 2>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d reports_manager_test_db  -p 5432 -f test_action_enter_edit_folders.sql  1>> test_action_enter_edit_folders.log 2>>&1

Add complete db installation before tests


@echo off

traceview.exe -start UsbDk -rt -flag 0xFF -level 6 -ft 1 -pdb UsbDk.pdb -guid UsbDk.ctl

mkdir WPP
start traceview.exe -process -rt UsbDk -display -ods -o WPP\\UsbDk.txt -pdb UsbDk.pdb -guid UsbDk.ctl
start dbgview.exe

pause

traceview.exe -stop UsbDk

@echo off

traceview.exe -start UsbDk -rt -flag 0x7FFFFFFF -level 6 -ft 1 -pdb UsbDk.pdb -guid UsbDk.ctl

mkdir WPP
start traceview.exe -process -rt UsbDk -display -ods -o WPP\\UsbDk.txt -pdb UsbDk.pdb -guid UsbDk.ctl
start dbgview.exe

pause

traceview.exe -stop UsbDk

Enable all trace flags by default

Trace: Enable all trace flags by default

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


echo OFF
echo Astrometric reduction on OS Windows

set /A inParam=0
for %%x in (%*) do Set /A inParam+=1

set /A expParam=1
set /A expParamArcsecpix=3

IF /I "%inParam%" NEQ "%expParam%" (
	IF /I "%inParam%" NEQ "%expParamArcsecpix%" (
		echo "Error in input parameter"
		exit
	)
)

set imgName=%1

set PATH=%PATH%:"C:\Cygwin\bin"

IF /I "%inParam%" EQU "%expParamArcsecpix%" (
	set arcsecpixScaleL=%2
	set arcsecpixScaleH=%3
	c:\cygwin\bin\bash.exe /cygdrive/d/repo_diprima/Dottorato/Algoritm_streak_detection/CPP/algoritm_streak_detection_cpp/src/astrometricReduction.sh %imgName% %arcsecpixScaleL% %arcsecpixScaleH%
) ELSE (
	c:\cygwin\bin\bash.exe /cygdrive/d/repo_diprima/Dottorato/Algoritm_streak_detection/CPP/algoritm_streak_detection_cpp/src/astrometricReduction.sh %imgName%
)

echo Fine

add script windows for astrometry.net

add script windows for astrometry.net


zpaq.exe add archive.zpaq "%LIBRARY_BIN%"\zpaq.exe || exit 1
zpaq.exe extract archive.zpaq "%LIBRARY_BIN%"\zpaq.exe -to zpaq.new || exit 1
fc /b "%LIBRARY_BIN%"\zpaq.exe zpaq.new || exit 1
del archive.zpaq zpaq.new

add windows test

add windows test


cd src\tools\msvc

echo $config-^>{openssl} = '%LIBRARY_PREFIX%'; >> config.pl
echo $config-^>{zlib} = '%LIBRARY_PREFIX%';    >> config.pl
echo $config-^>{python} = '%PREFIX%';          >> config.pl

:: Need to move a more current msbuild into PATH.  32-bit one in particular on AppVeyor barfs on the solution that
::    Postgres writes here.  This one comes from the Win7 SDK (.net 4.0), and is known to work.
if "%ARCH%" == "32" (
   COPY C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe .\
)

call build.bat
call install.bat "%LIBRARY_PREFIX%"
call vcregress check
call vcregress installcheck
call vcregress plcheck
call vcregress contribcheck

cd src\tools\msvc

echo $config-^>{openssl} = '%LIBRARY_PREFIX%'; >> config.pl
echo $config-^>{zlib} = '%LIBRARY_PREFIX%';    >> config.pl
echo $config-^>{python} = '%PREFIX%';          >> config.pl

:: Need to move a more current msbuild into PATH.  32-bit one in particular on AppVeyor barfs on the solution that
::    Postgres writes here.  This one comes from the Win7 SDK (.net 4.0), and is known to work.
if "%ARCH%" == "32" (
   COPY C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe .\
   set PATH=%CD%;%PATH%
)

call build.bat
call install.bat "%LIBRARY_PREFIX%"
call vcregress check
call vcregress installcheck
call vcregress plcheck
call vcregress contribcheck

set PATH for msbuild in postgres

set PATH for msbuild in postgres


mkdir -p build-cmake
cd build-cmake
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DCMAKE_BUILD_TYPE=Release ..
if errorlevel 1 exit 1
nmake
if errorlevel 1 exit 1
nmake install
if errorlevel 1 exit 1
MOVE %LIBRARY_LIB%\ann.dll %LIBRARY_BIN%

mkdir -p build-cmake
cd build-cmake
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DCMAKE_BUILD_TYPE=Release -DANN_NO_RANDOM ..
if errorlevel 1 exit 1
nmake
if errorlevel 1 exit 1
nmake install
if errorlevel 1 exit 1
MOVE %LIBRARY_LIB%\ann.dll %LIBRARY_BIN%

Add flag specifying that random/srandom are not available on windows


mkdir build && cd build

cmake -LAH -G "NMake Makefiles" ^
  -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
  -DCMAKE_PREFIX_PATH:PATH="%LIBRARY_PREFIX%" ^
  -DCMAKE_BUILD_TYPE=Release ^
  %SRC_DIR%\src
if errorlevel 1 exit 1

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

mkdir build && cd build

set PKG_CONFIG_PATH=%LIBRARY_LIB%

cmake -LAH -G "NMake Makefiles" ^
  -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
  -DCMAKE_PREFIX_PATH:PATH="%LIBRARY_PREFIX%" ^
  -DCMAKE_BUILD_TYPE=Release ^
  %SRC_DIR%\src
if errorlevel 1 exit 1

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

set PKG_CONFIG_PATH in bld.bat

set PKG_CONFIG_PATH in bld.bat


setlocal
cd "%~dp0..\.."

set BEEFWEB_TEST_BUILD_TYPE=release
set BEEFWEB_USE_BEAST=1

server\build\release\src\tests\Release\core_tests.exe
if errorlevel 1 goto :end

pushd js\api_tests

yarn install
if errorlevel 1 goto :end

yarn test
if errorlevel 1 goto :end

popd

:end

setlocal
cd "%~dp0..\.."

set BEEFWEB_TEST_BUILD_TYPE=release
set BEEFWEB_USE_BEAST=1

@echo.
@echo === Running server tests ===
@echo.
server\build\release\src\tests\Release\core_tests.exe
@if errorlevel 1 goto :end

@pushd js\api_tests

@echo.
@echo === Installing packages for API tests ===
@echo.
cmd /c yarn install
@if errorlevel 1 goto :end

@echo.
@echo === Running API tests ===
@echo.
cmd /c yarn test
@if errorlevel 1 goto :end

@popd

:end

scripts/appveyor/test.cmd: improve diagnostics, run yarn with cmd /c to avoid exiting current script


:;# This script performs generates and copies the necesary library dependencies for running qt-projects both for
:;# dynamic and for staic builds.
:;#
:;# This file is part of the MNE-CPP project. For more information visit: https://mne-cpp.github.io/
:;#
:;# This script is based ßon an open-source cross-platform script template.
:;# For more information you can visit: https://github.com/juangpc/multiplatform_bash_cmd
:;#

:<<BATCH
  :;@echo off
  :; # ########## WINDOWS SECTION #########################

  $PrintOutput=False
  $StopOnFirstTestFail=False

  $verboseMode=%1
  $exitMode=%2

  IF "%verboseMode%"=="verbose" (
    SET PrintOutput=True
  )

  IF "%exitMode%"=="exitOnFail" (
    SET StopOnFirstTestFail=True
  )

SET /A compoundOutput=0

:compoundReturnValue
{
  IF %lastReturnValue% NEQ 0 (
    %compoundOutput% += 1
  )
  @REM echo %compundOutput%
}

echo " "

dir /s /b bin\test_*.exe
for %%f in (bin\test_*.exe) do (
  echo %%nf
  start "" "%%f"
  if errorlevel 1 (
    compoundReturnValue

  )
)
Get-ChildItem -Filter bin/test_*.exe | ForEach {
  IF " ( $PrintOutput -eq "True" ) {
    &$_.FullName;
  } else {
    Write-Host " $_  => " -NoNewline
    # ($out = &$_.Fullname) ;
    ($out = &$_.Fullname) 2>&1 | out-null;
    # &$_.Fullname 2>&1 | Out-Null;
  }
  compoundReturnValue $lastexitcode;
  IF " ( $lastexitcode -ne 0 ) {
    Write-Host " FAIL!"  -ForegroundColor Red;
    IF " ($StopOnFirstTestFail -eq "True" ) {
      exit $lastexitcode
    }
  }  else {
    Write-Host " RockSolid!" -ForegroundColor Green;
  }
}

exit %compoundOutput%

  :; # ########## WINDOWS SECTION ENDS ####################
  :; # ####################################################
  exit /b
BATCH

# ######################################################
# ############## LINUX MAC SECTION STARTS ##############
#!/bin/bash

#####  default parameters

VerboseMode="false"
ExitOnFirstFail="false"
RunCodeCoverage="false"

##### function definitions

doPrintConfiguration() {
  echo =========================================
  echo " "  VerboseMode = $VerboseMode
  echo " "  ExitOnFirstFail = $ExitOnFirstFail
  echo " "  RunCodeCoverage = $RunCodeCoverage
  echo =========================================
}

doPrintHelp() {
  echo " "
  echo "MNE-CPP testing script help."
  echo "This script will run all applications in bin folder starting with "test_""
  echo "For help run: ./test_all help"
  echo "Normal call has 2 or 3 arguments: ./test_all (verbose/summary) (exitOnFail/continueOnFail) [coverage/noCoverage]"
  echo " "
}

## input arguments parsing

if [[ -z "$1" ]]; then #IF first argument is missing
  echo "Running script in default mode."
  echo " "
else
  if [[ $1 == verbose ]]; then #if first argument is equal to
    VerboseMode="true"
  elif [[ $1 == summary ]]; then #if second argument is equal to
    VerboseMode="false"
  elif [[ $1 == help ]]; then #if third argument is equal to
    doPrintHelp
    exit 1
  fi

  if [[ $2 == exitOnFail ]]; then
    ExitOnFirstFail="true"
  elif [[ $2 == continueOnFail ]]; then
    ExitOnFirstFail="false"
  fi

  if [[ $3 == coverage ]]; then
    RunCodeCoverage="true"
  else
    RunCodeCoverage="false"
  fi
fi

doPrintConfiguration  # call to this function defined previously

##########

RepoRootDir="$(dirname "$BASH_SOURCE")/../.."
echo $RepoRootDir

if [[ $(uname) == "Linux" ]]; then
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RepoRootDir/lib
fi

########## start calling each test with some formatting
CompoundOutput=0
testColumnWidth=60
printf "%${testColumnWidth}s %s\n" " Test Name " " Result "

for test in $RepoRootDir/bin/test_*;
do
  # Run all tests and call gcov on all cpp files after each test run. Then upload to codecov for every test run.
  # Codecov is able to process multiple uploads and merge them as soon as the CI job is done.
  if [ $VerboseMode == "false" ];
  then
    $test &> /dev/null
    lastReturnValue=$?
  else
    $test
    lastReturnValue=$?
  fi

  if [ $lastReturnValue -ne 0 ];
  then
    CompoundOutput=$((CompoundOutput + 1))
    printf "%${testColumnWidth}s \e[91m\033[1m %s \033[0m\e[0m\n" "${test}" "FAILED!"
    if [ $ExitOnFirstFail == "true" ];
    then
      exit $lastReturnValue
    fi
  else
    # echo ">> Test $test \t\t\t\t RockSolid!"
    printf "%${testColumnWidth}s \e[92m %s \e[0m\n" "${test}" "Rock Solid!"
  fi

  if [ $RunCodeCoverage == "true" ];
  then
    find ./libraries -type f -name "*.cpp" -exec gcov {} \; &> /dev/null
    # Hide codecov output since it corrupts the log too much
    codecov &> /dev/null
  fi

done

exit $CompoundOutput

# ############## LINUX MAC SECTION ENDS ################
# ######################################################

:;# This script performs generates and copies the necesary library dependencies for running qt-projects both for
:;# dynamic and for staic builds.
:;#
:;# This file is part of the MNE-CPP project. For more information visit: https://mne-cpp.github.io/
:;#
:;# This script is based ßon an open-source cross-platform script template.
:;# For more information you can visit: https://github.com/juangpc/multiplatform_bash_cmd
:;#

:<<BATCH
  :; # ########## WINDOWS SECTION #########################
  @echo off

@REM Setup default values
setlocal
set scriptPath=%~dp0
set basePath=%scriptPath%..\..

set printOutput=False
set stopOnFirstFail=False
set runCodeCoverage=False

@REM parse input argument
set verboseModeInput=%1
set stopOnFirstFailInput=%2

if "%verboseModeInput%"=="verbose" (
  set printOutput=True
)

if "%stopOnFirstFailInput%"=="exitOnFail" (
  set stopOnFirstFail=True
)

@REM start execution

call:doPrintConfiguration

set /A "compoundOutput=0"

cd %basePath%\bin

@REM for /f %%f in ('dir test_*.exe /s /b ^| findstr "filtering"') do (
for /f %%f in ('dir test_*.exe /s /b ^| findstr /v "d.exe"') do (
  if "%printOutput%"=="True" (
    %%f && call:success %%~nxf || call:fail %%~nxf
  ) else (
    %%f > null 2>&1 && call:success %%~nxf || call:fail %%~nxf
  )
)

cd %scriptPath%

exit /B %compoundOutput%

:doPrintConfiguration
  echo.
  echo =========================================
  echo verbose = %printOutput%
  echo exitOnFail = %stopOnFirstFail%
  echo runCodeCoverage = %runCodeCoverage%
  echo =========================================
  echo.
exit /B 0

:success
  echo %~1
exit /B 0

:fail
  echo %~1
  set /A "compoundOutput+=1"
exit /B 0

  :; # ########## WINDOWS SECTION ENDS ####################
  :; # ####################################################
  exit /b
BATCH

# ######################################################
# ############## LINUX MAC SECTION STARTS ##############
#!/bin/bash

#####  default parameters

VerboseMode="false"
ExitOnFirstFail="false"
RunCodeCoverage="false"

##### function definitions

doPrintConfiguration() {
  echo =========================================
  echo " "  VerboseMode = $VerboseMode
  echo " "  ExitOnFirstFail = $ExitOnFirstFail
  echo " "  RunCodeCoverage = $RunCodeCoverage
  echo =========================================
}

doPrintHelp() {
  echo " "
  echo "MNE-CPP testing script help."
  echo "This script will run all applications in bin folder starting with "test_""
  echo "For help run: ./test_all help"
  echo "Normal call has 2 or 3 arguments: ./test_all (verbose/summary) (exitOnFail/continueOnFail) [coverage/noCoverage]"
  echo " "
}

## input arguments parsing

if [[ -z "$1" ]]; then #IF first argument is missing
  echo "Running script in default mode."
  echo " "
else
  if [[ $1 == verbose ]]; then #if first argument is equal to
    VerboseMode="true"
  elif [[ $1 == summary ]]; then #if second argument is equal to
    VerboseMode="false"
  elif [[ $1 == help ]]; then #if third argument is equal to
    doPrintHelp
    exit 1
  fi

  if [[ $2 == exitOnFail ]]; then
    ExitOnFirstFail="true"
  elif [[ $2 == continueOnFail ]]; then
    ExitOnFirstFail="false"
  fi

  if [[ $3 == coverage ]]; then
    RunCodeCoverage="true"
  else
    RunCodeCoverage="false"
  fi
fi

doPrintConfiguration  # call to this function defined previously

##########

RepoRootDir="$(dirname "$BASH_SOURCE")/../.."
echo $RepoRootDir

if [[ $(uname) == "Linux" ]]; then
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RepoRootDir/lib
fi

########## start calling each test with some formatting
CompoundOutput=0
testColumnWidth=60
printf "%${testColumnWidth}s %s\n" " Test Name " " Result "

for test in $RepoRootDir/bin/test_*;
do
  # Run all tests and call gcov on all cpp files after each test run. Then upload to codecov for every test run.
  # Codecov is able to process multiple uploads and merge them as soon as the CI job is done.
  if [ $VerboseMode == "false" ];
  then
    $test &> /dev/null
  else
    $test
  fi
  lastReturnValue=$?

  if [ $lastReturnValue -ne 0 ];
  then
    CompoundOutput=$((CompoundOutput + 1))
    printf "%${testColumnWidth}s \e[91m\033[1m %s \033[0m\e[0m\n" "${test}" "FAILED!"
    if [ $ExitOnFirstFail == "true" ];
    then
      exit $lastReturnValue
    fi
  else
    # echo ">> Test $test \t\t\t\t RockSolid!"
    printf "%${testColumnWidth}s \e[92m %s \e[0m\n" "${test}" "Rock Solid!"
  fi

  if [ $RunCodeCoverage == "true" ];
  then
    find ./libraries -type f -name "*.cpp" -exec gcov {} \; &> /dev/null
    # Hide codecov output since it corrupts the log too much
    codecov &> /dev/null
  fi

done

exit $CompoundOutput

# ############## LINUX MAC SECTION ENDS ################
# ######################################################

fix windows testing script

fix windows testing script


@echo off

set DIST_DIR=dist
set CERTIFICATE_PATH=%HOMEPATH%\certificates\nuxeo.com.pfx
set MSI_PROGRAM_NAME="Nuxeo Drive"
set TIMESTAMP_URL=http://timestamp.verisign.com/scripts/timstamp.dll

set SIGN_CMD=signtool sign /v /f %CERTIFICATE_PATH% /d %MSI_PROGRAM_NAME% /t %TIMESTAMP_URL%
set VERIFY_CMD=signtool verify /v /pa

FOR %%F IN (%DIST_DIR%\*.msi) DO (
	echo ---------------------------------------------
	echo Signing %%F
    echo ---------------------------------------------
	echo %SIGN_CMD% %%F
	%SIGN_CMD% %%F
	echo ---------------------------------------------
    echo Verifying %%F
	echo ---------------------------------------------
    echo %VERIFY_CMD% %%F
	%VERIFY_CMD% %%F
)

@echo off

set DIST_DIR=dist
set CERTIFICATE_PATH=%USERPROFILE%\certificates\nuxeo.com.pfx
set MSI_PROGRAM_NAME="Nuxeo Drive"
set TIMESTAMP_URL=http://timestamp.verisign.com/scripts/timstamp.dll

set SIGN_CMD=signtool sign /v /f %CERTIFICATE_PATH% /d %MSI_PROGRAM_NAME% /t %TIMESTAMP_URL%
set VERIFY_CMD=signtool verify /v /pa

FOR %%F IN (%DIST_DIR%\*.msi) DO (
	echo ---------------------------------------------
	echo Signing %%F
    echo ---------------------------------------------
	echo %SIGN_CMD% %%F
	%SIGN_CMD% %%F
	echo ---------------------------------------------
    echo Verifying %%F
	echo ---------------------------------------------
    echo %VERIFY_CMD% %%F
	%VERIFY_CMD% %%F
)

NXP-12981: Use C:\Users\nuxeo instead of \Users\nuxeo in msi signing batch script (not set by Jenkins)


@echo off

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

set arch=%1
set output_build_directory=etcher-release
set output_directory=%output_build_directory%\installers
set certificate_file=certificate.p12
set certificate_pass=1234
set timestamp_server_url=http://timestamp.comodoca.com

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Validate arguments
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if "%arch%"=="" (
  echo Usage: %0 [arch] 1>&2
  exit /b 1
)

:: Batch conditionals don't support logical operators.
:: Simulate "and" with nested conditions.
if not "%arch%"=="x86" (
  if not "%arch%"=="x64" (
    echo Unknown architecture: %arch% 1>&2
    exit /b 1
  )
)

:: Check that rimraf is installed.
:: We make use of this command line tool to clear
:: saved dependencies since doing so with `del`
:: might return errors due to long paths.
where rimraf >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: rimraf 1>&2
  exit /b 1
)

:: Check that signtool is installed.
where signtool >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: signtool 1>&2
  exit /b 1
)

:: Check that bower is installed.
where bower >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: bower 1>&2
  exit /b 1
)

:: Check that makensis is installed.
where makensis >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: nsis 1>&2
  exit /b 1
)

:: Check that upx is installed.
where upx >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: upx 1>&2
  exit /b 1
)

:: Check that asar is installed.
where asar >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: asar 1>&2
  exit /b 1
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Global variables
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set electron_packager=.\node_modules\.bin\electron-packager.cmd
set electron_builder=.\node_modules\.bin\electron-builder.cmd
set company_name="Resinio Ltd"

if "%arch%"=="x86" (
  set electron_arch=ia32
)

if "%arch%"=="x64" (
  set electron_arch=x64
)

set package_name=Etcher-win32-%arch%

for /f %%i in (' "node -e ""console.log(require('./package.json').devDependencies['electron-prebuilt'])""" ') do (
  set electron_version=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').displayName)""" ') do (
  set application_name=%%i
)

for /f "delims=" %%i in (' "node -e ""console.log(require('./package.json').description)""" ') do (
  set application_description=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').copyright)""" ') do (
  set application_copyright=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').version)""" ') do (
  set etcher_version=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').engines.node)""" ') do (
  set electron_node_version=%%i
)

for /f %%i in (' "node -v" ') do (
  set node_version=%%i
)

if not "v%electron_node_version%"=="%node_version%" (
  echo Incompatible NodeJS version. Expected: %electron_node_version% 1>&2
  exit /b 1
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Configure NPM to build native addons for Electron correctly
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: We require Visual Studio 2013 specifically since newer versions
:: lack command line build tools such as `lib.exe` and `cl.exe`.
set GYP_MSVS_VERSION=2013

set npm_config_disturl=https://atom.io/download/atom-shell
set npm_config_runtime=electron
set npm_config_target=%electron_version%
set npm_config_arch=%electron_arch%
set HOME=%homedrive%%homepath%\.electron-gyp

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Install dependencies
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

call rimraf node_modules bower_components
call npm install --production --build-from-source
call bower install --production

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Package application
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for /f %%i in (' "node .\scripts\packageignore.js" ') do (
  set electron_ignore="%%i"
)

call %electron_packager% . %application_name%^
 --platform=win32^
 --arch=%electron_arch%^
 --version=%electron_version%^
 --ignore=%electron_ignore%^
 --icon="assets/icon.ico"^
 --app-copyright=%application_copyright%^
 --app-version=%etcher_version%^
 --build-version=%etcher_version%^
 --version-string.CompanyName=%company_name%^
 --version-string.FileDescription=%application_name%^
 --version-string.OriginalFilename=%package_name%^
 --version-string.ProductName="%application_name% -- %application_description%"^
 --version-string.InternalName=%application_name%^
 --overwrite^
 --out=%output_build_directory%

set package_output=%output_build_directory%\%package_name%

if not "%arch%"=="%electron_arch%" (
  move %output_build_directory%\Etcher-win32-%electron_arch% %package_output%
)

:: Omit *.dll and *.node files from the asar package, otherwise
:: `process.dlopen` and `module.require` can't load them correctly.
call asar pack %package_output%\resources\app %package_output%\resources\app.asar^
 --unpack "{*.dll,*.node}"
call rimraf %package_output%\resources\app

signtool sign^
 /t %timestamp_server_url%^
 /d "%application_name% - %etcher_version%"^
 /f %certificate_file%^
 /p %certificate_pass%^
 %package_output%\Etcher.exe
signtool verify /pa /v %package_output%\Etcher.exe

upx -9 %package_output%\*.dll

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Generate installer
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set installer_tmp_output=%output_build_directory%\win32-%arch%-tmp-installer
set installer_output=%output_directory%\Etcher-win32-%arch%.exe

call %electron_builder% %package_output%^
 --platform=win^
 --out=%installer_tmp_output%

mkdir "%output_directory%"
move "%installer_tmp_output%\%application_name% Setup.exe" "%installer_output%"
rd /s /q "%installer_tmp_output%"

signtool sign^
 /t %timestamp_server_url%^
 /d "%application_name% - %etcher_version%"^
 /f %certificate_file%^
 /p %certificate_pass%^
 %installer_output%
signtool verify /pa /v %installer_output%

@echo off

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

set arch=%1
set output_build_directory=etcher-release
set output_directory=%output_build_directory%\installers
set certificate_file=certificate.p12
set certificate_pass=1234
set timestamp_server_url=http://timestamp.comodoca.com

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Validate arguments
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if "%arch%"=="" (
  echo Usage: %0 [arch] 1>&2
  exit /b 1
)

:: Batch conditionals don't support logical operators.
:: Simulate "and" with nested conditions.
if not "%arch%"=="x86" (
  if not "%arch%"=="x64" (
    echo Unknown architecture: %arch% 1>&2
    exit /b 1
  )
)

:: Check that rimraf is installed.
:: We make use of this command line tool to clear
:: saved dependencies since doing so with `del`
:: might return errors due to long paths.
where rimraf >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: rimraf 1>&2
  exit /b 1
)

:: Check that signtool is installed.
where signtool >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: signtool 1>&2
  exit /b 1
)

:: Check that bower is installed.
where bower >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: bower 1>&2
  exit /b 1
)

:: Check that makensis is installed.
where makensis >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: nsis 1>&2
  exit /b 1
)

:: Check that upx is installed.
where upx >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: upx 1>&2
  exit /b 1
)

:: Check that asar is installed.
where asar >nul 2>nul
if %ERRORLEVEL% neq 0 (
  echo Dependency missing: asar 1>&2
  exit /b 1
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Global variables
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set electron_packager=.\node_modules\.bin\electron-packager.cmd
set electron_builder=.\node_modules\.bin\electron-builder.cmd
set company_name="Resinio Ltd"

if "%arch%"=="x86" (
  set electron_arch=ia32
)

if "%arch%"=="x64" (
  set electron_arch=x64
)

set package_name=Etcher-win32-%arch%

for /f %%i in (' "node -e ""console.log(require('./package.json').devDependencies['electron-prebuilt'])""" ') do (
  set electron_version=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').displayName)""" ') do (
  set application_name=%%i
)

for /f "delims=" %%i in (' "node -e ""console.log(require('./package.json').description)""" ') do (
  set application_description=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').copyright)""" ') do (
  set application_copyright=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').version)""" ') do (
  set etcher_version=%%i
)

for /f %%i in (' "node -e ""console.log(require('./package.json').engines.node)""" ') do (
  set electron_node_version=%%i
)

for /f %%i in (' "node -v" ') do (
  set node_version=%%i
)

if not "v%electron_node_version%"=="%node_version%" (
  echo Incompatible NodeJS version. Expected: %electron_node_version% 1>&2
  exit /b 1
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Configure NPM to build native addons for Electron correctly
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: We require Visual Studio 2013 specifically since newer versions
:: lack command line build tools such as `lib.exe` and `cl.exe`.
set GYP_MSVS_VERSION=2013

set npm_config_disturl=https://atom.io/download/atom-shell
set npm_config_runtime=electron
set npm_config_target=%electron_version%
set npm_config_arch=%electron_arch%
set HOME=%homedrive%%homepath%\.electron-gyp

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Install dependencies
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

call rimraf node_modules bower_components
call npm install --production --build-from-source
call bower install --production

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Package application
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for /f %%i in (' "node .\scripts\packageignore.js" ') do (
  set electron_ignore="%%i"
)

call %electron_packager% . %application_name%^
 --platform=win32^
 --arch=%electron_arch%^
 --version=%electron_version%^
 --ignore=%electron_ignore%^
 --icon="assets/icon.ico"^
 --app-copyright=%application_copyright%^
 --app-version=%etcher_version%^
 --build-version=%etcher_version%^
 --version-string.CompanyName=%company_name%^
 --version-string.FileDescription=%application_name%^
 --version-string.OriginalFilename=%package_name%^
 --version-string.ProductName="%application_name% -- %application_description%"^
 --version-string.InternalName=%application_name%^
 --overwrite^
 --out=%output_build_directory%

set package_output=%output_build_directory%\%package_name%

if not "%arch%"=="%electron_arch%" (
  move %output_build_directory%\Etcher-win32-%electron_arch% %package_output%
)

:: Omit *.dll and *.node files from the asar package, otherwise
:: `process.dlopen` and `module.require` can't load them correctly.
call asar pack %package_output%\resources\app %package_output%\resources\app.asar^
 --unpack "{*.dll,*.node}"
call rimraf %package_output%\resources\app

signtool sign^
 /t %timestamp_server_url%^
 /d "%application_name% - %etcher_version%"^
 /f %certificate_file%^
 /p %certificate_pass%^
 %package_output%\Etcher.exe
signtool verify /pa /v %package_output%\Etcher.exe

upx -9 %package_output%\*.dll

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Generate installer
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set installer_tmp_output=%output_build_directory%\win32-%arch%-tmp-installer
set installer_output=%output_directory%\Etcher-win32-%arch%.exe

call npm install --only=dev
call %electron_builder% %package_output%^
 --platform=win^
 --out=%installer_tmp_output%

mkdir "%output_directory%"
move "%installer_tmp_output%\%application_name% Setup.exe" "%installer_output%"
rd /s /q "%installer_tmp_output%"

signtool sign^
 /t %timestamp_server_url%^
 /d "%application_name% - %etcher_version%"^
 /f %certificate_file%^
 /p %certificate_pass%^
 %installer_output%
signtool verify /pa /v %installer_output%

Install dev dependencies before calling electron-builder on Windows (#426)

Since the addition of a patch to only install production dependencies on
build scripts, the Windows build would fail when reaching to
`electron-builder`, since this dependency might not be installed at that
point.

Signed-off-by: Juan Cruz Viotti <8493db2a4f45d66df375afe12f7eba59fe1c8d78@gmail.com>


rem per user startup.cmd
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" /v PeopleBand /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Start_TrackProgs /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Input\TIPC" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v GlobalUserDisabled /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{A8804298-2D5F-42E3-9531-9C8C39EB29CE}" /v Value /d Deny /f
reg.exe delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /F

PowerShell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\unpin-all.ps1"

rem per user startup.cmd
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" /v PeopleBand /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Start_TrackProgs /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Input\TIPC" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v GlobalUserDisabled /t REG_DWORD /d 1 /f
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{A8804298-2D5F-42E3-9531-9C8C39EB29CE}" /v Value /d Deny /f
reg.exe delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /F

PowerShell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\startup.ps1"

Update Startup.cmd

Update Startup.cmd


@ECHO OFF
SETLOCAL
SET EL=0

ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SET PATH=%CD%;%PATH%
SET msvs_version=2013
IF "%msvs_toolset%"=="14" SET msvs_version=2015
IF NOT "%NODE_RUNTIME%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --runtime=%NODE_RUNTIME%"
IF NOT "%NODE_RUNTIME_VERSION%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --target=%NODE_RUNTIME_VERSION%"

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
::only use Install-Product when using VS2013
::IF /I "%APPVEYOR%"=="True" IF /I "%msvs_toolset%"=="12" powershell Install-Product node $env:nodejs_version $env:Platform
::TESTING:
::always install (get npm matching node), but delete installed programfiles node.exe afterwards for VS2015 (using custom node.exe)
IF /I "%APPVEYOR%"=="True" GOTO APPVEYOR_INSTALL
GOTO SKIP_APPVEYOR_INSTALL

:APPVEYOR_INSTALL
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_MAJOR=%nodejs_version:~0,1%
ECHO node major version^: %NODE_MAJOR%
IF %NODE_MAJOR% GTR 0 ECHO node version greater than zero, not updating npm && GOTO SKIP_APPVEYOR_INSTALL

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CALL npm install --global --production npm-windows-upgrade
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
REM https://ci.appveyor.com/project/Mapbox/node-sqlite3/build/1.0.500/job/n2y9fo4eg316db56#L289
REM error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers
REM at least 2.15.9 is needed: https://github.com/nodejs/node-gyp/issues/972#issuecomment-231055109
CALL npm-windows-upgrade --npm-version 2.15.9 --no-dns-check --no-prompt
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:SKIP_APPVEYOR_INSTALL
IF /I "%msvs_toolset%"=="12" GOTO NODE_INSTALLED

::custom node for VS2015
SET ARCHPATH=
IF "%platform%"=="X64" (SET ARCHPATH=x64/)
IF "%platform%"=="x64" (SET ARCHPATH=x64/)
SET NODE_URL=https://mapbox.s3.amazonaws.com/node-cpp11/v%nodejs_version%/%ARCHPATH%node.exe
ECHO downloading node^: %NODE_URL%
powershell Invoke-WebRequest "${env:NODE_URL}" -OutFile node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO deleting node ...
SET NODE_EXE_PRG=%ProgramFiles%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles%\nodejs" ECHO copy custom node.exe to %ProgramFiles%\nodejs\ && COPY node.exe "%ProgramFiles%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_EXE_PRG=%ProgramFiles(x86)%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles(x86)%\nodejs" ECHO copy custom node.exe to %ProgramFiles(x86)%\nodejs\ && COPY node.exe "%ProgramFiles(x86)%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO delete node.exe in current directory && DEL node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NODE_INSTALLED

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

ECHO installing node-gyp
CALL npm install -g node-gyp
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('CALL node_modules\.bin\node-pre-gyp reveal module %TOOLSET_ARGS% --silent') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF "%NODE_RUNTIME%"=="electron" GOTO CHECK_ELECTRON_TEST_ERRORLEVEL

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================
ECHO using iojs, not checking test result!!!!!!!!!
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_ELECTRON_TEST_ERRORLEVEL
ECHO installing electron
CALL npm install -g "electron@%NODE_RUNTIME_VERSION%"
ECHO installing electron-mocha
CALL npm install -g electron-mocha
ECHO calling electron-mocha
CALL electron-mocha -R spec --timeout 480000
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED

CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

@ECHO OFF
SETLOCAL
SET EL=0

ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SET PATH=%CD%;%PATH%
SET msvs_version=2013
IF "%msvs_toolset%"=="14" SET msvs_version=2015
IF NOT "%NODE_RUNTIME%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --runtime=%NODE_RUNTIME%"
IF NOT "%NODE_RUNTIME_VERSION%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --target=%NODE_RUNTIME_VERSION%"

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
::only use Install-Product when using VS2013
::IF /I "%APPVEYOR%"=="True" IF /I "%msvs_toolset%"=="12" powershell Install-Product node $env:nodejs_version $env:Platform
::TESTING:
::always install (get npm matching node), but delete installed programfiles node.exe afterwards for VS2015 (using custom node.exe)
IF /I "%APPVEYOR%"=="True" GOTO APPVEYOR_INSTALL
GOTO SKIP_APPVEYOR_INSTALL

:APPVEYOR_INSTALL
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_MAJOR=%nodejs_version:~0,1%
ECHO node major version^: %NODE_MAJOR%
IF %NODE_MAJOR% GTR 0 ECHO node version greater than zero, not updating npm && GOTO SKIP_APPVEYOR_INSTALL

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CALL npm install --global --production npm-windows-upgrade
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
REM https://ci.appveyor.com/project/Mapbox/node-sqlite3/build/1.0.500/job/n2y9fo4eg316db56#L289
REM error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers
REM at least 2.15.9 is needed: https://github.com/nodejs/node-gyp/issues/972#issuecomment-231055109
CALL npm-windows-upgrade --npm-version 2.15.9 --no-dns-check --no-prompt
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:SKIP_APPVEYOR_INSTALL
IF /I "%msvs_toolset%"=="12" GOTO NODE_INSTALLED

::custom node for VS2015
SET ARCHPATH=
IF "%platform%"=="X64" (SET ARCHPATH=x64/)
IF "%platform%"=="x64" (SET ARCHPATH=x64/)
SET NODE_URL=https://mapbox.s3.amazonaws.com/node-cpp11/v%nodejs_version%/%ARCHPATH%node.exe
ECHO downloading node^: %NODE_URL%
powershell Invoke-WebRequest "${env:NODE_URL}" -OutFile node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO deleting node ...
SET NODE_EXE_PRG=%ProgramFiles%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles%\nodejs" ECHO copy custom node.exe to %ProgramFiles%\nodejs\ && COPY node.exe "%ProgramFiles%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_EXE_PRG=%ProgramFiles(x86)%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles(x86)%\nodejs" ECHO copy custom node.exe to %ProgramFiles(x86)%\nodejs\ && COPY node.exe "%ProgramFiles(x86)%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO delete node.exe in current directory && DEL node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NODE_INSTALLED

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

ECHO installing node-gyp
CALL npm install -g node-gyp
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('"CALL node_modules\.bin\node-pre-gyp reveal module %TOOLSET_ARGS% --silent"') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF "%NODE_RUNTIME%"=="electron" GOTO CHECK_ELECTRON_TEST_ERRORLEVEL

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================
ECHO using iojs, not checking test result!!!!!!!!!
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_ELECTRON_TEST_ERRORLEVEL
ECHO installing electron
CALL npm install -g "electron@%NODE_RUNTIME_VERSION%"
ECHO installing electron-mocha
CALL npm install -g electron-mocha
ECHO calling electron-mocha
CALL electron-mocha -R spec --timeout 480000
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED

CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

Fix .bat variable quoting in for loop.

Fix .bat variable quoting in for loop.


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.0/2985596/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "c:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.1/3160714/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.6/VBoxGuestAdditions_5.0.6.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Update VMware Tools

Update VMware Tools


rem call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 100000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 200000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 300000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 400000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 500000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 600000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 700000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 800000 --take 100000 --compress
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 900000 --take 100000 --compress

call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 100000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 200000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 300000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 400000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 500000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 600000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 700000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 800000 --take 100000
call rn write --file "C:\Users\Marcus\Downloads\enwiki-20120502-lines-1k.txt" --dir D:\resin\wikipedia --skip 900000 --take 100000

write script no compressing

write script no compressing


@ECHO off

REM # This should be functionally equivalent to the Makefile found in the
REM # same directory.

SET TAG=[tt]
SET REQS=%CD%\reqs
SET DEVREQS="%REQS%\requirements-dev.txt"
SET TT_PYPI_NAME=ttable

IF NOT "x%1"=="x" CALL :%1 || EXIT /B 1
EXIT /B 0

:clean
ECHO %TAG% Cleaning environment...
DEL /s /q *.pyc >nul 2>&1
RD /s /q build >nul 2>&1
RD /s /q dist >nul 2>&1
RD /s /q %TT_PYPI_NAME%.egg-info >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:py-version
ECHO ----------------------------
ECHO Running with Python version:
ECHO ----------------------------
ECHO.
python --version
ECHO.
ECHO ----------------------------
ECHO.
EXIT /B 0

:install-tt
ECHO %TAG% Installing tt...
pip install --upgrade --editable . >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% Installation of tt failed. & ECHO. & EXIT /b 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:install-reqs
ECHO %TAG% Installing dev requirements from %DEVREQS%...
pip install --upgrade -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-tt
ECHO %TAG% Uninstalling tt...
CALL where tt >nul 2>&1 || (ECHO %TAG% Cancelled uninstall; tt is already not installed. & ECHO. & EXIT /B 0)
pip uninstall --yes %TT_PYPI_NAME% >nul 2>&1
CALL where tt >nul 1 2>&1 && (ECHO %TAG% Failed uninstall. & ECHO. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-reqs
ECHO %TAG% Uninstalling all tt dev requirements...
pip uninstall --yes -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:write-reqs
ECHO %TAG% Updating %DEVREQS% with the current environment's installed packages
pip freeze > %DEVREQS%
ECHO %TAG% OK.
ECHO %TAG% New contents of %DEVREQS% are:
TYPE %DEVREQS%
EXIT /B 0

:init
ECHO %TAG% Beginning initialization of tt for testing...
ECHO.
CALL :uninstall-tt || EXIT /B 1
CALL :install-reqs || EXIT /B 1
CALL :install-tt || EXIT /B 1
EXIT /B 0

:test
CALL :init || EXIT /B 1
ECHO %TAG% Running tests...
ECHO.
CALL python -m unittest discover -s tt || EXIT /B 1
ECHO.
EXIT /B 0

:test-sdist
CALL :uninstall-reqs
CALL :uninstall-tt
CALL :clean
ECHO %TAG% Beginning test of source distribution...
python setup.py sdist >nul 2>&1
FOR %%f IN (dist\*.zip) DO SET SDIST=%%f
pip install --force-reinstall --upgrade %SDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from source dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-bdist-wheel
CALL :uninstall-reqs || EXIT /B 1
CALL :uninstall-tt || EXIT /B 1
CALL :clean || EXIT /B 1
ECHO %TAG% Beginning test of binary wheel distribution...
python setup.py bdist_wheel >nul 2>&1
FOR %%f IN (dist\*.whl) DO SET WHLDIST=%%f
pip install --force-reinstall --upgrade %WHLDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from wheel dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-dist
CALL :test-sdist || EXIT /B 1
CALL :test-bdist-wheel || EXIT /B 1
EXIT /B 0

:test-all
CALL :py-version || EXIT /B 1
CALL :test || EXIT /B 1
CALL :test-dist || EXIT /B 1
EXIT /B 0

:upload
CALL :check-dev-env || EXIT /b 1
CALL :test-all || (ECHO Cancelling upload; tests failed. & EXIT /b 1)
ECHO python setup.py register

python setup.py sdist --formats=zip
python setup.py sdist --formats=gztar
python setup.py bdist_wheel
python setup.py build --plat-name=win32 bdist_msi
python setup.py build --plat-name=win-amd64 bdist_msi

FOR %%f IN (dist\*) DO ECHO python setup.py upload %%f
EXIT /B 0

@ECHO off

REM # This should be functionally equivalent to the Makefile found in the
REM # same directory.

SET TAG=[tt]
SET REQS=%CD%\reqs
SET DEVREQS="%REQS%\requirements-dev.txt"
SET TT_PYPI_NAME=ttable

IF NOT "x%1"=="x" CALL :%1 || EXIT /B 1
EXIT /B 0

:clean
ECHO %TAG% Cleaning environment...
DEL /s /q *.pyc >nul 2>&1
RD /s /q build >nul 2>&1
RD /s /q dist >nul 2>&1
RD /s /q %TT_PYPI_NAME%.egg-info >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:py-version
ECHO ----------------------------
ECHO Running with Python version:
ECHO ----------------------------
ECHO.
python --version
ECHO.
ECHO ----------------------------
ECHO.
EXIT /B 0

:install-tt
ECHO %TAG% Installing tt...
pip install --upgrade --editable . >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% Installation of tt failed. & ECHO. & EXIT /b 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:install-reqs
ECHO %TAG% Installing dev requirements from %DEVREQS%...
pip install --upgrade -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-tt
ECHO %TAG% Uninstalling tt...
CALL where tt >nul 2>&1 || (ECHO %TAG% Cancelled uninstall; tt is already not installed. & ECHO. & EXIT /B 0)
pip uninstall --yes %TT_PYPI_NAME% >nul 2>&1
CALL where tt >nul 1 2>&1 && (ECHO %TAG% Failed uninstall. & ECHO. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-reqs
ECHO %TAG% Uninstalling all tt dev requirements...
pip uninstall --yes -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:write-reqs
ECHO %TAG% Updating %DEVREQS% with the current environment's installed packages
pip freeze > %DEVREQS%
ECHO %TAG% OK.
ECHO %TAG% New contents of %DEVREQS% are:
TYPE %DEVREQS%
EXIT /B 0

:init
ECHO %TAG% Beginning initialization of tt for testing...
ECHO.
CALL :uninstall-tt || EXIT /B 1
CALL :install-reqs || EXIT /B 1
CALL :install-tt || EXIT /B 1
EXIT /B 0

:test
CALL :init || EXIT /B 1
ECHO %TAG% Running tests...
ECHO.
CALL python -m unittest discover -s tt || EXIT /B 1
ECHO.
EXIT /B 0

:test-sdist
CALL :uninstall-reqs
CALL :uninstall-tt
CALL :clean
ECHO %TAG% Beginning test of source distribution...
python setup.py sdist >nul 2>&1
FOR %%f IN (dist\*.zip) DO SET SDIST=%%f
pip install --force-reinstall --upgrade %SDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from source dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-bdist-wheel
CALL :uninstall-reqs || EXIT /B 1
CALL :uninstall-tt || EXIT /B 1
CALL :clean || EXIT /B 1
ECHO %TAG% Beginning test of binary wheel distribution...
python setup.py bdist_wheel >nul 2>&1
FOR %%f IN (dist\*.whl) DO SET WHLDIST=%%f
pip install --force-reinstall --upgrade %WHLDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from wheel dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-dist
CALL :test-sdist || EXIT /B 1
CALL :test-bdist-wheel || EXIT /B 1
EXIT /B 0

:test-all
CALL :py-version || EXIT /B 1
CALL :test || EXIT /B 1
CALL :test-dist || EXIT /B 1
EXIT /B 0

:upload
REM CALL :test-all || (ECHO Cancelling upload; tests failed. & EXIT /b 1)
REM python setup.py register
REM
python setup.py sdist --formats=zip
python setup.py sdist --formats=gztar
python setup.py bdist_wheel
python setup.py build --plat-name=win32 bdist_msi
python setup.py build --plat-name=win-amd64 bdist_msi

SETLOCAL EnableDelayedExpansion
SET ARTIFACTS=
FOR %%f IN (dist\*) DO SET ARTIFACTS=!ARTIFACTS! "%%f"
ECHO python setup.py !ARTIFACTS! upload
ENDLOCAL
EXIT /B 0

Update upload target in make.bat

Update upload target in make.bat


@echo off

REM Usage:
REM "make" for a 32-bit compile of Precomp
REM "make 64" for a 64-bit compile of Precomp
REM "make comfort" for a 32-bit compile of Precomp Comfort
REM "make comfort 64" or "make 64 comfort" for a 64-bit compile of Precomp Comfort
REM "nocontrib" parameter to build only Precomp, can be used for a much faster build
REM   if nothing was changed in the "contrib" folder

REM gcc/g++ 32-bit/64-bit commands - change them according to your environment
set GCC32=gcc
set GPP32=g++
set GCC64=gcc
set GPP64=g++

set EXE1=precomp
set EXE2=
set DCOMFORT=
set DBIT=
set MPARAM=-march=pentiumpro
set GCC=%GCC32%
set GPP=%GPP32%
set NOCONTRIB=
:parse
if "%1%"=="" goto endparse
if "%1%"=="64" (
  set GCC=%GCC64%
  set GPP=%GPP64%
  set EXE2=64
  set DBIT=-DBIT64
  set MPARAM=-march=x86-64 -m64
)
if "%1%"=="comfort" (
  set EXE1=precomf
  set DCOMFORT=-DCOMFORT
)
if "%1"=="nocontrib" (
  set NOCONTRIB=1
)
SHIFT
goto parse
:endparse

set GIF_O=gifalloc.o gif_err.o dgif_lib_gcc.o egif_lib_gcc.o
set BZIP_O=bzlib.o blocksort.o crctable.o compress.o decompress.o huffman.o randtable.o
set ZLIB_O=adler32.o crc32.o zutil.o trees.o inftrees.o inffast.o inflate.o deflate.o
set JPG_O=aricoder.o bitops.o packjpg.o
SET MP3_O=packmp3.o huffmp3.o
set LIBLZMA_O=alone_decoder.o alone_encoder.o arm.o armthumb.o auto_decoder.o block_buffer_decoder.o block_buffer_encoder.o
set LIBLZMA_O=%LIBLZMA_O% block_decoder.o block_encoder.o block_header_decoder.o block_header_encoder.o block_util.o
set LIBLZMA_O=%LIBLZMA_O% check.o common.o crc32_table.o crc32_fast.o crc64_table.o crc64_fast.o
set LIBLZMA_O=%LIBLZMA_O% delta_common.o delta_decoder.o delta_encoder.o easy_buffer_encoder.o easy_decoder_memusage.o
set LIBLZMA_O=%LIBLZMA_O% easy_encoder.o easy_encoder_memusage.o easy_preset.o fastpos_table.o filter_buffer_decoder.o
set LIBLZMA_O=%LIBLZMA_O% filter_buffer_encoder.o filter_common.o filter_decoder.o filter_encoder.o filter_flags_decoder.o
set LIBLZMA_O=%LIBLZMA_O% filter_flags_encoder.o hardware_cputhreads.o hardware_physmem.o ia64.o index.o index_decoder.o
set LIBLZMA_O=%LIBLZMA_O% index_encoder.o index_hash.o lzma2_decoder.o lzma2_encoder.o lzma_decoder.o lzma_encoder.o
set LIBLZMA_O=%LIBLZMA_O% lzma_encoder_optimum_fast.o lzma_encoder_optimum_normal.o lzma_encoder_presets.o lz_decoder.o
set LIBLZMA_O=%LIBLZMA_O% lz_encoder.o lz_encoder_mf.o outqueue.o powerpc.o price_table.o sha256.o simple_coder.o
set LIBLZMA_O=%LIBLZMA_O% simple_decoder.o simple_encoder.o sparc.o stream_decoder.o stream_buffer_encoder.o stream_buffer_decoder.o
set LIBLZMA_O=%LIBLZMA_O% stream_encoder.o stream_flags_decoder.o stream_encoder_mt.o stream_flags_common.o stream_flags_encoder.o
set LIBLZMA_O=%LIBLZMA_O% tuklib_cpucores.o tuklib_physmem.o vli_decoder.o vli_encoder.o vli_size.o x86.o
set LIBLZMA_CPP=contrib\liblzma\compress_easy_mt.cpp

if "%NOCONTRIB%" == "1" goto nocontrib
set GIF=contrib\giflib\gifalloc.c contrib\giflib\gif_err.c contrib\giflib\dgif_lib_gcc.c contrib\giflib\egif_lib_gcc.c
set BZIP=contrib\bzip2\bzlib.c contrib\bzip2\blocksort.c contrib\bzip2\crctable.c contrib\bzip2\compress.c contrib\bzip2\decompress.c contrib\bzip2\huffman.c contrib\bzip2\randtable.c
set ZLIB=contrib\zlib\adler32.c contrib\zlib\crc32.c contrib\zlib\zutil.c contrib\zlib\trees.c contrib\zlib\inftrees.c contrib\zlib\inffast.c contrib\zlib\inflate.c contrib\zlib\deflate.c
echo Building giflib...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wall %GIF%
echo Building zlib...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wno-attributes %ZLIB%
echo Building bzip...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wall %BZIP%
echo Building packJPG...
pushd contrib\packjpg
%GPP% %MPARAM% -c -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fsched-spec-load -fomit-frame-pointer aricoder.cpp bitops.cpp packjpg.cpp
move /Y aricoder.o ..\..\ > nul
move /Y bitops.o ..\..\ > nul
move /Y packjpg.o ..\..\ > nul
popd
echo Building packMP3...
pushd contrib\packmp3
copy ..\packjpg\aricoder.* > nul
copy ..\packjpg\bitops.* > nul
%GPP% %MPARAM% -c -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fsched-spec-load -fomit-frame-pointer aricoder.cpp bitops.cpp huffmp3.cpp packmp3.cpp
move /Y huffmp3.o ..\..\ > nul
move /Y packmp3.o ..\..\ > nul
if exist aricoder.* del aricoder.*
if exist bitops.* del bitops.*
popd
echo Building liblzma...
pushd contrib\liblzma
set LIBLZMA=common\tuklib_physmem.c common\tuklib_cpucores.c common\common.c common\block_util.c common\easy_preset.c
set LIBLZMA=%LIBLZMA% common\filter_common.c common\hardware_physmem.c common\index.c common\stream_flags_common.c
set LIBLZMA=%LIBLZMA% common\vli_size.c common\alone_encoder.c common\block_buffer_encoder.c common\block_encoder.c
set LIBLZMA=%LIBLZMA% common\block_header_encoder.c common\easy_buffer_encoder.c common\easy_encoder.c
set LIBLZMA=%LIBLZMA% common\easy_encoder_memusage.c common\filter_buffer_encoder.c common\filter_encoder.c
set LIBLZMA=%LIBLZMA% common\filter_flags_encoder.c common\index_encoder.c common\stream_buffer_encoder.c
set LIBLZMA=%LIBLZMA% common\stream_encoder.c common\stream_flags_encoder.c common\vli_encoder.c
set LIBLZMA=%LIBLZMA% common\hardware_cputhreads.c common\outqueue.c common\stream_encoder_mt.c common\alone_decoder.c
set LIBLZMA=%LIBLZMA% common\auto_decoder.c common\block_buffer_decoder.c common\block_decoder.c
set LIBLZMA=%LIBLZMA% common\block_header_decoder.c common\easy_decoder_memusage.c common\filter_buffer_decoder.c
set LIBLZMA=%LIBLZMA% common\filter_decoder.c common\filter_flags_decoder.c common\index_decoder.c common\index_hash.c
set LIBLZMA=%LIBLZMA% common\stream_decoder.c common\stream_buffer_decoder.c common\stream_flags_decoder.c
set LIBLZMA=%LIBLZMA% common\vli_decoder.c check\check.c check\crc32_table.c check\crc32_fast.c
set LIBLZMA=%LIBLZMA% check\crc64_table.c check\crc64_fast.c check\sha256.c lz\lz_encoder.c
set LIBLZMA=%LIBLZMA% lz\lz_encoder_mf.c lz\lz_decoder.c lzma\lzma_encoder.c lzma\lzma_encoder_presets.c
set LIBLZMA=%LIBLZMA% lzma\lzma_encoder_optimum_fast.c lzma\lzma_encoder_optimum_normal.c lzma\fastpos_table.c
set LIBLZMA=%LIBLZMA% lzma\lzma_decoder.c lzma\lzma2_encoder.c lzma\lzma2_decoder.c rangecoder\price_table.c
set LIBLZMA=%LIBLZMA% delta\delta_common.c delta\delta_encoder.c delta\delta_decoder.c simple\simple_coder.c
set LIBLZMA=%LIBLZMA% simple\simple_encoder.c simple\simple_decoder.c simple\x86.c simple\powerpc.c simple\ia64.c
set LIBLZMA=%LIBLZMA% simple\arm.c simple\armthumb.c simple\sparc.c
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Iapi\ -Icheck\ -Icommon\ -Idelta\ -Ilz\ -Ilzma\ -Irangecoder\ -Isimple\ -Wno-implicit-function-declaration -DHAVE__BOOL %LIBLZMA%
move /Y *.o ..\..\ > nul
popd
:nocontrib
echo Building precomp...
%GPP% %DCOMFORT% %MPARAM% -static -static-libgcc -static-libstdc++ -DMINGW %DBIT% -lpthread -Wall precomp.cpp %JPG_O% %MP3_O% %GIF_O% %BZIP_O% %ZLIB_O% %LIBLZMA_CPP% %LIBLZMA_O% -O2 -fomit-frame-pointer -s -o%EXE1%%EXE2%.exe
if not %ERRORLEVEL% == 0 echo ERROR!!!
if %ERRORLEVEL% == 0 echo.
if %ERRORLEVEL% == 0 echo Build successful.
set LIBLZMA_CPP=
set LIBLZMA_O=
set LIBLZMA=
set ZLIB_O=
set ZLIB=
set BZIP_O=
set BZIP=
set GIF_O=
set GIF=
set JPG_O=
set MP3_O=
set GPP=
set GCC=
set GPP32=
set GCC32=
set GPP64=
set GCC64=
set EXE1=
set EXE2=
set DCOMFORT=
set MPARAM=

@echo off

REM Usage:
REM "make" for a 32-bit compile of Precomp
REM "make 64" for a 64-bit compile of Precomp
REM "make comfort" for a 32-bit compile of Precomp Comfort
REM "make comfort 64" or "make 64 comfort" for a 64-bit compile of Precomp Comfort
REM "nocontrib" parameter to build only Precomp, can be used for a much faster build
REM   if nothing was changed in the "contrib" folder

REM gcc/g++ 32-bit/64-bit commands - change them according to your environment
set GCC32=gcc
set GPP32=g++
set GCC64=gcc
set GPP64=g++

set EXE1=precomp
set EXE2=
set DCOMFORT=
set DBIT=
set MPARAM=-march=pentiumpro
set GCC=%GCC32%
set GPP=%GPP32%
set NOCONTRIB=
:parse
if "%1%"=="" goto endparse
if "%1%"=="64" (
  set GCC=%GCC64%
  set GPP=%GPP64%
  set EXE2=64
  set DBIT=-DBIT64
  set MPARAM=-march=x86-64 -m64
)
if "%1%"=="comfort" (
  set EXE1=precomf
  set DCOMFORT=-DCOMFORT
)
if "%1"=="nocontrib" (
  set NOCONTRIB=1
)
SHIFT
goto parse
:endparse

set GIF_O=gifalloc.o gif_err.o dgif_lib_gcc.o egif_lib_gcc.o
set BZIP_O=bzlib.o blocksort.o crctable.o compress.o decompress.o huffman.o randtable.o
set ZLIB_O=adler32.o crc32.o zutil.o trees.o inftrees.o inffast.o inflate.o deflate.o
set JPG_O=aricoder.o bitops.o packjpg.o
SET MP3_O=packmp3.o huffmp3.o
set LIBLZMA_O=alone_decoder.o alone_encoder.o arm.o armthumb.o auto_decoder.o block_buffer_decoder.o block_buffer_encoder.o
set LIBLZMA_O=%LIBLZMA_O% block_decoder.o block_encoder.o block_header_decoder.o block_header_encoder.o block_util.o
set LIBLZMA_O=%LIBLZMA_O% check.o common.o crc32_table.o crc32_fast.o crc64_table.o crc64_fast.o
set LIBLZMA_O=%LIBLZMA_O% delta_common.o delta_decoder.o delta_encoder.o easy_buffer_encoder.o easy_decoder_memusage.o
set LIBLZMA_O=%LIBLZMA_O% easy_encoder.o easy_encoder_memusage.o easy_preset.o fastpos_table.o filter_buffer_decoder.o
set LIBLZMA_O=%LIBLZMA_O% filter_buffer_encoder.o filter_common.o filter_decoder.o filter_encoder.o filter_flags_decoder.o
set LIBLZMA_O=%LIBLZMA_O% filter_flags_encoder.o hardware_cputhreads.o hardware_physmem.o ia64.o index.o index_decoder.o
set LIBLZMA_O=%LIBLZMA_O% index_encoder.o index_hash.o lzma2_decoder.o lzma2_encoder.o lzma_decoder.o lzma_encoder.o
set LIBLZMA_O=%LIBLZMA_O% lzma_encoder_optimum_fast.o lzma_encoder_optimum_normal.o lzma_encoder_presets.o lz_decoder.o
set LIBLZMA_O=%LIBLZMA_O% lz_encoder.o lz_encoder_mf.o outqueue.o powerpc.o price_table.o sha256.o simple_coder.o
set LIBLZMA_O=%LIBLZMA_O% simple_decoder.o simple_encoder.o sparc.o stream_decoder.o stream_buffer_encoder.o stream_buffer_decoder.o
set LIBLZMA_O=%LIBLZMA_O% stream_encoder.o stream_flags_decoder.o stream_encoder_mt.o stream_flags_common.o stream_flags_encoder.o
set LIBLZMA_O=%LIBLZMA_O% tuklib_cpucores.o tuklib_physmem.o vli_decoder.o vli_encoder.o vli_size.o x86.o
set LIBLZMA_CPP=contrib\liblzma\compress_easy_mt.cpp

if "%NOCONTRIB%" == "1" goto nocontrib
set GIF=contrib\giflib\gifalloc.c contrib\giflib\gif_err.c contrib\giflib\dgif_lib_gcc.c contrib\giflib\egif_lib_gcc.c
set BZIP=contrib\bzip2\bzlib.c contrib\bzip2\blocksort.c contrib\bzip2\crctable.c contrib\bzip2\compress.c contrib\bzip2\decompress.c contrib\bzip2\huffman.c contrib\bzip2\randtable.c
set ZLIB=contrib\zlib\adler32.c contrib\zlib\crc32.c contrib\zlib\zutil.c contrib\zlib\trees.c contrib\zlib\inftrees.c contrib\zlib\inffast.c contrib\zlib\inflate.c contrib\zlib\deflate.c
echo Building giflib...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wall %GIF%
echo Building zlib...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wno-attributes %ZLIB%
echo Building bzip...
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Wall %BZIP%
echo Building packJPG...
pushd contrib\packjpg
%GPP% %MPARAM% -c -O3 -DBUILD_LIB -Wall -Wno-misleading-indentation -pedantic -funroll-loops -ffast-math -fsched-spec-load -fomit-frame-pointer aricoder.cpp bitops.cpp packjpg.cpp
move /Y aricoder.o ..\..\ > nul
move /Y bitops.o ..\..\ > nul
move /Y packjpg.o ..\..\ > nul
popd
echo Building packMP3...
pushd contrib\packmp3
copy ..\packjpg\aricoder.* > nul
copy ..\packjpg\bitops.* > nul
%GPP% %MPARAM% -c -O3 -DBUILD_LIB -Wall -Wno-misleading-indentation -pedantic -funroll-loops -ffast-math -fsched-spec-load -fomit-frame-pointer aricoder.cpp bitops.cpp huffmp3.cpp packmp3.cpp
move /Y huffmp3.o ..\..\ > nul
move /Y packmp3.o ..\..\ > nul
if exist aricoder.* del aricoder.*
if exist bitops.* del bitops.*
popd
echo Building liblzma...
pushd contrib\liblzma
set LIBLZMA=common\tuklib_physmem.c common\tuklib_cpucores.c common\common.c common\block_util.c common\easy_preset.c
set LIBLZMA=%LIBLZMA% common\filter_common.c common\hardware_physmem.c common\index.c common\stream_flags_common.c
set LIBLZMA=%LIBLZMA% common\vli_size.c common\alone_encoder.c common\block_buffer_encoder.c common\block_encoder.c
set LIBLZMA=%LIBLZMA% common\block_header_encoder.c common\easy_buffer_encoder.c common\easy_encoder.c
set LIBLZMA=%LIBLZMA% common\easy_encoder_memusage.c common\filter_buffer_encoder.c common\filter_encoder.c
set LIBLZMA=%LIBLZMA% common\filter_flags_encoder.c common\index_encoder.c common\stream_buffer_encoder.c
set LIBLZMA=%LIBLZMA% common\stream_encoder.c common\stream_flags_encoder.c common\vli_encoder.c
set LIBLZMA=%LIBLZMA% common\hardware_cputhreads.c common\outqueue.c common\stream_encoder_mt.c common\alone_decoder.c
set LIBLZMA=%LIBLZMA% common\auto_decoder.c common\block_buffer_decoder.c common\block_decoder.c
set LIBLZMA=%LIBLZMA% common\block_header_decoder.c common\easy_decoder_memusage.c common\filter_buffer_decoder.c
set LIBLZMA=%LIBLZMA% common\filter_decoder.c common\filter_flags_decoder.c common\index_decoder.c common\index_hash.c
set LIBLZMA=%LIBLZMA% common\stream_decoder.c common\stream_buffer_decoder.c common\stream_flags_decoder.c
set LIBLZMA=%LIBLZMA% common\vli_decoder.c check\check.c check\crc32_table.c check\crc32_fast.c
set LIBLZMA=%LIBLZMA% check\crc64_table.c check\crc64_fast.c check\sha256.c lz\lz_encoder.c
set LIBLZMA=%LIBLZMA% lz\lz_encoder_mf.c lz\lz_decoder.c lzma\lzma_encoder.c lzma\lzma_encoder_presets.c
set LIBLZMA=%LIBLZMA% lzma\lzma_encoder_optimum_fast.c lzma\lzma_encoder_optimum_normal.c lzma\fastpos_table.c
set LIBLZMA=%LIBLZMA% lzma\lzma_decoder.c lzma\lzma2_encoder.c lzma\lzma2_decoder.c rangecoder\price_table.c
set LIBLZMA=%LIBLZMA% delta\delta_common.c delta\delta_encoder.c delta\delta_decoder.c simple\simple_coder.c
set LIBLZMA=%LIBLZMA% simple\simple_encoder.c simple\simple_decoder.c simple\x86.c simple\powerpc.c simple\ia64.c
set LIBLZMA=%LIBLZMA% simple\arm.c simple\armthumb.c simple\sparc.c
%GCC% %MPARAM% -c -O2 -s -fomit-frame-pointer -Iapi\ -Icheck\ -Icommon\ -Idelta\ -Ilz\ -Ilzma\ -Irangecoder\ -Isimple\ -Wno-implicit-function-declaration -DHAVE__BOOL %LIBLZMA%
move /Y *.o ..\..\ > nul
popd
:nocontrib
echo Building precomp...
%GPP% %DCOMFORT% %MPARAM% -static -static-libgcc -static-libstdc++ -DMINGW %DBIT% -lpthread -Wall precomp.cpp %JPG_O% %MP3_O% %GIF_O% %BZIP_O% %ZLIB_O% %LIBLZMA_CPP% %LIBLZMA_O% -O2 -fomit-frame-pointer -s -o%EXE1%%EXE2%.exe
if not %ERRORLEVEL% == 0 echo ERROR!!!
if %ERRORLEVEL% == 0 echo.
if %ERRORLEVEL% == 0 echo Build successful.
set LIBLZMA_CPP=
set LIBLZMA_O=
set LIBLZMA=
set ZLIB_O=
set ZLIB=
set BZIP_O=
set BZIP=
set GIF_O=
set GIF=
set JPG_O=
set MP3_O=
set GPP=
set GCC=
set GPP32=
set GCC32=
set GPP64=
set GCC64=
set EXE1=
set EXE2=
set DCOMFORT=
set MPARAM=

Disable misleading indendation warnings for packJPG and packMP3