@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Apply a patch that disables osmesa when building GLES or swr driver when using Scons.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem Now do the same for swr as it fails to link with osmesa when using LLVM 7.0.
@rem We'll do a 2-pass build in either case. Build everything requested without GLES and swr, then build everything again
@rem with GLES or swr or both.
@IF %pythonver%==2 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 echo.

@rem Apply a patch that fixes swr build with LLVM 7.0 - https://bugs.freedesktop.org/attachment.cgi?id=141969
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% %abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle% /v^:m

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=0
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@set /p gles=Do you want to build GLAPI shared library and GLES support (y/n):
@echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST %abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST %abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q %abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /s /q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /s /q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@IF %pythonver%==2 if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST %abi% md %abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src md %abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src\git_sha1.h echo 0 > %abi%\src\git_sha1.h
@echo.
@if %pythonver% GEQ 3 call %vsenv%
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Apply a patch that disables osmesa when building GLES when using Scons build.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem We'll do a 2-pass build in this case. Build everything requested without GLES, then build everything again
@rem with GLES.
@IF %pythonver%==2 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 echo.

@rem Apply a patch that fixes swr build with LLVM 7.0 - https://bugs.freedesktop.org/attachment.cgi?id=141969
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% %abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle% /v^:m

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=0
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@set /p gles=Do you want to build GLAPI shared library and GLES support (y/n):
@echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST %abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST %abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q %abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /s /q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /s /q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@IF %pythonver%==2 if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST %abi% md %abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src md %abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src\git_sha1.h echo 0 > %abi%\src\git_sha1.h
@echo.
@if %pythonver% GEQ 3 call %vsenv%
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

Fix a broken code comment

Fix a broken code comment


@echo off

SETLOCAL enabledelayedexpansion
TITLE Elasticsearch ${project.version}

SET params='%*'

:loop
FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
    SET current=%%A
    SET params='%%B'
	SET silent=N

	IF "!current!" == "-s" (
		SET silent=Y
	)
	IF "!current!" == "--silent" (
		SET silent=Y
	)

	IF "!silent!" == "Y" (
		SET nopauseonerror=Y
	) ELSE (
	    IF "x!newparams!" NEQ "x" (
	        SET newparams=!newparams! !current!
        ) ELSE (
            SET newparams=!current!
        )
	)

    IF "x!params!" NEQ "x" (
		GOTO loop
	)
)

SET HOSTNAME=%COMPUTERNAME%

if "%ES_JVM_OPTIONS%" == "" (
set ES_JVM_OPTIONS="%~dp0\..\config\jvm.options"
)

@setlocal
for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM_OPTIONS=!JVM_OPTIONS! %%a
@endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS% %ES_JAVA_OPTS%

CALL "%~dp0elasticsearch.in.bat"
IF ERRORLEVEL 1 (
	IF NOT DEFINED nopauseonerror (
		PAUSE
	)
	EXIT /B %ERRORLEVEL%
)

"%JAVA_HOME%\bin\java" %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!

ENDLOCAL

@echo off

SETLOCAL enabledelayedexpansion
TITLE Elasticsearch ${project.version}

SET params='%*'

:loop
FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
    SET current=%%A
    SET params='%%B'
	SET silent=N

	IF "!current!" == "-s" (
		SET silent=Y
	)
	IF "!current!" == "--silent" (
		SET silent=Y
	)

	IF "!silent!" == "Y" (
		SET nopauseonerror=Y
	) ELSE (
	    IF "x!newparams!" NEQ "x" (
	        SET newparams=!newparams! !current!
        ) ELSE (
            SET newparams=!current!
        )
	)

    IF "x!params!" NEQ "x" (
		GOTO loop
	)
)

SET HOSTNAME=%COMPUTERNAME%

if "%ES_JVM_OPTIONS%" == "" (
rem '0' is the batch file, '~dp' appends the drive and path
set ES_JVM_OPTIONS="%~dp0\..\config\jvm.options"
)

@setlocal
rem extract the options from the JVM options file %ES_JVM_OPTIONS%
rem such options are the lines beginning with '-', thus "findstr /b"
for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM_OPTIONS=!JVM_OPTIONS! %%a
@endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS% %ES_JAVA_OPTS%

CALL "%~dp0elasticsearch.in.bat"
IF ERRORLEVEL 1 (
	IF NOT DEFINED nopauseonerror (
		PAUSE
	)
	EXIT /B %ERRORLEVEL%
)

"%JAVA_HOME%\bin\java" %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!

ENDLOCAL

Add comments to JVM options parsing for Windows

This commit adds some comments to the portion of bin/elasticsearch.bat
that is responsible for parsing the JVM options.


cd ..\..
C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild Banshee.sln /p:Configuration=Windows /p:Platform="Any CPU"

