Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / msvc / winsetup.bat
1 @ECHO off
2
3 SET CONFIG_H=..\config.h
4 SET CYG_CONFIG_H=..\cygconfig.h
5 SET WIN_CONFIG_H=..\winconfig.h
6 SET CONFIGURE_AC=..\configure.ac
7 SET VERSION_H=..\mono\mini\version.h
8
9
10 ECHO Setting up Mono configuration headers...
11
12 REM Backup existing config.h into cygconfig.h if its not already replaced.
13 %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %CONFIG_H% %CYG_CONFIG_H% 2>&1
14
15 %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% 2>&1
16
17 IF NOT %ERRORLEVEL% == 0 (
18         ECHO copy %WIN_CONFIG_H% %CONFIG_H%
19         copy %WIN_CONFIG_H% %CONFIG_H%
20         %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content %CONFIG_H%) -replace '#MONO_VERSION#', (Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content %CONFIG_H%" 2>&1
21         %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "$mono_version=[int[]](Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value.Split('.'); $corlib_counter=[int](Select-String -path %CONFIGURE_AC% -pattern 'MONO_CORLIB_COUNTER=(.*)').Matches[0].Groups[1].Value; (Get-Content %CONFIG_H%) -replace '#MONO_CORLIB_VERSION#',('1{0:00}{1:00}{2:00}{3:000}' -f $mono_version[0],$mono_version[1],$mono_version[2],$corlib_counter) | Set-Content %CONFIG_H%" 2>&1
22 )
23
24 SET VERSION_CONTENT="#define FULL_VERSION \"Visual Studio built mono\""
25 %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-content.ps1 %VERSION_CONTENT% %VERSION_H%  2>&1
26
27
28 IF NOT %ERRORLEVEL% == 0 (
29         ECHO Configure %VERSION_H%
30         ECHO #define FULL_VERSION "Visual Studio built mono"> %VERSION_H%
31 )
32
33 ECHO Successfully setup Mono configuration headers.
34
35 EXIT /b 0