windows: add /p:Platform="Any CPU" to build-banshee.bat (bgo#641513)

Signed-off-by: Gabriel Burt <ce11a5f747b579a775c140646376daaba8c3eb7d@gmail.com>


REM Setup (1)

REM Switch to branch 1700 (i.e. chromium beta)

REM   This part should only need to be done once, but it won't hurt to repeat it.  The first
REM   time might take a while because it fetches an extra 1/2 GB or so of branch commits.
call gclient sync --with_branch_heads
call git fetch

set BRANCH=1700
git config --replace-all svn-remote.svn_$BRANCH.url http://src.chromium.org/chrome
REM only for committers call git config --replace-all svn-remote.svn_%BRANCH%.url svn://svn.chromium.org/chrome
call git config --replace-all svn-remote.svn_%BRANCH%.fetch branches/%BRANCH%/src:refs/remotes/origin/%BRANCH%
REM NEW for 2014: You also need to convince git-svn that the commits on http://src.chromium.org/chrome are the same as those on svn://svn.chromium.org/chrome
git config --replace-all svn-remote.svn_$BRANCH.rewriteRoot "svn://svn.chromium.org/chrome"
git config --replace-all svn-remote.svn_$BRANCH.rewriteUUID "0039d316-1c4b-4281-b951-d872f2087c98"

REM   This "initializes" the %BRANCH% refspec, to prevent 'git svn fetch' from scanning
REM   the whole svn repo history for the branch commits we already synced above.
echo ref: refs/remotes/branch-heads/%BRANCH% > .git/refs/remotes/origin/%BRANCH%

REM   This should finish quickly, just doing a bit of git-svn housekeeping.
REM   It might fetch a few recent revisions, if the git mirror is slightly out-of-date,
REM   but it shouldn't be behind by much, and most of the time it shouldn't need to
REM   fetch anything. If it's taking a long time or looks like it's fetching a bunch of
REM   stuff from svn, something is probably wrong.
call git svn fetch svn_%BRANCH%

REM   Checkout the branch 'src' tree.
call git checkout -b branch_%BRANCH% origin/%BRANCH%
REM   Make git-cl happy.
call git config branch.branch_%BRANCH%.merge refs/heads/%BRANCH%
call git config branch.branch_%BRANCH%.remote branch-heads
REM   Checkout all the submodules at their branch DEPS revisions.
call gclient sync
call gclient runhooks --force

REM Setup (2)
REM remove all .git and .gitmodules directories that came with the chromium clone

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S ".git"') DO RMDIR /Q /S "%%G"

REM Step (3) init AMD repository and pull

cd ..

call git init
call git remote rm origin 2> nul
call git remote add origin https://github.com/amd/Chromium-WebCL.git
call git fetch
call git reset --hard origin/master
call git branch --set-upstream-to=origin/master master

cd src

REM Setup (1)

REM Switch to branch 1700 (i.e. chromium beta)

REM   This part should only need to be done once, but it won't hurt to repeat it.  The first
REM   time might take a while because it fetches an extra 1/2 GB or so of branch commits.
call gclient sync --with_branch_heads
call git fetch

set BRANCH=1700
call git config --replace-all svn-remote.svn_$BRANCH.url http://src.chromium.org/chrome
REM only for committers call git config --replace-all svn-remote.svn_%BRANCH%.url svn://svn.chromium.org/chrome
call git config --replace-all svn-remote.svn_%BRANCH%.fetch branches/%BRANCH%/src:refs/remotes/origin/%BRANCH%
REM NEW for 2014: You also need to convince git-svn that the commits on http://src.chromium.org/chrome are the same as those on svn://svn.chromium.org/chrome
call git config --replace-all svn-remote.svn_$BRANCH.rewriteRoot "svn://svn.chromium.org/chrome"
call git config --replace-all svn-remote.svn_$BRANCH.rewriteUUID "0039d316-1c4b-4281-b951-d872f2087c98"

REM   This "initializes" the %BRANCH% refspec, to prevent 'git svn fetch' from scanning
REM   the whole svn repo history for the branch commits we already synced above.
echo ref: refs/remotes/branch-heads/%BRANCH% > .git/refs/remotes/origin/%BRANCH%

REM   This should finish quickly, just doing a bit of git-svn housekeeping.
REM   It might fetch a few recent revisions, if the git mirror is slightly out-of-date,
REM   but it shouldn't be behind by much, and most of the time it shouldn't need to
REM   fetch anything. If it's taking a long time or looks like it's fetching a bunch of
REM   stuff from svn, something is probably wrong.
call git svn fetch svn_%BRANCH%

REM   Checkout the branch 'src' tree.
call git checkout -b branch_%BRANCH% origin/%BRANCH%
REM   Make git-cl happy.
call git config branch.branch_%BRANCH%.merge refs/heads/%BRANCH%
call git config branch.branch_%BRANCH%.remote branch-heads
REM   Checkout all the submodules at their branch DEPS revisions.
call gclient sync
call gclient runhooks --force

REM Setup (2)
REM remove all .git and .gitmodules directories that came with the chromium clone

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S ".git"') DO RMDIR /Q /S "%%G"

REM Step (3) init AMD repository and pull

cd ..

call git init
call git remote rm origin 2> nul
call git remote add origin https://github.com/amd/Chromium-WebCL.git
call git fetch
call git reset --hard origin/master
call git branch --set-upstream-to=origin/master master

cd src

add call in front of git

add call in front of git


@echo off
rem autorun
SETLOCAL EnableDelayedExpansion

rem ---------------------- Check arguments -------------------------------
rem Arguments are: <CPU's to use> <64/32bit> <full/partial build>
SET CPUS=%1

if "%1"=="" (
SET CPUS=%NUMBER_OF_PROCESSORS%
rem setting it to 1 might avoid errors but also makes it take an hour...
rem %NUMBER_OF_PROCESSORS% manually changed to 1... because MSVC because loves to get all tangled up in internal errors when specifying "big" numbers like 8 or 24 :s
)
echo Running autobuild in %CPUS% separate processes!

SET ARCH=%2

if NOT "%2"=="32" (
if NOT "%2"=="64" (
echo "First argument should be architecture i.e 32 or 64 bits"
echo "So e.g. run: 'autobuild 32' if you want to build an x86 version."
echo "But for now the default of 64-bit will be set."
SET ARCH=64
))

SET BUILDSTYLE=%3

if "%3"=="" (
SET BUILDSTYLE=full
)

echo "Building %ARCH% bits JASP"

rem I am assuming we are starting from (SOMEDIR)\jasp-desktop\Tools  and that (SOMEDIR) contains folders like jasp-required-files and stuff like that
rem At least by default
SET STARTDIR=%CD%

rem --- default values ---
SET JASP_BASE_DIR_DEFAULT=%STARTDIR%\..\..
SET QTDIR_DEFAULT=C:\Qt
SET QTVER_DEFAULT=5.15.0
SET RTOOLSDIR_DEFAULT=C:\Rtools
SET WIX_DEFAULT=C:\Program Files (x86)\WiX Toolset v3.11
SET MSVCDIR_DEFAULT=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community

rem ---------------------- Setting up environmet -------------------------------

rem for the rest we will check if the user has overridden any particular values manually
if "%JASP_BASE_DIR%"=="" (
    SET "JASP_BASE_DIR=%JASP_BASE_DIR_DEFAULT%"
    echo Using default JASP_BASE_DIR the folder containing required files and where the wix folder will be built, of:
    echo "%JASP_BASE_DIR_DEFAULT%", to change set the JASP_BASE_DIR environment variable to your install location
) else (
    echo JASP_BASE_DIR: "%JASP_BASE_DIR%"
)

SET JASP_DESKTOP_DEFAULT=%JASP_BASE_DIR%\jasp-desktop
SET JASP_REQUIRED_FILES_DIR_DEFAULT=%JASP_BASE_DIR%\jasp-required-files

if "%QTDIR%"=="" (
    SET "QTDIR=%QTDIR_DEFAULT%"
    echo Using default QTDIR "%QTDIR_DEFAULT%", to change set the QTDIR environment variable to your install location
) else (
    echo QTDIR: "%QTDIR%"
)

if "%QTVER%"=="" (
    SET "QTVER=%QTVER_DEFAULT%"
    echo Using default QTVER "%QTVER_DEFAULT%", to change set the QTVER environment variable to your preferred version
) else (
    echo QTVER: "%QTVER%"
)

if "%RTOOLSDIR%"=="" (
    SET "RTOOLSDIR=%RTOOLSDIR_DEFAULT%"
    echo Using default RTOOLSDIR "%RTOOLSDIR_DEFAULT%", to change set the RTOOLSDIR environment variable to your install location
) else (
    echo RTOOLSDIR: "%RTOOLSDIR%"
)

if "%WIX%"=="" (
    SET "WIX=%WIX_DEFAULT%"
    echo Using default WIX "%WIX_DEFAULT%", to change set the WIX environment variable to your install location
) else (
    echo WIX: "%WIX%"
)

if "%MSVCDIR%"=="" (
    SET "MSVCDIR=%MSVCDIR_DEFAULT%"
    echo Using default MSVCDIR "%MSVCDIR_DEFAULT%", to change set the MSVCDIR environment variable to your install location
) else (
    echo MSVCDIR: "%MSVCDIR%"
)

if "%JASP_DESKTOP%"=="" (
    SET "JASP_DESKTOP=%JASP_DESKTOP_DEFAULT%"
    echo Using default JASP_DESKTOP "%JASP_DESKTOP_DEFAULT%", to change set the JASP_DESKTOP environment variable to your folder
) else (
    echo JASP_DESKTOP: "%JASP_DESKTOP%"
)

if "%JASP_REQUIRED_FILES_DIR%"=="" (
    SET "JASP_REQUIRED_FILES_DIR=%JASP_REQUIRED_FILES_DIR_DEFAULT%"
    echo Using default JASP_REQUIRED_FILES_DIR "%JASP_REQUIRED_FILES_DIR_DEFAULT%", to change set the JASP_REQUIRED_FILES_DIR environment variable to your folder
) else (
    echo JASP_REQUIRED_FILES_DIR: "%JASP_REQUIRED_FILES_DIR%"
)

echo checking if script is ran from Tools
cd ..
if not exist Tools (
    echo This script MUST be run from %JASP_DESKTOP%\Tools!
    exit /b 2
)
cd %STARTDIR%

SET JASP_WIX_DIR=jasp-wix-installer-%ARCH%
SET JASP_INSTALL_DIR=jasp-installer-files-%ARCH%
SET JASP_BUILD_DIR=jasp-build-%ARCH%
SET JASP_R_INTERFACE=JASP-R-Interface
SET JOM=%QTDIR%\Tools\QtCreator\bin\jom.exe

SET VCVARS_DIR="%MSVCDIR%\VC\Auxiliary\Build"

if "%ARCH%" == "64" (
SET MINGWDIR=%RTOOLSDIR%\mingw_64\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2019_64\bin
SET WIXARCH="x64"
SET COPY_R_ARCH="x64"
) else (
SET MINGWDIR=%RTOOLSDIR%\mingw_32\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2019\bin
SET WIXARCH="x86"
SET COPY_R_ARCH="i386"
)

echo JASP will be built for %ARCH% bits

echo checking for existence specified directories

if not exist "%JASP_BASE_DIR%" (
    echo The desired JASP_BASE_DIR directory "%JASP_BASE_DIR%" does not exist!
    exit /b 11
)

if not exist "%JASP_DESKTOP%" (
    echo The desired jasp git directory "%JASP_DESKTOP%" does not exist!
    exit /b 11
)

if not exist "%JASP_REQUIRED_FILES_DIR%" (
    echo The desired jasp required files directory "%JASP_REQUIRED_FILES_DIR%" does not exist!
    exit /b 11
)

if not exist "%QTVCDIR%" (
    echo The desired QT binary directory "%QTVCDIR%" does not exist!
    exit /b 11
)

if not exist "%MINGWDIR%" (
    echo The desired Rtools binary directory "%MINGWDIR%" does not exist!
    exit /b 11
)

if not exist "%MSVCDIR%" (
    echo The desired Visual Studio directory "%MSVCDIR%" does not exist!
    exit /b 11
)

if not exist %VCVARS_DIR% (
    echo The desired Visual Studio environment setup CMD location %VCVARS_DIR% does not exist!
    exit /b 11
)

rem Setting up Visual Studio Environment
call %VCVARS_DIR%\vcvars%ARCH%.bat

SET PATH=%MINGWDIR%;%QTVCDIR%;%PATH%

rem you uncomment the following goto to skip building JASP, but it assumes that you did in fact build it previously in the normal location (see BUILDSTYLE argument though)
rem goto skipbuilding
rem goto copyR

if "%BUILDSTYLE%"=="wix" GOTO skipbuilding

rem We are not updating the sources from this script. if we are running from buildbot it will update the sources for us and
rem otherwise we will just use whatever the user currently has on drive.

cd %JASP_BASE_DIR%

if "%BUILDSTYLE%"=="full" (
echo Make sure we have a fresh JASP_WIX_DIR etc
    rmdir /Q /S %JASP_WIX_DIR%
    mkdir %JASP_WIX_DIR%
) else (
    echo Reusing old JASP_WIX_DIR
)

cd %JASP_WIX_DIR%

if "%BUILDSTYLE%"=="full" (
    echo Creating a fresh build dir
    rmdir /Q /S %JASP_BUILD_DIR%
    mkdir %JASP_BUILD_DIR%
) else (
    echo reusing old build dir
)

if "%BUILDSTYLE%"=="full" (
    echo Copy the required files for JASP
    if not exist %JASP_REQUIRED_FILES_DIR%\%ARCH% (
        echo Sadly enough the required binaries-folder "%JASP_REQUIRED_FILES_DIR%\%ARCH%" does not exist!
        exit /b 3
    )
    xcopy %JASP_REQUIRED_FILES_DIR%\%ARCH% %JASP_BUILD_DIR% /S

    echo Make symbolic link to R
    if not exist %JASP_REQUIRED_FILES_DIR%\R (
        echo Sadly enough the required R-folder "%JASP_REQUIRED_FILES_DIR%\R" does not exist!
        exit /b 4
    )
    cd %JASP_BUILD_DIR%
    mklink /D R %JASP_REQUIRED_FILES_DIR%\R
) else (
    echo Keeping the required files as they were.
    cd %JASP_BUILD_DIR%
)

echo Check for the existence of CRYPTKEY in the local environment and set it as a property in qmake if so.
if not "%CRYPTKEY%"=="" (
    %QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY "%CRYPTKEY%"
    echo Using custom cryptkey (%CRYPTKEY%)
)

echo "Making sure QM files are generated"
%QTVCDIR%\qmake -set AM_I_BUILDBOT "I_AM_BUILDBOT" || exit 1

if "%BUILDSTYLE%"=="full" (
    echo Creating directory for JASP-R-Interface "%JASP_R_INTERFACE%"
    mkdir %JASP_R_INTERFACE%
)
cd %JASP_R_INTERFACE%
rem echo %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro
echo Building JASP-R-Interface in %JASP_R_INTERFACE%
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro -spec win32-g++
)
%MINGWDIR%\mingw32-make.exe  -j%CPUS% || exit /B 5

cd ..
echo "Building JASP"
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\JASP.pro -spec win32-msvc
)
%JOM% -j%CPUS%  || exit /B 6

%QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY ""
%QTVCDIR%\qmake -set AM_I_BUILDBOT "" || exit 1

:setup

echo "Preparing the installer"

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%
echo Creating a fresh install dir
rmdir /Q /S %JASP_INSTALL_DIR%
mkdir  %JASP_INSTALL_DIR%

cd %JASP_INSTALL_DIR%

echo copy icon
COPY %JASP_DESKTOP%\JASP-Desktop\icon.ico /Y

echo copy AGPL txt
COPY %JASP_DESKTOP%\COPYING.txt  AGPL.txt /Y

echo copying JASP.exe, JASPEngine.exe, *.R and *.dll from build dir
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASP.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASPEngine.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.R /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.dll /Y

echo Running windeployqt on JASP.exe
%QTVCDIR%\windeployqt.exe --no-compiler-runtime -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP_DESKTOP%\JASP-Desktop JASP.exe

echo copy resources
XCOPY  %JASP_DESKTOP%\Resources /E /I Resources

echo copy help
XCOPY  %JASP_DESKTOP%\Resources\Help /E /I Help

:copyR
set "RLOCATION=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R"
echo running copyR.cmd script as "%JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %RLOCATION% %COPY_R_ARCH%"

call %JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %RLOCATION% %COPY_R_ARCH%

echo copy JAGS to installer preparation folder
XCOPY %JASP_REQUIRED_FILES_DIR%\%ARCH%\JAGS /E /I %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\JAGS

:skipbuilding

echo Making zip-version of installer
powershell Compress-Archive "%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\*" "%JASP_BASE_DIR%\%JASP_WIX_DIR%\JASP.zip"

echo Melting and Coalescing MSI

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%

SET MERGEMODULENAME=Microsoft_VC142_CRT_%WIXARCH%.msm

REM a workaround because for some reason they decided nobody needs VCToolsRedistDir in vs 2019...  https://developercommunity.visualstudio.com/content/problem/544305/vs2019-vctoolsredistdir-environment-variable-incor.html
if "%VCToolsRedistDir%"=="" (
    set VCToolsRedistDir="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.24.28127"
)

COPY "%VCToolsRedistDir%\MergeModules\%MERGEMODULENAME%" /Y
"%WIX%\bin\heat.exe" dir .\%JASP_INSTALL_DIR% -cg JASPFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var var.JASP_INSTALL_DIR -out JASPFilesFragment.wxs || exit /B 7

COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\jasp.wxi /Y
"%WIX%\bin\candle" -arch %WIXARCH% -dJASP_INSTALL_DIR=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%  JASPFilesFragment.wxs  || exit /B 8

COPY %JASP_DESKTOP%\Tools\wix\jasp.wxs /Y
"%WIX%\bin\candle" -dRedistMergeModule=%MERGEMODULENAME% -arch %WIXARCH% -dJASP_DESKTOP_DIR=%JASP_DESKTOP% -ext WixUIExtension -ext WixUtilExtension jasp.wxs || exit /B 9

"%WIX%\bin\light" -sval -dRedistMergeModule=%MERGEMODULENAME% -ext WixUIExtension -ext WixUtilExtension -out JASP.msi JASPFilesFragment.wixobj jasp.wixobj || exit /B 10

cd %STARTDIR%

echo Remove readonly from r library again to avoid errors later on
attrib -r %RLOCATION%\library /d /s

:end
endlocal

@echo off
rem autorun
SETLOCAL EnableDelayedExpansion

rem ---------------------- Check arguments -------------------------------
rem Arguments are: <CPU's to use> <64/32bit> <full/partial build>
SET CPUS=%1

if "%1"=="" (
SET CPUS=%NUMBER_OF_PROCESSORS%
rem setting it to 1 might avoid errors but also makes it take an hour...
rem %NUMBER_OF_PROCESSORS% manually changed to 1... because MSVC because loves to get all tangled up in internal errors when specifying "big" numbers like 8 or 24 :s
)
echo Running autobuild in %CPUS% separate processes!

SET ARCH=%2

if NOT "%2"=="32" (
if NOT "%2"=="64" (
echo "First argument should be architecture i.e 32 or 64 bits"
echo "So e.g. run: 'autobuild 32' if you want to build an x86 version."
echo "But for now the default of 64-bit will be set."
SET ARCH=64
))

SET BUILDSTYLE=%3

if "%3"=="" (
SET BUILDSTYLE=full
)

echo "Building %ARCH% bits JASP"

rem I am assuming we are starting from (SOMEDIR)\jasp-desktop\Tools  and that (SOMEDIR) contains folders like jasp-required-files and stuff like that
rem At least by default
SET STARTDIR=%CD%

rem --- default values ---
SET JASP_BASE_DIR_DEFAULT=%STARTDIR%\..\..
SET QTDIR_DEFAULT=C:\Qt
SET QTVER_DEFAULT=5.12.7
SET RTOOLSDIR_DEFAULT=C:\Rtools
SET WIX_DEFAULT=C:\Program Files (x86)\WiX Toolset v3.11
SET MSVCDIR_DEFAULT=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community

rem ---------------------- Setting up environmet -------------------------------

rem for the rest we will check if the user has overridden any particular values manually
if "%JASP_BASE_DIR%"=="" (
    SET "JASP_BASE_DIR=%JASP_BASE_DIR_DEFAULT%"
    echo Using default JASP_BASE_DIR the folder containing required files and where the wix folder will be built, of:
    echo "%JASP_BASE_DIR_DEFAULT%", to change set the JASP_BASE_DIR environment variable to your install location
) else (
    echo JASP_BASE_DIR: "%JASP_BASE_DIR%"
)

SET JASP_DESKTOP_DEFAULT=%JASP_BASE_DIR%\jasp-desktop
SET JASP_REQUIRED_FILES_DIR_DEFAULT=%JASP_BASE_DIR%\jasp-required-files

if "%QTDIR%"=="" (
    SET "QTDIR=%QTDIR_DEFAULT%"
    echo Using default QTDIR "%QTDIR_DEFAULT%", to change set the QTDIR environment variable to your install location
) else (
    echo QTDIR: "%QTDIR%"
)

if "%QTVER%"=="" (
    SET "QTVER=%QTVER_DEFAULT%"
    echo Using default QTVER "%QTVER_DEFAULT%", to change set the QTVER environment variable to your preferred version
) else (
    echo QTVER: "%QTVER%"
)

if "%RTOOLSDIR%"=="" (
    SET "RTOOLSDIR=%RTOOLSDIR_DEFAULT%"
    echo Using default RTOOLSDIR "%RTOOLSDIR_DEFAULT%", to change set the RTOOLSDIR environment variable to your install location
) else (
    echo RTOOLSDIR: "%RTOOLSDIR%"
)

if "%WIX%"=="" (
    SET "WIX=%WIX_DEFAULT%"
    echo Using default WIX "%WIX_DEFAULT%", to change set the WIX environment variable to your install location
) else (
    echo WIX: "%WIX%"
)

if "%MSVCDIR%"=="" (
    SET "MSVCDIR=%MSVCDIR_DEFAULT%"
    echo Using default MSVCDIR "%MSVCDIR_DEFAULT%", to change set the MSVCDIR environment variable to your install location
) else (
    echo MSVCDIR: "%MSVCDIR%"
)

if "%JASP_DESKTOP%"=="" (
    SET "JASP_DESKTOP=%JASP_DESKTOP_DEFAULT%"
    echo Using default JASP_DESKTOP "%JASP_DESKTOP_DEFAULT%", to change set the JASP_DESKTOP environment variable to your folder
) else (
    echo JASP_DESKTOP: "%JASP_DESKTOP%"
)

if "%JASP_REQUIRED_FILES_DIR%"=="" (
    SET "JASP_REQUIRED_FILES_DIR=%JASP_REQUIRED_FILES_DIR_DEFAULT%"
    echo Using default JASP_REQUIRED_FILES_DIR "%JASP_REQUIRED_FILES_DIR_DEFAULT%", to change set the JASP_REQUIRED_FILES_DIR environment variable to your folder
) else (
    echo JASP_REQUIRED_FILES_DIR: "%JASP_REQUIRED_FILES_DIR%"
)

echo checking if script is ran from Tools
cd ..
if not exist Tools (
    echo This script MUST be run from %JASP_DESKTOP%\Tools!
    exit /b 2
)
cd %STARTDIR%

SET JASP_WIX_DIR=jasp-wix-installer-%ARCH%
SET JASP_INSTALL_DIR=jasp-installer-files-%ARCH%
SET JASP_BUILD_DIR=jasp-build-%ARCH%
SET JASP_R_INTERFACE=JASP-R-Interface
SET JOM=%QTDIR%\Tools\QtCreator\bin\jom.exe

SET VCVARS_DIR="%MSVCDIR%\VC\Auxiliary\Build"

if "%ARCH%" == "64" (
SET MINGWDIR=%RTOOLSDIR%\mingw_64\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017_64\bin
SET WIXARCH="x64"
SET COPY_R_ARCH="x64"
) else (
SET MINGWDIR=%RTOOLSDIR%\mingw_32\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017\bin
SET WIXARCH="x86"
SET COPY_R_ARCH="i386"
)

echo JASP will be built for %ARCH% bits

echo checking for existence specified directories

if not exist "%JASP_BASE_DIR%" (
    echo The desired JASP_BASE_DIR directory "%JASP_BASE_DIR%" does not exist!
    exit /b 11
)

if not exist "%JASP_DESKTOP%" (
    echo The desired jasp git directory "%JASP_DESKTOP%" does not exist!
    exit /b 11
)

if not exist "%JASP_REQUIRED_FILES_DIR%" (
    echo The desired jasp required files directory "%JASP_REQUIRED_FILES_DIR%" does not exist!
    exit /b 11
)

if not exist "%QTVCDIR%" (
    echo The desired QT binary directory "%QTVCDIR%" does not exist!
    exit /b 11
)

if not exist "%MINGWDIR%" (
    echo The desired Rtools binary directory "%MINGWDIR%" does not exist!
    exit /b 11
)

if not exist "%MSVCDIR%" (
    echo The desired Visual Studio directory "%MSVCDIR%" does not exist!
    exit /b 11
)

if not exist %VCVARS_DIR% (
    echo The desired Visual Studio environment setup CMD location %VCVARS_DIR% does not exist!
    exit /b 11
)

rem Setting up Visual Studio Environment
call %VCVARS_DIR%\vcvars%ARCH%.bat

SET PATH=%MINGWDIR%;%QTVCDIR%;%PATH%

rem you uncomment the following goto to skip building JASP, but it assumes that you did in fact build it previously in the normal location (see BUILDSTYLE argument though)
rem goto skipbuilding
rem goto copyR

if "%BUILDSTYLE%"=="wix" GOTO skipbuilding

rem We are not updating the sources from this script. if we are running from buildbot it will update the sources for us and
rem otherwise we will just use whatever the user currently has on drive.

cd %JASP_BASE_DIR%

if "%BUILDSTYLE%"=="full" (
echo Make sure we have a fresh JASP_WIX_DIR etc
    rmdir /Q /S %JASP_WIX_DIR%
    mkdir %JASP_WIX_DIR%
) else (
    echo Reusing old JASP_WIX_DIR
)

cd %JASP_WIX_DIR%

if "%BUILDSTYLE%"=="full" (
    echo Creating a fresh build dir
    rmdir /Q /S %JASP_BUILD_DIR%
    mkdir %JASP_BUILD_DIR%
) else (
    echo reusing old build dir
)

if "%BUILDSTYLE%"=="full" (
    echo Copy the required files for JASP
    if not exist %JASP_REQUIRED_FILES_DIR%\%ARCH% (
        echo Sadly enough the required binaries-folder "%JASP_REQUIRED_FILES_DIR%\%ARCH%" does not exist!
        exit /b 3
    )
    xcopy %JASP_REQUIRED_FILES_DIR%\%ARCH% %JASP_BUILD_DIR% /S

    echo Make symbolic link to R
    if not exist %JASP_REQUIRED_FILES_DIR%\R (
        echo Sadly enough the required R-folder "%JASP_REQUIRED_FILES_DIR%\R" does not exist!
        exit /b 4
    )
    cd %JASP_BUILD_DIR%
    mklink /D R %JASP_REQUIRED_FILES_DIR%\R
) else (
    echo Keeping the required files as they were.
    cd %JASP_BUILD_DIR%
)

echo Check for the existence of CRYPTKEY in the local environment and set it as a property in qmake if so.
if not "%CRYPTKEY%"=="" (
    %QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY "%CRYPTKEY%"
    echo Using custom cryptkey (%CRYPTKEY%)
)

echo "Making sure QM files are generated"
%QTVCDIR%\qmake -set AM_I_BUILDBOT "I_AM_BUILDBOT" || exit 1

if "%BUILDSTYLE%"=="full" (
    echo Creating directory for JASP-R-Interface "%JASP_R_INTERFACE%"
    mkdir %JASP_R_INTERFACE%
)
cd %JASP_R_INTERFACE%
rem echo %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro
echo Building JASP-R-Interface in %JASP_R_INTERFACE%
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro -spec win32-g++
)
%MINGWDIR%\mingw32-make.exe  -j%CPUS% || exit /B 5

cd ..
echo "Building JASP"
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\JASP.pro -spec win32-msvc
)
%JOM% -j%CPUS%  || exit /B 6

%QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY ""
%QTVCDIR%\qmake -set AM_I_BUILDBOT "" || exit 1

:setup

echo "Preparing the installer"

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%
echo Creating a fresh install dir
rmdir /Q /S %JASP_INSTALL_DIR%
mkdir  %JASP_INSTALL_DIR%

cd %JASP_INSTALL_DIR%

echo copy icon
COPY %JASP_DESKTOP%\JASP-Desktop\icon.ico /Y

echo copy AGPL txt
COPY %JASP_DESKTOP%\COPYING.txt  AGPL.txt /Y

echo copying JASP.exe, JASPEngine.exe, *.R and *.dll from build dir
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASP.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASPEngine.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.R /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.dll /Y

echo Running windeployqt on JASP.exe
%QTVCDIR%\windeployqt.exe --no-compiler-runtime -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP_DESKTOP%\JASP-Desktop JASP.exe

echo copy resources
XCOPY  %JASP_DESKTOP%\Resources /E /I Resources

echo copy help
XCOPY  %JASP_DESKTOP%\Resources\Help /E /I Help

:copyR
set "RLOCATION=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R"
echo running copyR.cmd script as "%JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %RLOCATION% %COPY_R_ARCH%"

call %JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %RLOCATION% %COPY_R_ARCH%

echo copy JAGS to installer preparation folder
XCOPY %JASP_REQUIRED_FILES_DIR%\%ARCH%\JAGS /E /I %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\JAGS

:skipbuilding

echo Making zip-version of installer
powershell Compress-Archive "%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\*" "%JASP_BASE_DIR%\%JASP_WIX_DIR%\JASP.zip"

echo Melting and Coalescing MSI

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%

SET MERGEMODULENAME=Microsoft_VC141_CRT_%WIXARCH%.msm

COPY "%VCToolsRedistDir%\MergeModules\%MERGEMODULENAME%" /Y
"%WIX%\bin\heat.exe" dir .\%JASP_INSTALL_DIR% -cg JASPFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var var.JASP_INSTALL_DIR -out JASPFilesFragment.wxs || exit /B 7

COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\jasp.wxi /Y
"%WIX%\bin\candle" -arch %WIXARCH% -dJASP_INSTALL_DIR=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%  JASPFilesFragment.wxs  || exit /B 8

COPY %JASP_DESKTOP%\Tools\wix\jasp.wxs /Y
"%WIX%\bin\candle" -dRedistMergeModule=%MERGEMODULENAME% -arch %WIXARCH% -dJASP_DESKTOP_DIR=%JASP_DESKTOP% -ext WixUIExtension -ext WixUtilExtension jasp.wxs || exit /B 9

"%WIX%\bin\light" -sval -dRedistMergeModule=%MERGEMODULENAME% -ext WixUIExtension -ext WixUtilExtension -out JASP.msi JASPFilesFragment.wixobj jasp.wixobj || exit /B 10

cd %STARTDIR%

echo Remove readonly from r library again to avoid errors later on
attrib -r %RLOCATION%\library /d /s

:end
endlocal

Revert update to qt 5.15 for windows. Now only mac is on qt 5.15


@echo off

REM VCVARSALL may be in Program Files or Program Files (x86)
REM Use old Windows SDK 6.1 so created .exe will be compatible with
REM old Windows versions.
REM Windows SDK 6.1 may be downloaded at:
REM  http://www.microsoft.com/en-us/download/details.aspx?id=11310
set PATH_OLD=%PATH%
set PATH=C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%
set PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;%PATH%

REM set up the environment to compile to x86
call VCVARS32
if "%ERRORLEVEL%"=="0" (
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /SUBSYSTEM:CONSOLE /out:setuptools/cli-32.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /SUBSYSTEM:WINDOWS /out:setuptools/gui-32.exe
) else (
  echo Windows SDK 6.1 not found to build Windows 32-bit version
)

REM now for 64-bit
call VCVARS64
if "%ERRORLEVEL%"=="0" (
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /SUBSYSTEM:CONSOLE /out:setuptools/cli-64.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /SUBSYSTEM:WINDOWS /out:setuptools/gui-64.exe
) else (
  echo Windows SDK 6.1 not found to build Windows 64-bit version
)

REM Windows RT ARM build requires both freeware
REM "Visual Studio Express 2012 for Windows 8" and
REM "Visual Studio Express 2012 for Windows Desktop" to be installed from
REM http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products
set PATH=%PATH_OLD%
set PATH=C:\Program Files\Microsoft Visual Studio 11.0\VC;%PATH%
set PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC;%PATH%
call VCVARSALL x86_arm >nul 2>&1
if "%ERRORLEVEL%"=="0" (
  echo Building Windows RT Version ...
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE launcher.c /O2 /link /MACHINE:ARM /SUBSYSTEM:CONSOLE /out:setuptools/cli-arm-32.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE launcher.c /O2 /link /MACHINE:ARM /SUBSYSTEM:WINDOWS /out:setuptools/gui-arm-32.exe
) else (
  echo Visual Studio ^(Express^) 2012 not found to build Windows RT Version
)

set PATH=%PATH_OLD%

@echo off

REM Use old Windows SDK 6.1 so created .exe will be compatible with
REM old Windows versions.
REM Windows SDK 6.1 may be downloaded at:
REM  http://www.microsoft.com/en-us/download/details.aspx?id=11310
set PATH_OLD=%PATH%

REM The SDK creates a false install of Visual Studio at one of these locations
set PATH=C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%
set PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;%PATH%

REM set up the environment to compile to x86
call VCVARS32
if "%ERRORLEVEL%"=="0" (
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /SUBSYSTEM:CONSOLE /out:setuptools/cli-32.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /SUBSYSTEM:WINDOWS /out:setuptools/gui-32.exe
) else (
  echo Windows SDK 6.1 not found to build Windows 32-bit version
)

REM now for 64-bit
call VCVARS64
if "%ERRORLEVEL%"=="0" (
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /SUBSYSTEM:CONSOLE /out:setuptools/cli-64.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /SUBSYSTEM:WINDOWS /out:setuptools/gui-64.exe
) else (
  echo Windows SDK 6.1 not found to build Windows 64-bit version
)

REM Windows RT ARM build requires both freeware
REM "Visual Studio Express 2012 for Windows 8" and
REM "Visual Studio Express 2012 for Windows Desktop" to be installed from
REM http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products
set PATH=%PATH_OLD%
set PATH=C:\Program Files\Microsoft Visual Studio 11.0\VC;%PATH%
set PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC;%PATH%
call VCVARSALL x86_arm >nul 2>&1
if "%ERRORLEVEL%"=="0" (
  echo Building Windows RT Version ...
  cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE launcher.c /O2 /link /MACHINE:ARM /SUBSYSTEM:CONSOLE /out:setuptools/cli-arm-32.exe
  cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE launcher.c /O2 /link /MACHINE:ARM /SUBSYSTEM:WINDOWS /out:setuptools/gui-arm-32.exe
) else (
  echo Visual Studio ^(Express^) 2012 not found to build Windows RT Version
)

set PATH=%PATH_OLD%

Update comment to clarify why 'Visual Studio' is referenced for the SDK.

--HG--
branch : distribute
extra : rebase_source : 1f0b5eeb82b7551c66b15fb4379ec03e61d68344


g++ -std=c++11 -Wall -Werror -Wextra -pedantic -I "C:/Program Files/boost/boost_1_55_0" -I ../include -O3 main.cpp

g++ -std=c++11 -Wall -Werror -Wextra -pedantic -I "C:/Program Files/boost/boost_1_55_0" -I ../tiny_cnn -O3 main.cpp

Fix compile error from build.bat

Fix compile error from build.bat


@echo off

set HOMEPATH=%~dp0home
set HOME=%HOMEPATH%
set USERPROFILE=%HOMEPATH%

set APPDATA=%HOMEPATH%\AppData\Roaming
set LOCALAPPDATA=%HOMEPATH%\AppData\Local

set USERNAME=seapagan
set COMPUTERNAME=development
set HOSTNAME=%COMPUTERNAME%
set TMP=%~dp0root\tmp

rem set location of SSL certificates...
set SSL_CERT_FILE=%HOME%\ca-bundle.crt

rem update the fstab to point to the correct drive, as it may have changed...
echo %~dp0mingw32 /mingw > %~dp0root\etc\fstab
echo %~dp0local /usr/local >> %~dp0root\etc\fstab
echo %~dp0home /home >> %~dp0root\etc\fstab

cd %HOME%

start %~dp0support\console

@echo off

set HOMEPATH=%~dp0home
set HOME=%HOMEPATH%
set USERPROFILE=%HOMEPATH%

set APPDATA=%HOMEPATH%\AppData\Roaming
set LOCALAPPDATA=%HOMEPATH%\AppData\Local

set USERNAME=seapagan
set COMPUTERNAME=development
set HOSTNAME=%COMPUTERNAME%
set TMP=%~dp0msys\tmp

rem set location of SSL certificates...
set SSL_CERT_FILE=%HOME%\ca-bundle.crt

rem update the fstab to point to the correct drive, as it may have changed...
echo %~dp0mingw32 /mingw > %~dp0msys\etc\fstab
echo %~dp0local /usr/local >> %~dp0msys\etc\fstab
echo %~dp0home /home >> %~dp0msys\etc\fstab

cd %HOME%

start %~dp0support\console

Update dev.cmd

Update dev.cmd

Changed some old paths from a previous setup to the new naming
convention


::
:: Microsoft Azure SDK for Net - Generate library code
:: Copyright (C) Microsoft Corporation. All Rights Reserved.
::

@echo off
setlocal

:: help requested?
set pot_help=%1%2
if "%pot_help%"==""            (set req_help=T)
if "%2"=="help"                (set req_help=T)
if "%2"=="-help"               (set req_help=T)
if "%2"=="--help"              (set req_help=T)
if "%2"=="/help"               (set req_help=T)
if "%pot_help%"=="help"        (set req_help=T)
if "%pot_help%"=="-help"       (set req_help=T)
if "%pot_help%"=="--help"      (set req_help=T)
if "%pot_help%"=="/help"       (set req_help=T)
if not x%pot_help%==x%pot_help:?=% (set req_help=T)
if not "%req_help%" == "" (
    echo.
    echo Usage: generate.cmd
    echo             ^<service, e.g. 'network/resource-manager'^>
    echo             ^<AutoRest version, defaults to 'latest'^>
    echo             ^<GitHub user of specs repo, defaults to 'Azure'^>
    echo             ^<Branch or commit ID of specs repo, defaults to 'current'^>
    echo             ^<actual name of specs repo, defaults to 'azure-rest-api-specs'^>
    echo.
    echo Example: generate.cmd monitor/data-plane 1.2.2 olydis new-cool-feature azure-rest-api-specs-pr
    echo Note: If you are calling an SDK's generate.cmd, the first parameter is already provided for you.
    echo.
    echo To display this help, run either of
    echo      generate.cmd help
    echo      generate.cmd -help
    echo      generate.cmd --help
    echo      generate.cmd /help
    echo      generate.cmd ?
    echo      generate.cmd -?
    echo      generate.cmd --?
    echo      generate.cmd /?
    exit /B
)

:: repo information
set rp="%1"
if not "%2" == "" (set version="%2")         else (set version="latest")
if not "%3" == "" (set specsRepoUser="%3")   else (set specsRepoUser="Azure")
if not "%4" == "" (set specsRepoBranch="%4") else (set specsRepoBranch="current")
if not "%5" == "" (set specsRepoName="%5")   else (set specsRepoName="azure-rest-api-specs")
if not "%6" == "" (set sdksFolder="%6")      else (set sdksFolder=%~dp0..\src\SDKS)
set configFile="https://github.com/%specsRepoUser%/%specsRepoName%/blob/%specsRepoBranch%/specification/%rp%/readme.md"

:: installation
if "%7" == "" (call npm i -g autorest)

:: code generation
@echo on
call autorest %configFile% --csharp --csharp-sdks-folder=%sdksFolder% --version=%version%
@echo off

:: metadata
mkdir %~dp0\..\src\SDKs\_metadata >nul 2>&1
call powershell %~dp0\generateMetadata.ps1 %specsRepoUser% %specsRepoBranch% %version% %configFile% > %~dp0\..\src\SDKs\_metadata\%rp:/=_%.txt

endlocal

::
:: Microsoft Azure SDK for Net - Generate library code
:: Copyright (C) Microsoft Corporation. All Rights Reserved.
::

@echo off
setlocal

:: help requested?
set pot_help=%1%2
if "%pot_help%"==""            (set req_help=T)
if "%2"=="help"                (set req_help=T)
if "%2"=="-help"               (set req_help=T)
if "%2"=="--help"              (set req_help=T)
if "%2"=="/help"               (set req_help=T)
if "%pot_help%"=="help"        (set req_help=T)
if "%pot_help%"=="-help"       (set req_help=T)
if "%pot_help%"=="--help"      (set req_help=T)
if "%pot_help%"=="/help"       (set req_help=T)
if not x%pot_help%==x%pot_help:?=% (set req_help=T)
if not "%req_help%" == "" (
    echo.
    echo Usage: generate.cmd
    echo             ^<service, e.g. 'network/resource-manager'^>
    echo             ^<AutoRest version, defaults to 'latest'^>
    echo             ^<GitHub user of specs repo, defaults to 'Azure'^>
    echo             ^<Branch or commit ID of specs repo, defaults to 'current'^>
    echo             ^<actual name of specs repo, defaults to 'azure-rest-api-specs'^>
    echo.
    echo Example: generate.cmd monitor/data-plane 1.2.2 olydis new-cool-feature azure-rest-api-specs-pr
    echo Note: If you are calling an SDK's generate.cmd, the first parameter is already provided for you.
    echo.
    echo To display this help, run either of
    echo      generate.cmd help
    echo      generate.cmd -help
    echo      generate.cmd --help
    echo      generate.cmd /help
    echo      generate.cmd ?
    echo      generate.cmd -?
    echo      generate.cmd --?
    echo      generate.cmd /?
    exit /B
)

:: repo information
set rp="%1"
if not "%2" == "" (set version="%2")         else (set version="latest")
if not "%3" == "" (set specsRepoUser="%3")   else (set specsRepoUser="Azure")
if not "%4" == "" (set specsRepoBranch="%4") else (set specsRepoBranch="current")
if not "%5" == "" (set specsRepoName="%5")   else (set specsRepoName="azure-rest-api-specs")
if not "%6" == "" (set sdksFolder="%6")      else (set sdksFolder=%~dp0..\src\SDKS)
set configFile="https://github.com/%specsRepoUser%/%specsRepoName%/blob/%specsRepoBranch%/specification/%rp%/readme.md"

:: installation
if "%7" == "" (call npm i -g autorest)

:: code generation
@echo on
call autorest %configFile% --csharp --csharp-sdks-folder=%sdksFolder% --version=%version% --reflect-api-versions
@echo off

:: metadata
mkdir %~dp0\..\src\SDKs\_metadata >nul 2>&1
call powershell %~dp0\generateMetadata.ps1 %specsRepoUser% %specsRepoBranch% %version% %configFile% > %~dp0\..\src\SDKs\_metadata\%rp:/=_%.txt

endlocal

Update generate.cmd

Update generate.cmd

Enabling api version generation


@echo off
echo ĿļöӦ nested expanded compact compressed
echo You can edit this file to adapt your project. ( nested expanded compact compressed )
echo -------------------------------------------------------------------------------------
sass --style compressed --watch style.scss:style.css

@echo off

echo You can edit this file to adapt your project. ( nested expanded compact compressed )

sass --style compressed --watch style.scss:style.css

修正 bat

修正 bat


@echo off

bike relative_path_test.bk

echo ****************
md c:\lib_for_bike
@set BIKE_LIBS=c:\lib_for_bike
bike addon_library_path_test.bk
rmdir c:\lib_for_bike

echo ****************
bike home_installation_path_test.bk

pause
@echo on

@echo off

bike relative_path_test.bk

echo ****************
bike home_installation_path_test.bk

pause
@echo on

Test change run_me.bat

Test change run_me.bat


:: Backup
robocopy /E /S "C:\Users\%username%\Dropbox\SublimeText3" "C:\Users\%username%\Desktop"

:: Move Sublime text Setting.
move "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Installed Packages" "C:\Users\%username\Dropbox\"
move "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Packages" "C:\Users\%username\Dropbox\"

::Make Symbol Link
mklink /d "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Installed Packages" "C:\Users\%username%\Dropbox\SublimeText3\Installed Packages"
mklink /d "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Packages" "C:\Users\%username%\Dropbox\SublimeText3\Packages"

Update sublime_setting_dropbox.bat

Update sublime_setting_dropbox.bat

バックアップ機能を追加


@echo off
setlocal
set MAIN_CLASS=com.thaiopensource.relaxng.util.Driver
set JAR_FILE=jing.jar
set JRE_KEY=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment
if not exist "%JAVA_HOME%\bin\java.exe" (
  for /f "tokens=2*" %%u in ('reg query "%JRE_KEY%" /v CurrentVersion') do for /f "tokens=2*" %%i in ('reg query "%JRE_KEY%\%%v" /v JavaHome') do set JAVA_HOME=%%j
) 2>nul
if exist "%JAVA_HOME%\bin\java.exe" goto found_java
echo Could not find a Java Runtime Environment. Download one from <http://java.sun.com/javase/downloads/>.
exit /b 1
:found_java
set JAR_DIR=%~dp0
if exist "%JAR_DIR%%JAR_FILE%" goto found_jar
echo Could not find %JAR_FILE%. Must be in the same directory as %~nx0 (%JAR_DIR%).
exit /b 1
:found_jar
"%JAVA_HOME%\bin\java.exe" -classpath "%JAR_DIR%%JAR_FILE%" %MAIN_CLASS% %*

@echo off
setlocal
set MAIN_CLASS=com.thaiopensource.relaxng.util.Driver
set JAR_FILE=jing.jar
set JAVA_PROBLEM_EXIT_CODE=1
set JRE_KEY=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment
set JAVA_VERSION=unknown
if not exist "%JAVA_HOME%\bin\java.exe" (
  for /f "tokens=2* skip=2" %%u in ('reg query "%JRE_KEY%" /v CurrentVersion') do for /f "tokens=2* skip=2" %%i in ('reg query "%JRE_KEY%\%%v" /v JavaHome') do (
    set JAVA_VERSION=%%v
    set JAVA_HOME=%%j
  )
) 2>nul
if exist "%JAVA_HOME%\bin\java.exe" goto found_java
echo Could not find a Java Runtime Environment. Download one from http://java.sun.com/javase/downloads/.
exit /b %JAVA_PROBLEM_EXIT_CODE%
:found_java
if not x1.4==x%JAVA_VERSION% if not x1.3==x%JAVA_VERSION% goto java_version_ok
echo Version 5.0 or newer of the Java Runtime Environment is required. Download one from http://java.sun.com/javase/downloads/.
exit /b %JAVA_PROBLEM_EXIT_CODE%
:java_version_ok
set JAR_DIR=%~dp0
if exist "%JAR_DIR%%JAR_FILE%" goto found_jar
echo Could not find %JAR_FILE%. Must be in the same directory as %~nx0 (%JAR_DIR%).
exit /b %JAVA_PROBLEM_EXIT_CODE%
:found_jar
"%JAVA_HOME%\bin\java.exe" -classpath "%JAR_DIR%%JAR_FILE%" %MAIN_CLASS% %*

Check for appropriate java version in jing.bat


SET ANTLR=java -jar C:\Javalib\antlr-4.7-complete.jar
SET CURR_DIR=%cd%
SET GRAMMAR_IFC=%CURR_DIR%/Express.g4
SET GRAMMAR_STEP=%CURR_DIR%/STEP.g4
SET SCHEMA=%CURR_DIR%/IFC4.exp

::csharp:
	%ANTLR% -Dlanguage=CSharp -package Express -o ./src/antlr %GRAMMAR_IFC%
	%ANTLR% -Dlanguage=CSharp -package STEP -o ./lang/csharp/src/antlr %GRAMMAR_STEP%
	dotnet build .\src\IFC-gen.csproj
	dotnet run -p .\src\IFC-gen.csproj %SCHEMA% ./lang/csharp/src

::clean:
	rmdir /s /q .\lang\csharp\src\antlr
	rmdir /s /q .\src\antlr
	rmdir /s /q .\src\bin
	rmdir /s /q .\src\obj

SET ANTLR=java -jar C:\Javalib\antlr-4.7-complete.jar
SET CURR_DIR=%cd%
SET GRAMMAR_IFC=%CURR_DIR%\Express.g4
SET GRAMMAR_STEP=%CURR_DIR%\STEP.g4
SET SCHEMA=%CURR_DIR%\IFC4.exp

::csharp:
	%ANTLR% -Dlanguage=CSharp -package Express -o %CURR_DIR%\src\antlr %GRAMMAR_IFC%
	%ANTLR% -Dlanguage=CSharp -package STEP -o %CURR_DIR%\lang\csharp\src\antlr %GRAMMAR_STEP%
	dotnet build .\src\IFC-gen.csproj
	dotnet run -p .\src\IFC-gen.csproj %SCHEMA% .\lang\csharp\src

::clean:
	::rmdir /s /q .\lang\csharp\src\antlr
	rmdir /s /q .\src\antlr
	rmdir /s /q .\src\bin
	rmdir /s /q .\src\obj

Edit make.bat

Edit make.bat


REM Automatically generated from Makefile
.\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -c -o main.o main.c
.\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -o main.gb main.o

Add generated windows make script

Add generated windows make script


set target=%1
IF "%target%"=="" set target=all

IF "%target%"=="all" GOTO BUILD
IF "%target%"=="package" GOTO BUILD
IF "%target%"=="test" GOTO BUILD
GOTO EXIT

:BUILD
mkdir bin
copy src\*.* bin
copy src\chat\* bin
copy src\irc\* bin
copy src\net\* bin
copy src\script\* bin
copy src\script\prepackaged\source_array.coffee bin
copy third_party\*.js bin
mkdir bin\font
copy static\font\*.* bin\font
call coffee -c bin
del bin\*.coffee
IF "%target%"=="package" GOTO PACKAGE

:TEST
mkdir bin\mocks
copy test\*.* bin
copy test\mocks\*.* bin
mkdir bin\jasmine-1.2.0
xcopy /E third_party\jasmine-1.2.0 bin\jasmine-1.2.0
call coffee -c bin
del bin\*.coffee
IF "%target%"=="test" GOTO EXIT

:PACKAGE
rmdir package /s /q
mkdir package
mkdir package\bin
xcopy /E bin package\bin
mkdir package\static
mkdir package\static\icon
copy static\icon\*.png package\static\icon
copy manifest.json package

:EXIT

@ECHO OFF
set target=%1
IF "%target%"=="" set target=all

for /f %%j in ("node.exe") do (
  set NODE_HOME=%%~dp$PATH:j
)
for /f %%j in ("coffee.cmd") do (
  set COFFEE_HOME=%%~dp$PATH:j
)
if "%NODE_HOME%"=="" GOTO NONODE
if "%COFFEE_HOME%"=="" GOTO NOCOFFEE

IF "%target%"=="all" GOTO BUILD
IF "%target%"=="package" GOTO BUILD
IF "%target%"=="test" GOTO BUILD
GOTO :EOF

:NONODE
echo "Missing node.exe, please download and install NodeJS from http://nodejs.org/"
GOTO :EOF

:NOCOFFEE
echo "Missing coffee, please run: npm install -g coffee-script"
GOTO :EOF

:BUILD
echo "Building CIRC."
rmdir bin /s /q
mkdir bin
copy src\*.* bin
copy src\chat\* bin
copy src\irc\* bin
copy src\net\* bin
copy src\script\* bin
copy src\script\prepackaged\source_array.coffee bin
copy third_party\*.js bin
mkdir bin\font
copy static\font\*.* bin\font
call coffee -c bin
IF %ERRORLEVEL% GEQ 1 GOTO :EOF
del bin\*.coffee
IF "%target%"=="package" GOTO PACKAGE

:TEST
echo "Creating tests, run test.bat or open bin\test_runner.html in your browser."
mkdir bin\mocks
copy test\*.* bin
copy test\mocks\*.* bin
mkdir bin\jasmine-1.2.0
xcopy /E /Y third_party\jasmine-1.2.0 bin\jasmine-1.2.0
call coffee -c bin
IF %ERRORLEVEL% GEQ 1 GOTO :EOF
del bin\*.coffee
IF "%target%"=="test" start bin\test_runner.html
IF "%target%"=="test" GOTO :EOF

:PACKAGE
echo "Creating packaged app in directory 'package'."
rmdir package /s /q
mkdir package
mkdir package\bin
xcopy /E /Y bin package\bin
mkdir package\static
mkdir package\static\icon
copy static\icon\*.png package\static\icon
copy manifest.json package

Check for missing NodeJS and CoffeeScript installations and auto-run tests from make.bat.


:: This script is used to
:: 1. setup python .venv with requirements installed
:: 2. run all development tasks within that .venv
@echo off
setlocal
chcp 65001 >nul
pushd %~dp0

if /i "%1" == "init" goto INIT
if /i "%1" == "docs" goto DOCS
if /i "%1" == "deploy-docs" goto DEPLOY-DOCS
if /i "%1" == "serve" goto SERVE
if /i "%1" == "lint" goto LINT
if /i "%1" == "release" goto RELEASE
if /i "%1" == "branch" goto BRANCH
goto :usage

:INIT
    if not exist .venv python -m venv .venv
    call :venv
    call python -m pip install --upgrade pip
    call pip install --upgrade -r docs\requirements.txt
    call pip install --upgrade -r tests\requirements.txt
    goto :eof

:DOCS
    call :venv
    mkdocs build
    goto :eof

:DEPLOY-DOCS
    call :venv
    mkdocs gh-deploy
    goto :eof

:SERVE
    call :venv
    call explorer http://localhost:8000
    mkdocs serve
    goto :eof

:LINT
    call :venv
    black .
    flake8
    goto :eof

:BRANCH
    if "%2"== "" goto :usage
    git checkout -b %2
    goto :eof

:RELEASE
    if "%2"== "" goto :usage
    if not exist "messages/release-%2.md" (
        echo Missing release-%2.md
        exit /b 1
    )
    git checkout st3176 --autostash && git merge st3-develop --no-ff
    if not errorlevel 0 (
        echo Unable to merge st3-develop into st3176!
        exit /b 1
    )
    git checkout master --autostash && git merge st4-develop --no-ff
    if not errorlevel 0 (
        echo Unable to merge st4-develop into master!
        exit /b 1
    )
    echo Hit any key to push branches!
    pause
    call git push origin st3176
    if not errorlevel 0 (
        echo Failed to push st3176!
        exit /b 1
    )
    call git push origin master
    if not errorlevel 0 (
        echo Failed to push master!
        exit /b 1
    )
    echo Hit any key to publish release!
    pause
    : create release for ST3
    gh release create --target st3176 -t "MarkdownEditing %2 (ST3176+)" -F "messages/release-%2.md" "3176-%2"
    : create release for ST3
    gh release create --target master -t "MarkdownEditing %2 (ST4107+)" -F "messages/release-%2.md" "4107-%2"
    git fetch
    goto :eof

:VENV
    call .venv\scripts\activate.bat
    if "%VIRTUAL_ENV%" neq ".venv" exit /b 1
    goto :eof

:USAGE
    echo USAGE:
    echo.
    echo   make ^[init^|docs^|gh-pages^|serve^|lint^|branch^|release^]
    echo.
    echo   init          -- setup .venv and install requirements.
    echo   docs          -- build documentation
    echo   deploy-docs   -- build documentation and publish on Github Pages
    echo   serve         -- build documentation and serve via development server
    echo   lint          -- run black, flake8 and pytest
    echo   branch 3.0.0  -- prepare version branch
    echo   release 3.0.0 -- make a release
    goto :eof

:: This script is used to
:: 1. setup python .venv with requirements installed
:: 2. run all development tasks within that .venv
@echo off
setlocal
chcp 65001 >nul
pushd %~dp0

if /i "%1" == "init" goto INIT
if /i "%1" == "docs" goto DOCS
if /i "%1" == "deploy-docs" goto DEPLOY-DOCS
if /i "%1" == "serve" goto SERVE
if /i "%1" == "lint" goto LINT
if /i "%1" == "release" goto RELEASE
if /i "%1" == "branch" goto BRANCH
goto :usage

:INIT
    if not exist .venv python -m venv .venv
    call :venv
    call python -m pip install --upgrade pip
    call pip install --upgrade -r docs\requirements.txt
    call pip install --upgrade -r tests\requirements.txt
    goto :eof

:DOCS
    call :venv
    mkdocs build
    goto :eof

:DEPLOY-DOCS
    call :venv
    mkdocs gh-deploy
    goto :eof

:SERVE
    call :venv
    call explorer http://localhost:8000
    mkdocs serve
    goto :eof

:LINT
    call :venv
    black .
    flake8
    goto :eof

:BRANCH
    if "%2"== "" goto :usage
    git checkout -b %2
    goto :eof

:RELEASE
    if "%2"== "" goto :usage
    set st3_changelog=release-st3-%2.md
    set st4_changelog=release-st4-%2.md

    if not exist "messages/%st3_changelog%" (
        echo Missing %st3_changelog%
        exit /b 1
    )
    if not exist "messages/%st4_changelog%" (
        echo Missing %st4_changelog%
        exit /b 1
    )
    git checkout st3176 && git merge st3-develop --no-ff
    if not errorlevel 0 (
        echo Unable to merge st3-develop into st3176!
        exit /b 1
    )
    git checkout master && git merge st4-develop --no-ff
    if not errorlevel 0 (
        echo Unable to merge st4-develop into master!
        exit /b 1
    )
    echo Hit any key to push branches!
    pause
    call git push origin st3176
    if not errorlevel 0 (
        echo Failed to push st3176!
        exit /b 1
    )
    call git push origin master
    if not errorlevel 0 (
        echo Failed to push master!
        exit /b 1
    )
    echo Hit any key to publish release!
    pause
    : create release for ST3
    gh release create --target st3176 -t "MarkdownEditing %2 (ST3176+)" -F "messages/%st3_changelog%" "3176-%2"
    : create release for ST3
    gh release create --target master -t "MarkdownEditing %2 (ST4107+)" -F "messages/%st4_changelog%" "4107-%2"
    git fetch
    goto :eof

:VENV
    call .venv\scripts\activate.bat
    if "%VIRTUAL_ENV%" neq ".venv" exit /b 1
    goto :eof

:USAGE
    echo USAGE:
    echo.
    echo   make ^[init^|docs^|gh-pages^|serve^|lint^|branch^|release^]
    echo.
    echo   init          -- setup .venv and install requirements.
    echo   docs          -- build documentation
    echo   deploy-docs   -- build documentation and publish on Github Pages
    echo   serve         -- build documentation and serve via development server
    echo   lint          -- run black, flake8 and pytest
    echo   branch 3.0.0  -- prepare version branch
    echo   release 3.0.0 -- make a release
    goto :eof

Fix release script

Fix release script


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

@set BASE_DIR=%HOME%\.spf13-vim-3
call git clone --recursive -b 3.0 git://github.com/spf13/spf13-vim.git "%BASE_DIR%"
call mkdir "%BASE_DIR%\.vim\bundle"
call mklink /J "%HOME%\.vim" "%BASE_DIR%\.vim"
call mklink "%HOME%\.vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\_vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\.vimrc.bundles" "%BASE_DIR%\.vimrc.bundles"

call git clone http://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
call vim -u "%BASE_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall

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

@set BASE_DIR=%HOME%\.spf13-vim-3
IF NOT EXIST "%BASE_DIR%" (
  call git clone --recursive -b 3.0 https://github.com/spf13/spf13-vim.git "%BASE_DIR%"
) ELSE (
	@set ORIGINAL_DIR=%CD%
    echo updating spf13-vim
    chdir /d "%BASE_DIR%"
	call git pull
    chdir /d "%ORIGINAL_DIR%"
	call cd "%BASE_DIR%"
)

call mklink "%HOME%\.vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\_vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\.vimrc.fork" "%BASE_DIR%\.vimrc.fork"
call mklink "%HOME%\.vimrc.bundles" "%BASE_DIR%\.vimrc.bundles"
call mklink "%HOME%\.vimrc.bundles.fork" "%BASE_DIR%\.vimrc.bundles.fork"
call mklink /J "%HOME%\.vim" "%BASE_DIR%\.vim"

IF NOT EXIST "%BASE_DIR%\.vim\bundle" (
	call mkdir "%BASE_DIR%\.vim\bundle"
)

IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
	call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
)

call vim -u "%BASE_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall

Make Windows Installer more robust & auto updating


@echo off

echo Compiling...
cd windeployqt
qmake windeployqt.pro
IF ERRORLEVEL ==1 GOTO :ERROR
mingw32-make.exe release
IF ERRORLEVEL ==1 GOTO :ERROR
cd ..

qmake presi-aoke.pro
IF ERRORLEVEL ==1 GOTO :ERROR
mingw32-make.exe release
IF ERRORLEVEL ==1 GOTO :ERROR

echo Copying files to staging
del /Q /S .\staging
mkdir .\staging
copy .\release\presi-aoke.exe .\staging

echo Copying qt libraries to staging
.\windeployqt\release\windeployqt.exe .\staging\presi-aoke.exe -no-translations -no-webkit2 -opengl

echo Creating installer

if exist "C:\Program Files (x86)\NSIS\makensis.exe" (set nsis="C:\Program Files (x86)\NSIS\makensis.exe") else (set nsis="C:\Program Files\NSIS\makensis.exe")
%nsis% presi-aoke.nsi
IF ERRORLEVEL ==1 GOTO :ERROR

echo Build complete
EXIT /B 0

:ERROR
ECHO Build failed.
EXIT /B 1

@echo off

echo Compiling...
cd windeployqt
qmake windeployqt.pro
IF ERRORLEVEL ==1 GOTO :ERROR
mingw32-make.exe release
IF ERRORLEVEL ==1 GOTO :ERROR
cd ..

qmake presi-aoke.pro
IF ERRORLEVEL ==1 GOTO :ERROR
mingw32-make.exe release
IF ERRORLEVEL ==1 GOTO :ERROR

echo Copying files to staging
del /Q /S .\staging
mkdir .\staging
copy .\release\presi-aoke.exe .\staging

echo Copying qt libraries to staging
.\windeployqt\release\windeployqt.exe .\staging\presi-aoke.exe -no-translations -no-webkit -no-webkit2 -no-opengl -no-svg
rem Trim a bunch of plugins that we don't use
del /Q /S .\staging\iconengines
erase .\staging\imageformats\qdds*.dll .\staging\imageformats\qicns*.dll .\staging\imageformats\qico*.dll .\staging\imageformats\qjp2*.dll .\staging\imageformats\qmng*.dll .\staging\imageformats\qsvg*.dll .\staging\imageformats\qtga*.dll .\staging\imageformats\qtiff*.dll .\staging\imageformats\qweb*.dll
erase .\staging\imageformats\qgifd.dll .\staging\imageformats\qjpegd.dll .\staging\imageformats\qwbmpd.dll

echo Creating installer

if exist "C:\Program Files (x86)\NSIS\makensis.exe" (set nsis="C:\Program Files (x86)\NSIS\makensis.exe") else (set nsis="C:\Program Files\NSIS\makensis.exe")
%nsis% presi-aoke.nsi
IF ERRORLEVEL ==1 GOTO :ERROR

echo Build complete
EXIT /B 0

:ERROR
ECHO Build failed.
EXIT /B 1

Trim down the Windows installer size

Trim down the Windows installer size


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

@rem make sure msys binaries are preferred over cygwin binaries
@rem set path to python 2.7
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests
if defined KOKORO_GITHUB_PULL_REQUEST_NUMBER if defined RUN_TESTS_FLAGS (
  set RUN_TESTS_FLAGS=%RUN_TESTS_FLAGS% --filter_pr_tests --base_branch origin/%KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH%
)

@rem Update DNS settings to:
@rem 1. allow resolving metadata.google.internal hostname
@rem 2. make fetching default GCE credential by oauth2client work
netsh interface ip set dns "Local Area Connection 8" static 169.254.169.254 primary
netsh interface ip add dnsservers "Local Area Connection 8" 8.8.8.8 index=2
netsh interface ip add dnsservers "Local Area Connection 8" 8.8.4.4 index=3

@rem Needed for big_query_utils
python -m pip install google-api-python-client

@rem C# prerequisites: Install dotnet SDK
powershell -File src\csharp\install_dotnet_sdk.ps1
set PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%

@rem Disable some unwanted dotnet options
set NUGET_XMLDOC_MODE=skip
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
set DOTNET_CLI_TELEMETRY_OPTOUT=true

git submodule update --init

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

@rem make sure msys binaries are preferred over cygwin binaries
@rem set path to python 2.7
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests
if defined KOKORO_GITHUB_PULL_REQUEST_NUMBER if defined RUN_TESTS_FLAGS (
  set RUN_TESTS_FLAGS=%RUN_TESTS_FLAGS% --filter_pr_tests --base_branch origin/%KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH%
)

@rem Update DNS settings to:
@rem 1. allow resolving metadata.google.internal hostname
@rem 2. make fetching default GCE credential by oauth2client work
netsh interface ip set dns "Local Area Connection 8" static 169.254.169.254 primary
netsh interface ip add dnsservers "Local Area Connection 8" 8.8.8.8 index=2
netsh interface ip add dnsservers "Local Area Connection 8" 8.8.4.4 index=3

@rem Needed for big_query_utils
python -m pip install google-api-python-client

@rem C# prerequisites: Install dotnet SDK
powershell -File src\csharp\install_dotnet_sdk.ps1
set PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%

@rem Newest version of Go is required to be able to build boringssl with cmake
@rem TODO(jtattermusch): try to eliminate the dependency on Go
choco install golang -y --version 1.13.1 --limit-output

@rem Disable some unwanted dotnet options
set NUGET_XMLDOC_MODE=skip
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
set DOTNET_CLI_TELEMETRY_OPTOUT=true

git submodule update --init

install Go 1.13 on windows

install Go 1.13 on windows


@echo off
REM Need delayed expansion !PATH! so parens in the path don't mess up the parens for the if statements that use parens for blocks
setlocal enabledelayedexpansion

REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables
set $target=%1
set $sdkVersion=%2
set $runtimeVersion=%3
set $aspRuntimeVersion=%4
set $queue=%5
set $arch=%6
set $quarantined=%7
set $ef=%8
set $aspnetruntime=%9
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
shift
set $aspnetref=%9
shift
set $helixTimeout=%9
shift
set $feedCred=%9

set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
set DOTNET_ROOT=%DOTNET_HOME%\%$arch%
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_MULTILEVEL_LOOKUP=0
set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home

set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin
echo Set path to: %PATH%

powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$sdkVersion% %$arch% '' $true"
IF [%$feedCred%] == [] (
    powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$runtimeVersion% %$arch% dotnet $true"
) else (
    powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$runtimeVersion% %$arch% dotnet $true https://dotnetclimsrc.blob.core.windows.net/dotnet %$feedCred%"
)

set exit_code=0

echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources

echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..."
dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
if errorlevel neq 0 (
    set exit_code=%errorlevel%
)
echo "Finished running tests: exit_code=%exit_code%"
exit /b %exit_code%

@echo off
REM Need delayed expansion !PATH! so parens in the path don't mess up the parens for the if statements that use parens for blocks
setlocal enabledelayedexpansion

REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables
set $target=%1
set $sdkVersion=%2
set $runtimeVersion=%3
set $aspRuntimeVersion=%4
set $queue=%5
set $arch=%6
set $quarantined=%7
set $ef=%8
set $aspnetruntime=%9
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
shift
set $aspnetref=%9
shift
set $helixTimeout=%9
shift
set $feedCred=%9

set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
set DOTNET_ROOT=%DOTNET_HOME%\%$arch%
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_MULTILEVEL_LOOKUP=0
set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home

set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin
echo Set path to: %PATH%

powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$sdkVersion% %$arch% '' $true '' '' $true"
IF [%$feedCred%] == [] (
    powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$runtimeVersion% %$arch% dotnet $true '' '' $true"
) else (
    powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$runtimeVersion% %$arch% dotnet $true https://dotnetclimsrc.blob.core.windows.net/dotnet %$feedCred% $true"
)

set exit_code=0

echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources

echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..."
dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
if errorlevel neq 0 (
    set exit_code=%errorlevel%
)
echo "Finished running tests: exit_code=%exit_code%"
exit /b %exit_code%

Use -nopath

Use -nopath


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

Revert "cleanup windows build script"

Revert "cleanup windows build script"

This reverts commit 68a1949106546fdb4e1d2eb82fb74cbce48c5510.


/*
 * Copyright (c) 2014-2015 Wind River Systems, Inc.
 *
 * 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.
 */

/**
 * @brief Common parts of the linker scripts for the ARCv2/EM targets.
 */

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <sections.h>

#if defined(CONFIG_NSIM)
	EXTERN(_VectorTable)
#endif

#include <linker-defs.h>
#include <linker-tool.h>

/* physical address of RAM */
#ifdef CONFIG_XIP
	#define ROMABLE_REGION FLASH
	#define RAMABLE_REGION SRAM
#else
	#define ROMABLE_REGION SRAM
	#define RAMABLE_REGION SRAM
#endif

#if defined(CONFIG_XIP)
	#define _DATA_IN_ROM __data_rom_start
#else
	#define _DATA_IN_ROM
#endif

MEMORY {
	FLASH (rx) : ORIGIN = FLASH_START, LENGTH = FLASH_SIZE*1k
	SRAM  (wx) : ORIGIN = SRAM_START,  LENGTH = SRAM_SIZE*1k
	DCCM  (wx) : ORIGIN = DCCM_START,  LENGTH = DCCM_SIZE*1k
}

SECTIONS {
	GROUP_START(ROMABLE_REGION)

	SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) {
		_image_rom_start = .;
		_image_text_start = .;

/* when !XIP, .text is in RAM, and vector table must be at its very start */

		KEEP(*(.exc_vector_table))
		KEEP(*(".exc_vector_table.*"))

		KEEP(*(.irq_vector_table))
		KEEP(*(".irq_vector_table.*"))

#ifdef CONFIG_VERSION_HEADER
		*(.version_header)
		KEEP(*(".version_header*"))
#endif
#ifndef CONFIG_SW_ISR_TABLE_DYNAMIC
		KEEP(*(.isr_irq*))

		/*The following sections maps the location of the different rows for
		the _sw_isr_table. Each row maps to an IRQ entry (handler, argument).*/
		/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
		assignable by the user, for that reason the linker sections start
		on IRQ 16*/
		/* sections for IRQ16-19 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1][6-9])))
		/* sections for IRQ20-99 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[2-9][0-9])))
		/* sections for IRQ100-999 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1-9][0-9][0-9])))
#endif

		*(.text)
		*(".text.*")
		*(.gnu.linkonce.t.*)

		_image_text_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE (devconfig, (OPTIONAL),)
	{
		__devconfig_start = .;
		*(".devconfig.*")
		KEEP(*(SORT_BY_NAME(".devconfig*")))
		__devconfig_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE(gpio_compat, (OPTIONAL),)
	{
		__gpio_compat_start = .;
		*(".gpio_compat.*")
		KEEP(*(SORT_BY_NAME(".gpio_compat*")))
		__gpio_compat_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

#ifdef CONFIG_CPLUSPLUS
	SECTION_PROLOGUE(_CTOR_SECTION_NAME,,) {
		/*
		 * The compiler fills the constructor pointers table below, hence
		 * symbol __CTOR_LIST__ must be aligned on 4 byte boundary.
		 * To align with the C++ standard, the first element of the array
		 * contains the number of actual constructors. The last element is
		 * NULL.
		 */
		. = ALIGN(4);
		__CTOR_LIST__ = .;
		LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
		KEEP(*(SORT_BY_NAME(".ctors*")))
		LONG(0)
		__CTOR_END__ = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE(init_array, (OPTIONAL),)
	{
		. = ALIGN(4);
		__init_array_start = .;
		KEEP(*(SORT_BY_NAME(".init_array*")))
		__init_array_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)
#endif

	SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) {
		*(.rodata)
		*(".rodata.*")
		*(.gnu.linkonce.r.*)
	} GROUP_LINK_IN(ROMABLE_REGION)

	_image_rom_end = .;
	__data_rom_start = ALIGN(4);	/* XIP imaged DATA ROM start addr */

	GROUP_END(ROMABLE_REGION)

	GROUP_START(RAMABLE_REGION)

#if defined(CONFIG_XIP)
	SECTION_AT_PROLOGUE(_DATA_SECTION_NAME,,,_DATA_IN_ROM) {
#else
	SECTION_PROLOGUE(_DATA_SECTION_NAME,,) {
#endif

/* when XIP, .text is in ROM, but vector table must be at start of .data */

		_image_ram_start = .;
		__data_ram_start = .;
		*(.data)
		*(".data.*")

#if CONFIG_SW_ISR_TABLE_DYNAMIC
		KEEP(*(.isr_irq*))

		/*The following sections maps the location of the different rows for
		the _sw_isr_table. Each row maps to an IRQ entry (handler, argument).*/
		/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
		assignable by the user, for that reason the linker sections start
		on IRQ 16*/
		/* sections for IRQ16-19 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1][6-9])))
		/* sections for IRQ20-99 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[2-9][0-9])))
		/* sections for IRQ100-999 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1-9][0-9][0-9])))
#endif
	} GROUP_LINK_IN(RAMABLE_REGION)

	SECTION_PROLOGUE(initlevel, (OPTIONAL),)
	{
		DEVICE_INIT_SECTIONS()
	} GROUP_LINK_IN(RAMABLE_REGION)

	__data_ram_end = .;

	SECTION_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) {
		/*
		 * For performance, BSS section is assumed to be 4 byte aligned and
		 * a multiple of 4 bytes
		 */
		. = ALIGN(4);
		__bss_start = .;
		*(.bss)
		*(".bss.*")
		COMMON_SYMBOLS
		/*
		 * BSP clears this memory in words only and doesn't clear any
		 * potential left over bytes.
		 */
		__bss_end = ALIGN(4);
	} GROUP_LINK_IN(RAMABLE_REGION)

	SECTION_PROLOGUE(_NOINIT_SECTION_NAME,(NOLOAD),) {
		/*
		 * This section is used for non-initialized objects that
		 * will not be cleared during the boot process.
		 */
		*(.noinit)
		*(".noinit.*")

	} GROUP_LINK_IN(RAMABLE_REGION)

	/* Define linker symbols */
	_image_ram_end = .;
	_end = .; /* end of image */
	__bss_num_words = (__bss_end - __bss_start) >> 2;

	GROUP_END(RAMABLE_REGION)

	/* Data Closely Coupled Memory (DCCM) */
	GROUP_START(DCCM)
	GROUP_END(DCCM)

	SECTION_PROLOGUE(initlevel_error, (OPTIONAL),)
	{
		DEVICE_INIT_UNDEFINED_SECTION()
	}
	ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")

	}

#ifdef CONFIG_XIP
/*
 * Round up number of words for DATA section to ensure that XIP copies the
 * entire data section. XIP copy is done in words only, so there may be up
 * to 3 extra bytes copied in next section (BSS). At run time, the XIP copy
 * is done first followed by clearing the BSS section.
 */
__data_size = (__data_ram_end - __data_ram_start);
__data_num_words = (__data_size + 3) >> 2;

#endif

/*
 * Copyright (c) 2014-2015 Wind River Systems, Inc.
 *
 * 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.
 */

/**
 * @brief Common parts of the linker scripts for the ARCv2/EM targets.
 */

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <sections.h>

#if defined(CONFIG_NSIM)
	EXTERN(_VectorTable)
#endif

#include <linker-defs.h>
#include <linker-tool.h>

/* physical address of RAM */
#ifdef CONFIG_XIP
	#define ROMABLE_REGION FLASH
	#define RAMABLE_REGION SRAM
#else
	#define ROMABLE_REGION SRAM
	#define RAMABLE_REGION SRAM
#endif

#if defined(CONFIG_XIP)
	#define _DATA_IN_ROM __data_rom_start
#else
	#define _DATA_IN_ROM
#endif

MEMORY {
	FLASH (rx) : ORIGIN = FLASH_START, LENGTH = FLASH_SIZE*1k
	SRAM  (rwx) : ORIGIN = SRAM_START,  LENGTH = SRAM_SIZE*1k
	DCCM  (rw) : ORIGIN = DCCM_START,  LENGTH = DCCM_SIZE*1k
}

SECTIONS {
	GROUP_START(ROMABLE_REGION)

	SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) {
		_image_rom_start = .;
		_image_text_start = .;

/* when !XIP, .text is in RAM, and vector table must be at its very start */

		KEEP(*(.exc_vector_table))
		KEEP(*(".exc_vector_table.*"))

		KEEP(*(.irq_vector_table))
		KEEP(*(".irq_vector_table.*"))

#ifdef CONFIG_VERSION_HEADER
		*(.version_header)
		KEEP(*(".version_header*"))
#endif
#ifndef CONFIG_SW_ISR_TABLE_DYNAMIC
		KEEP(*(.isr_irq*))

		/*The following sections maps the location of the different rows for
		the _sw_isr_table. Each row maps to an IRQ entry (handler, argument).*/
		/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
		assignable by the user, for that reason the linker sections start
		on IRQ 16*/
		/* sections for IRQ16-19 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1][6-9])))
		/* sections for IRQ20-99 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[2-9][0-9])))
		/* sections for IRQ100-999 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1-9][0-9][0-9])))
#endif

		*(.text)
		*(".text.*")
		*(.gnu.linkonce.t.*)

		_image_text_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE (devconfig, (OPTIONAL),)
	{
		__devconfig_start = .;
		*(".devconfig.*")
		KEEP(*(SORT_BY_NAME(".devconfig*")))
		__devconfig_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE(gpio_compat, (OPTIONAL),)
	{
		__gpio_compat_start = .;
		*(".gpio_compat.*")
		KEEP(*(SORT_BY_NAME(".gpio_compat*")))
		__gpio_compat_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

#ifdef CONFIG_CPLUSPLUS
	SECTION_PROLOGUE(_CTOR_SECTION_NAME,,) {
		/*
		 * The compiler fills the constructor pointers table below, hence
		 * symbol __CTOR_LIST__ must be aligned on 4 byte boundary.
		 * To align with the C++ standard, the first element of the array
		 * contains the number of actual constructors. The last element is
		 * NULL.
		 */
		. = ALIGN(4);
		__CTOR_LIST__ = .;
		LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
		KEEP(*(SORT_BY_NAME(".ctors*")))
		LONG(0)
		__CTOR_END__ = .;
	} GROUP_LINK_IN(ROMABLE_REGION)

	SECTION_PROLOGUE(init_array, (OPTIONAL),)
	{
		. = ALIGN(4);
		__init_array_start = .;
		KEEP(*(SORT_BY_NAME(".init_array*")))
		__init_array_end = .;
	} GROUP_LINK_IN(ROMABLE_REGION)
#endif

	SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) {
		*(.rodata)
		*(".rodata.*")
		*(.gnu.linkonce.r.*)
	} GROUP_LINK_IN(ROMABLE_REGION)

	_image_rom_end = .;
	__data_rom_start = ALIGN(4);	/* XIP imaged DATA ROM start addr */

	GROUP_END(ROMABLE_REGION)

	GROUP_START(RAMABLE_REGION)

#if defined(CONFIG_XIP)
	SECTION_AT_PROLOGUE(_DATA_SECTION_NAME,,,_DATA_IN_ROM) {
#else
	SECTION_PROLOGUE(_DATA_SECTION_NAME,,) {
#endif

/* when XIP, .text is in ROM, but vector table must be at start of .data */

		_image_ram_start = .;
		__data_ram_start = .;
		*(.data)
		*(".data.*")

#if CONFIG_SW_ISR_TABLE_DYNAMIC
		KEEP(*(.isr_irq*))

		/*The following sections maps the location of the different rows for
		the _sw_isr_table. Each row maps to an IRQ entry (handler, argument).*/
		/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
		assignable by the user, for that reason the linker sections start
		on IRQ 16*/
		/* sections for IRQ16-19 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1][6-9])))
		/* sections for IRQ20-99 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[2-9][0-9])))
		/* sections for IRQ100-999 */
		KEEP(*(SORT(.gnu.linkonce.isr_irq[1-9][0-9][0-9])))
#endif
	} GROUP_LINK_IN(RAMABLE_REGION)

	SECTION_PROLOGUE(initlevel, (OPTIONAL),)
	{
		DEVICE_INIT_SECTIONS()
	} GROUP_LINK_IN(RAMABLE_REGION)

	__data_ram_end = .;

	SECTION_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) {
		/*
		 * For performance, BSS section is assumed to be 4 byte aligned and
		 * a multiple of 4 bytes
		 */
		. = ALIGN(4);
		__bss_start = .;
		*(.bss)
		*(".bss.*")
		COMMON_SYMBOLS
		/*
		 * BSP clears this memory in words only and doesn't clear any
		 * potential left over bytes.
		 */
		__bss_end = ALIGN(4);
	} GROUP_LINK_IN(RAMABLE_REGION)

	SECTION_PROLOGUE(_NOINIT_SECTION_NAME,(NOLOAD),) {
		/*
		 * This section is used for non-initialized objects that
		 * will not be cleared during the boot process.
		 */
		*(.noinit)
		*(".noinit.*")

	} GROUP_LINK_IN(RAMABLE_REGION)

	/* Define linker symbols */
	_image_ram_end = .;
	_end = .; /* end of image */
	__bss_num_words = (__bss_end - __bss_start) >> 2;

	GROUP_END(RAMABLE_REGION)

	/* Data Closely Coupled Memory (DCCM) */
	GROUP_START(DCCM)
	GROUP_END(DCCM)

	SECTION_PROLOGUE(initlevel_error, (OPTIONAL),)
	{
		DEVICE_INIT_UNDEFINED_SECTION()
	}
	ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")

	}

#ifdef CONFIG_XIP
/*
 * Round up number of words for DATA section to ensure that XIP copies the
 * entire data section. XIP copy is done in words only, so there may be up
 * to 3 extra bytes copied in next section (BSS). At run time, the XIP copy
 * is done first followed by clearing the BSS section.
 */
__data_size = (__data_ram_end - __data_ram_start);
__data_num_words = (__data_size + 3) >> 2;

#endif

fix memory permissions

include/arch/arc: fix memory permissions

Change-Id: Ibb77088a7c9095f4725b6a65bc30a1db4220f254
Signed-off-by: cjordan <c464ed312fa6f818297227c7e5018fc9f4bd95ad@synopsys.com>