[WIN32] fixed: git revision in build setup file name.
authorCrystalP <CrystalP@xbmc.org>
Sat, 15 Jan 2011 01:55:53 +0000 (20:55 -0500)
committermontellese <sascha.montellese@gmail.com>
Sun, 6 Feb 2011 10:15:19 +0000 (11:15 +0100)
refactored the git version extraction code to be shared between the update_git_rev.bat and BuildSetup.bat scripts.
(cherry picked from commit f833d1ede1c7476265b6fdbde5eb29f55b776d67)

project/VS2010Express/update_git_rev.bat
project/Win32BuildSetup/BuildSetup.bat
project/Win32BuildSetup/extract_git_rev.bat [new file with mode: 0644]

index 869a158..db34762 100644 (file)
@@ -6,34 +6,7 @@ IF EXIST %REV_FILE% (
   del %REV_FILE%
 )
 
-rem Use tgit.exe of TortoiseGit if available
-SET GITEXE="tgit.exe"
-%GITEXE% --version > NUL 2>&1
-if errorlevel 1 goto :notgit
-GOTO :extract
-
-:notgit
-
-rem Fallback on msysgit, which must have been added manually to the path.
-SET GITEXE="git.exe"
-%GITEXE% --help > NUL 2>&1
-if errorlevel 1 goto :nogit
-GOTO :extract
-
-:nogit
-
-rem Failure - no git tool to extract information.
-SET GIT_REV=Unknown
-GOTO :extracted
-
-:extract
-
-set oldCurrentDir=%CD%
-cd ..\..
-FOR /F "tokens=1 delims= " %%A IN ('%GITEXE% rev-parse --short HEAD') DO SET GIT_REV=%%A
-cd %oldCurrentDir%
-
-:extracted
+CALL ..\Win32BuildSetup\extract_git_rev.bat
 
 copy "%TEMPLATE%" "%REV_FILE%"
 
index 935424d..ba1ce21 100644 (file)
-@ECHO OFF\r
-rem ----Usage----\r
-rem BuildSetup [vs2008|vs2010] [gl|dx] [clean|noclean]\r
-rem vs2008 for compiling with visual studio 2008 (default)\r
-rem vs2010 for compiling with visual studio 2010\r
-rem gl for opengl build (default)\r
-rem dx for directx build\r
-rem clean to force a full rebuild\r
-rem noclean to force a build without clean\r
-rem noprompt to avoid all prompts\r
-CLS\r
-COLOR 1B\r
-TITLE XBMC for Windows Build Script\r
-rem ----PURPOSE----\r
-rem - Create a working XBMC build with a single click\r
-rem -------------------------------------------------------------\r
-rem Config\r
-rem If you get an error that Visual studio was not found, SET your path for VSNET main executable.\r
-rem -------------------------------------------------------------\r
-rem    CONFIG START\r
-SET comp=vs2008\r
-SET target=dx\r
-SET buildmode=ask\r
-SET promptlevel=prompt\r
-FOR %%b in (%1, %2, %3, %4, %5) DO (\r
-  IF %%b==vs2008 SET comp=vs2008\r
-  IF %%b==vs2010 SET comp=vs2010\r
-       IF %%b==dx SET target=dx\r
-       IF %%b==gl SET target=gl\r
-       IF %%b==clean SET buildmode=clean\r
-       IF %%b==noclean SET buildmode=noclean\r
-       IF %%b==noprompt SET promptlevel=noprompt\r
-)\r
-SET buildconfig=Release (OpenGL)\r
-IF %target%==dx SET buildconfig=Release (DirectX)\r
-\r
-IF %comp%==vs2008 (\r
-       IF "%VS90COMNTOOLS%"=="" (\r
-               set NET="%ProgramFiles%\Microsoft Visual Studio 9.0 Express\Common7\IDE\VCExpress.exe"\r
-       ) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\VCExpress.exe" (\r
-               set NET="%VS90COMNTOOLS%\..\IDE\VCExpress.exe"\r
-       ) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\devenv.exe" (\r
-               set NET="%VS90COMNTOOLS%\..\IDE\devenv.exe"\r
-       )\r
-) ELSE IF %comp%==vs2010 (\r
-  IF "%VS100COMNTOOLS%"=="" (\r
-               set NET="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe"\r
-       ) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" (\r
-               set NET="%VS100COMNTOOLS%\..\IDE\VCExpress.exe"\r
-       ) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" (\r
-               set NET="%VS100COMNTOOLS%\..\IDE\devenv.exe"\r
-       )\r
-)\r
-\r
-  IF NOT EXIST %NET% (\r
-    IF %comp%==vs2008 (\r
-      set DIETEXT=Visual Studio .NET 2008 Express was not found.\r
-    ELSE IF %comp%==vs2010 (\r
-      set DIETEXT=Visual Studio .NET 2010 Express was not found.\r
-    )\r
-         goto DIE\r
-  )\r
-  \r
-  IF %comp%==vs2008 (\r
-    set OPTS_EXE="..\VS2008Express\XBMC for Windows.sln" /build "%buildconfig%"\r
-    set CLEAN_EXE="..\VS2008Express\XBMC for Windows.sln" /clean "%buildconfig%"\r
-    set EXE= "..\VS2008Express\XBMC\%buildconfig%\XBMC.exe"\r
-  ) ELSE (\r
-    set OPTS_EXE="..\VS2010Express\XBMC for Windows.sln" /build "%buildconfig%"\r
-    set CLEAN_EXE="..\VS2010Express\XBMC for Windows.sln" /clean "%buildconfig%"\r
-    set EXE= "..\VS2010Express\XBMC\%buildconfig%\XBMC.exe"\r
-  )\r
-       \r
-  rem  CONFIG END\r
-  rem -------------------------------------------------------------\r
-\r
-  echo                         :                                                  \r
-  echo                        :::                                                 \r
-  echo                        ::::                                                \r
-  echo                        ::::                                                \r
-  echo    :::::::       :::::::::::::::::        ::::::      ::::::        :::::::\r
-  echo    :::::::::   ::::::::::::::::::::     ::::::::::  ::::::::::    :::::::::\r
-  echo     ::::::::: ::::::::::::::::::::::   ::::::::::::::::::::::::  ::::::::: \r
-  echo          :::::::::     :::      ::::: :::::    ::::::::    :::: :::::      \r
-  echo           ::::::      ::::       :::: ::::      :::::       :::::::        \r
-  echo           :::::       ::::        :::::::       :::::       ::::::         \r
-  echo           :::::       :::         ::::::         :::        ::::::         \r
-  echo           ::::        :::         ::::::        ::::        ::::::         \r
-  echo           ::::        :::        :::::::        ::::        ::::::         \r
-  echo          :::::        ::::       :::::::        ::::        ::::::         \r
-  echo         :::::::       ::::      ::::::::        :::         :::::::        \r
-  echo     :::::::::::::::    :::::  ::::: :::         :::         :::::::::      \r
-  echo  :::::::::  :::::::::  :::::::::::  :::         :::         ::: :::::::::  \r
-  echo  ::::::::    :::::::::  :::::::::   :::         :::         :::  ::::::::  \r
-  echo ::::::         :::::::    :::::     :            ::          ::    ::::::  \r
-  echo.\r
-  goto EXE_COMPILE\r
-\r
-:EXE_COMPILE\r
-  IF %buildmode%==clean goto COMPILE_EXE\r
-  rem ---------------------------------------------\r
-  rem  check for existing exe\r
-  rem ---------------------------------------------\r
-  IF EXIST buildlog.html del buildlog.html /q\r
-  \r
-  IF EXIST %EXE% (\r
-    goto EXE_EXIST\r
-  )\r
-  goto COMPILE_EXE\r
-\r
-:EXE_EXIST\r
-  IF %buildmode%==noclean goto COMPILE_NO_CLEAN_EXE\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Found a previous Compiled WIN32 EXE!\r
-  ECHO [1] a NEW EXE will be compiled for the BUILD_WIN32\r
-  ECHO [2] existing EXE will be updated (quick mode compile) for the BUILD_WIN32\r
-  ECHO ------------------------------------------------------------\r
-  set /P XBMC_COMPILE_ANSWER=Compile a new EXE? [1/2]:\r
-  if /I %XBMC_COMPILE_ANSWER% EQU 1 goto COMPILE_EXE\r
-  if /I %XBMC_COMPILE_ANSWER% EQU 2 goto COMPILE_NO_CLEAN_EXE\r
-  \r
-:COMPILE_EXE\r
-  ECHO Wait while preparing the build.\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Cleaning Solution...\r
-  %NET% %CLEAN_EXE%\r
-  ECHO Compiling Solution...\r
-  %NET% %OPTS_EXE%\r
-  IF NOT EXIST %EXE% (\r
-       set DIETEXT="XBMC.EXE failed to build!  See ..\vs2008express\XBMC\%buildconfig%\BuildLog.htm for details."\r
-       goto DIE\r
-  )\r
-  ECHO Done!\r
-  ECHO ------------------------------------------------------------\r
-  GOTO MAKE_BUILD_EXE\r
-  \r
-:COMPILE_NO_CLEAN_EXE\r
-  ECHO Wait while preparing the build.\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Compiling Solution...\r
-  %NET% %OPTS_EXE%\r
-  IF NOT EXIST %EXE% (\r
-       set DIETEXT="XBMC.EXE failed to build!  See ..\vs2008express\XBMC\%buildconfig%\BuildLog\BuildLog.htm for details."\r
-       goto DIE\r
-  )\r
-  ECHO Done!\r
-  ECHO ------------------------------------------------------------\r
-  GOTO MAKE_BUILD_EXE\r
-\r
-:MAKE_BUILD_EXE\r
-  ECHO Copying files...\r
-  IF EXIST BUILD_WIN32 rmdir BUILD_WIN32 /S /Q\r
-\r
-  Echo .svn>exclude.txt\r
-  Echo CVS>>exclude.txt\r
-  Echo .so>>exclude.txt\r
-  Echo Thumbs.db>>exclude.txt\r
-  Echo Desktop.ini>>exclude.txt\r
-  Echo dsstdfx.bin>>exclude.txt\r
-  Echo exclude.txt>>exclude.txt\r
-  rem and exclude potential leftovers\r
-  Echo mediasources.xml>>exclude.txt\r
-  Echo advancedsettings.xml>>exclude.txt\r
-  Echo guisettings.xml>>exclude.txt\r
-  Echo profiles.xml>>exclude.txt\r
-  Echo sources.xml>>exclude.txt\r
-  Echo userdata\cache\>>exclude.txt\r
-  Echo userdata\database\>>exclude.txt\r
-  Echo userdata\playlists\>>exclude.txt\r
-  Echo userdata\script_data\>>exclude.txt\r
-  Echo userdata\thumbnails\>>exclude.txt\r
-  rem UserData\visualisations contains currently only xbox visualisationfiles\r
-  Echo userdata\visualisations\>>exclude.txt\r
-  rem other platform stuff\r
-  Echo lib-osx>>exclude.txt\r
-  Echo players\mplayer>>exclude.txt\r
-  Echo FileZilla Server.xml>>exclude.txt\r
-  Echo asound.conf>>exclude.txt\r
-  Echo voicemasks.xml>>exclude.txt\r
-  Echo Lircmap.xml>>exclude.txt\r
-  \r
-  md BUILD_WIN32\Xbmc\r
-\r
-  xcopy %EXE% BUILD_WIN32\Xbmc > NUL\r
-  xcopy ..\..\userdata BUILD_WIN32\Xbmc\userdata /E /Q /I /Y /EXCLUDE:exclude.txt > NUL\r
-  copy ..\..\copying.txt BUILD_WIN32\Xbmc > NUL\r
-  copy ..\..\LICENSE.GPL BUILD_WIN32\Xbmc > NUL\r
-  copy ..\..\known_issues.txt BUILD_WIN32\Xbmc > NUL\r
-  xcopy dependencies\*.* BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  IF %comp%==vs2008 (\r
-    xcopy vs_redistributable\vs2008\vcredist_x86.exe BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  ) ELSE (\r
-    xcopy vs_redistributable\vs2010\vcredist_x86.exe BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  )\r
-  copy sources.xml BUILD_WIN32\Xbmc\userdata > NUL\r
-  \r
-  xcopy ..\..\language BUILD_WIN32\Xbmc\language /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  rem screensavers currently are xbox only\r
-  rem xcopy ..\..\screensavers BUILD_WIN32\Xbmc\screensavers /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  xcopy ..\..\addons BUILD_WIN32\Xbmc\addons /E /Q /I /Y /EXCLUDE:exclude.txt > NUL\r
-  xcopy ..\..\system BUILD_WIN32\Xbmc\system /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  xcopy ..\..\media BUILD_WIN32\Xbmc\media /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  xcopy ..\..\sounds BUILD_WIN32\Xbmc\sounds /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL\r
-  \r
-  SET skinpath=%CD%\Add_skins\r
-  SET scriptpath=%CD%\Add_scripts\r
-  SET pluginpath=%CD%\Add_plugins\r
-  rem override skin/script/pluginpaths from config.ini if there's a config.ini\r
-  IF EXIST config.ini FOR /F "tokens=* DELIMS=" %%a IN ('FINDSTR/R "=" config.ini') DO SET %%a\r
-  \r
-  IF EXIST error.log del error.log > NUL\r
-  SET build_path=%CD%\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Building Confluence Skin...\r
-  cd ..\..\addons\skin.confluence\r
-  call build.bat > NUL\r
-  cd %build_path%\r
-  rem call buildskins.bat\r
-  rem call buildscripts.bat "%scriptpath%"\r
-  rem call buildplugins.bat "%pluginpath%"\r
-  rem reset variables\r
-  SET skinpath=\r
-  SET scriptpath=\r
-  SET pluginpath=\r
-  rem restore color and title, some scripts mess these up\r
-  COLOR 1B\r
-  TITLE XBMC for Windows Build Script\r
-\r
-  IF EXIST exclude.txt del exclude.txt  > NUL\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Build Succeeded!\r
-  GOTO NSIS_EXE\r
-\r
-:NSIS_EXE\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Generating installer includes...\r
-  call genNsisIncludes.bat\r
-  ECHO ------------------------------------------------------------\r
-  FOR /F "Tokens=2* Delims=]" %%R IN ('FIND /v /n "&_&_&_&" "..\..\.svn\entries" ^| FIND "[11]"') DO SET XBMC_REV=%%R\r
-  SET XBMC_SETUPFILE=XBMCSetup-Rev%XBMC_REV%-%target%.exe\r
-  ECHO Creating installer %XBMC_SETUPFILE%...\r
-  IF EXIST %XBMC_SETUPFILE% del %XBMC_SETUPFILE% > NUL\r
-  rem get path to makensis.exe from registry, first try tab delim\r
-  FOR /F "tokens=2* delims=    " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B\r
-\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    rem try with space delim instead of tab\r
-    FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-      \r
-  IF NOT EXIST "%NSISExePath%" (\r
-    rem fails on localized windows (Default) becomes (Par Défaut)\r
-    FOR /F "tokens=3* delims=  " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-  \r
-  rem proper x64 registry checks\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    ECHO using x64 registry entries\r
-    FOR /F "tokens=2* delims=  " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    rem try with space delim instead of tab\r
-    FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    rem on win 7 x64, the previous fails\r
-    FOR /F "tokens=3* delims=  " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-  IF NOT EXIST "%NSISExePath%" (\r
-    rem try with space delim instead of tab\r
-    FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B\r
-  )\r
-\r
-  SET NSISExe=%NSISExePath%\makensis.exe\r
-  "%NSISExe%" /V1 /X"SetCompressor /FINAL lzma" /Dxbmc_root="%CD%\BUILD_WIN32" /Dxbmc_revision="%XBMC_REV%" /Dxbmc_target="%target%" "XBMC for Windows.nsi"\r
-  IF NOT EXIST "%XBMC_SETUPFILE%" (\r
-         set DIETEXT=Failed to create %XBMC_SETUPFILE%.\r
-         goto DIE\r
-  )\r
-  ECHO ------------------------------------------------------------\r
-  ECHO Done!\r
-  ECHO Setup is located at %CD%\%XBMC_SETUPFILE%\r
-  ECHO ------------------------------------------------------------\r
-  GOTO VIEWLOG_EXE\r
-  \r
-:DIE\r
-  ECHO ------------------------------------------------------------\r
-  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-\r
-  ECHO    ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\r
-  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-\r
-  set DIETEXT=ERROR: %DIETEXT%\r
-  echo %DIETEXT%\r
-  ECHO ------------------------------------------------------------\r
-\r
-:VIEWLOG_EXE\r
-  IF %promptlevel%==noprompt (\r
-  goto END\r
-  )\r
-  IF %comp%==vs2008 (\r
-    SET log="%CD%\..\vs2008express\XBMC\%buildconfig%\objs\BuildLog.htm"\r
-  ) ELSE (\r
-    SET log="%CD%\..\vs2010express\XBMC\%buildconfig%\objs\BuildLog.htm"\r
-  )\r
-  IF NOT EXIST %log% goto END\r
-  \r
-  copy %log% ./buildlog.html > NUL\r
-  \r
-  set /P XBMC_BUILD_ANSWER=View the build log in your HTML browser? [y/n]\r
-  if /I %XBMC_BUILD_ANSWER% NEQ y goto END\r
-  \r
-  IF %comp%==vs2008 (\r
-    SET log="%CD%\..\vs2008express\XBMC\%buildconfig%\objs\" BuildLog.htm\r
-  ) ELSE (\r
-    SET log="%CD%\..\vs2010express\XBMC\%buildconfig%\objs\" BuildLog.htm\r
-  )\r
-  \r
-  start /D%log%\r
-  goto END\r
-\r
-:END\r
-  IF %promptlevel% NEQ noprompt (\r
-  ECHO Press any key to exit...\r
-  pause > NUL\r
-  )\r
+@ECHO OFF
+rem ----Usage----
+rem BuildSetup [vs2008|vs2010] [gl|dx] [clean|noclean]
+rem vs2008 for compiling with visual studio 2008 (default)
+rem vs2010 for compiling with visual studio 2010
+rem gl for opengl build (default)
+rem dx for directx build
+rem clean to force a full rebuild
+rem noclean to force a build without clean
+rem noprompt to avoid all prompts
+CLS
+COLOR 1B
+TITLE XBMC for Windows Build Script
+rem ----PURPOSE----
+rem - Create a working XBMC build with a single click
+rem -------------------------------------------------------------
+rem Config
+rem If you get an error that Visual studio was not found, SET your path for VSNET main executable.
+rem -------------------------------------------------------------
+rem    CONFIG START
+SET comp=vs2010
+SET target=dx
+SET buildmode=ask
+SET promptlevel=prompt
+FOR %%b in (%1, %2, %3, %4, %5) DO (
+  IF %%b==vs2008 SET comp=vs2008
+  IF %%b==vs2010 SET comp=vs2010
+       IF %%b==dx SET target=dx
+       IF %%b==gl SET target=gl
+       IF %%b==clean SET buildmode=clean
+       IF %%b==noclean SET buildmode=noclean
+       IF %%b==noprompt SET promptlevel=noprompt
+)
+SET buildconfig=Release (OpenGL)
+IF %target%==dx SET buildconfig=Release (DirectX)
+
+IF %comp%==vs2008 (
+       IF "%VS90COMNTOOLS%"=="" (
+               set NET="%ProgramFiles%\Microsoft Visual Studio 9.0 Express\Common7\IDE\VCExpress.exe"
+       ) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\VCExpress.exe" (
+               set NET="%VS90COMNTOOLS%\..\IDE\VCExpress.exe"
+       ) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\devenv.exe" (
+               set NET="%VS90COMNTOOLS%\..\IDE\devenv.exe"
+       )
+) ELSE IF %comp%==vs2010 (
+  IF "%VS100COMNTOOLS%"=="" (
+               set NET="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe"
+       ) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" (
+               set NET="%VS100COMNTOOLS%\..\IDE\VCExpress.exe"
+       ) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" (
+               set NET="%VS100COMNTOOLS%\..\IDE\devenv.exe"
+       )
+)
+
+  IF NOT EXIST %NET% (
+    IF %comp%==vs2008 (
+      set DIETEXT=Visual Studio .NET 2008 Express was not found.
+    ELSE IF %comp%==vs2010 (
+      set DIETEXT=Visual Studio .NET 2010 Express was not found.
+    )
+         goto DIE
+  )
+  
+  IF %comp%==vs2008 (
+    set OPTS_EXE="..\VS2008Express\XBMC for Windows.sln" /build "%buildconfig%"
+    set CLEAN_EXE="..\VS2008Express\XBMC for Windows.sln" /clean "%buildconfig%"
+    set EXE= "..\VS2008Express\XBMC\%buildconfig%\XBMC.exe"
+  ) ELSE (
+    set OPTS_EXE="..\VS2010Express\XBMC for Windows.sln" /build "%buildconfig%"
+    set CLEAN_EXE="..\VS2010Express\XBMC for Windows.sln" /clean "%buildconfig%"
+    set EXE= "..\VS2010Express\XBMC\%buildconfig%\XBMC.exe"
+  )
+       
+  rem  CONFIG END
+  rem -------------------------------------------------------------
+
+  echo                         :                                                  
+  echo                        :::                                                 
+  echo                        ::::                                                
+  echo                        ::::                                                
+  echo    :::::::       :::::::::::::::::        ::::::      ::::::        :::::::
+  echo    :::::::::   ::::::::::::::::::::     ::::::::::  ::::::::::    :::::::::
+  echo     ::::::::: ::::::::::::::::::::::   ::::::::::::::::::::::::  ::::::::: 
+  echo          :::::::::     :::      ::::: :::::    ::::::::    :::: :::::      
+  echo           ::::::      ::::       :::: ::::      :::::       :::::::        
+  echo           :::::       ::::        :::::::       :::::       ::::::         
+  echo           :::::       :::         ::::::         :::        ::::::         
+  echo           ::::        :::         ::::::        ::::        ::::::         
+  echo           ::::        :::        :::::::        ::::        ::::::         
+  echo          :::::        ::::       :::::::        ::::        ::::::         
+  echo         :::::::       ::::      ::::::::        :::         :::::::        
+  echo     :::::::::::::::    :::::  ::::: :::         :::         :::::::::      
+  echo  :::::::::  :::::::::  :::::::::::  :::         :::         ::: :::::::::  
+  echo  ::::::::    :::::::::  :::::::::   :::         :::         :::  ::::::::  
+  echo ::::::         :::::::    :::::     :            ::          ::    ::::::  
+  goto EXE_COMPILE
+
+:EXE_COMPILE
+  IF %buildmode%==clean goto COMPILE_EXE
+  rem ---------------------------------------------
+  rem  check for existing exe
+  rem ---------------------------------------------
+  IF EXIST buildlog.html del buildlog.html /q
+  
+  IF EXIST %EXE% (
+    goto EXE_EXIST
+  )
+  goto COMPILE_EXE
+
+:EXE_EXIST
+  IF %buildmode%==noclean goto COMPILE_NO_CLEAN_EXE
+  ECHO ------------------------------------------------------------
+  ECHO Found a previous Compiled WIN32 EXE!
+  ECHO [1] a NEW EXE will be compiled for the BUILD_WIN32
+  ECHO [2] existing EXE will be updated (quick mode compile) for the BUILD_WIN32
+  ECHO ------------------------------------------------------------
+  set /P XBMC_COMPILE_ANSWER=Compile a new EXE? [1/2]:
+  if /I %XBMC_COMPILE_ANSWER% EQU 1 goto COMPILE_EXE
+  if /I %XBMC_COMPILE_ANSWER% EQU 2 goto COMPILE_NO_CLEAN_EXE
+  
+:COMPILE_EXE
+  ECHO Wait while preparing the build.
+  ECHO ------------------------------------------------------------
+  ECHO Cleaning Solution...
+  %NET% %CLEAN_EXE%
+  ECHO Compiling XBMC...
+  %NET% %OPTS_EXE%
+  IF NOT EXIST %EXE% (
+       set DIETEXT="XBMC.EXE failed to build!  See ..\vs2008express\XBMC\%buildconfig%\BuildLog.htm for details."
+       goto DIE
+  )
+  ECHO Done!
+  ECHO ------------------------------------------------------------
+  GOTO MAKE_BUILD_EXE
+  
+:COMPILE_NO_CLEAN_EXE
+  ECHO Wait while preparing the build.
+  ECHO ------------------------------------------------------------
+  ECHO Compiling Solution...
+  %NET% %OPTS_EXE%
+  IF NOT EXIST %EXE% (
+       set DIETEXT="XBMC.EXE failed to build!  See ..\vs2008express\XBMC\%buildconfig%\BuildLog\BuildLog.htm for details."
+       goto DIE
+  )
+  ECHO Done!
+  ECHO ------------------------------------------------------------
+  GOTO MAKE_BUILD_EXE
+
+:MAKE_BUILD_EXE
+  ECHO Copying files...
+  IF EXIST BUILD_WIN32 rmdir BUILD_WIN32 /S /Q
+
+  Echo .svn>exclude.txt
+  Echo CVS>>exclude.txt
+  Echo .so>>exclude.txt
+  Echo Thumbs.db>>exclude.txt
+  Echo Desktop.ini>>exclude.txt
+  Echo dsstdfx.bin>>exclude.txt
+  Echo exclude.txt>>exclude.txt
+  rem and exclude potential leftovers
+  Echo mediasources.xml>>exclude.txt
+  Echo advancedsettings.xml>>exclude.txt
+  Echo guisettings.xml>>exclude.txt
+  Echo profiles.xml>>exclude.txt
+  Echo sources.xml>>exclude.txt
+  Echo userdata\cache\>>exclude.txt
+  Echo userdata\database\>>exclude.txt
+  Echo userdata\playlists\>>exclude.txt
+  Echo userdata\script_data\>>exclude.txt
+  Echo userdata\thumbnails\>>exclude.txt
+  rem UserData\visualisations contains currently only xbox visualisationfiles
+  Echo userdata\visualisations\>>exclude.txt
+  rem other platform stuff
+  Echo lib-osx>>exclude.txt
+  Echo players\mplayer>>exclude.txt
+  Echo FileZilla Server.xml>>exclude.txt
+  Echo asound.conf>>exclude.txt
+  Echo voicemasks.xml>>exclude.txt
+  Echo Lircmap.xml>>exclude.txt
+  
+  md BUILD_WIN32\Xbmc
+
+  xcopy %EXE% BUILD_WIN32\Xbmc > NUL
+  xcopy ..\..\userdata BUILD_WIN32\Xbmc\userdata /E /Q /I /Y /EXCLUDE:exclude.txt > NUL
+  copy ..\..\copying.txt BUILD_WIN32\Xbmc > NUL
+  copy ..\..\LICENSE.GPL BUILD_WIN32\Xbmc > NUL
+  copy ..\..\known_issues.txt BUILD_WIN32\Xbmc > NUL
+  xcopy dependencies\*.* BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  IF %comp%==vs2008 (
+    xcopy vs_redistributable\vs2008\vcredist_x86.exe BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  ) ELSE (
+    xcopy vs_redistributable\vs2010\vcredist_x86.exe BUILD_WIN32\Xbmc /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  )
+  copy sources.xml BUILD_WIN32\Xbmc\userdata > NUL
+  
+  xcopy ..\..\language BUILD_WIN32\Xbmc\language /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  xcopy ..\..\addons BUILD_WIN32\Xbmc\addons /E /Q /I /Y /EXCLUDE:exclude.txt > NUL
+  xcopy ..\..\system BUILD_WIN32\Xbmc\system /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  xcopy ..\..\media BUILD_WIN32\Xbmc\media /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+  xcopy ..\..\sounds BUILD_WIN32\Xbmc\sounds /E /Q /I /Y /EXCLUDE:exclude.txt  > NUL
+    
+  IF EXIST error.log del error.log > NUL
+  SET build_path=%CD%
+  ECHO ------------------------------------------------------------
+  ECHO Building Confluence Skin...
+  cd ..\..\addons\skin.confluence
+  call build.bat > NUL
+  cd %build_path%
+  rem restore color and title, some scripts mess these up
+  COLOR 1B
+  TITLE XBMC for Windows Build Script
+
+  IF EXIST exclude.txt del exclude.txt  > NUL
+  ECHO ------------------------------------------------------------
+  ECHO Build Succeeded!
+  GOTO NSIS_EXE
+
+:NSIS_EXE
+  ECHO ------------------------------------------------------------
+  ECHO Generating installer includes...
+  call genNsisIncludes.bat
+  ECHO ------------------------------------------------------------
+  CALL extract_git_rev.bat
+  SET GIT_REV=#%GIT_REV%
+  SET XBMC_SETUPFILE=XBMCSetup-Rev%GIT_REV%-%target%.exe
+  ECHO Creating installer %XBMC_SETUPFILE%...
+  IF EXIST %XBMC_SETUPFILE% del %XBMC_SETUPFILE% > NUL
+  rem get path to makensis.exe from registry, first try tab delim
+  FOR /F "tokens=2* delims=    " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B
+
+  IF NOT EXIST "%NSISExePath%" (
+    rem try with space delim instead of tab
+    FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+      
+  IF NOT EXIST "%NSISExePath%" (
+    rem fails on localized windows (Default) becomes (Par Défaut)
+    FOR /F "tokens=3* delims=  " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+
+  IF NOT EXIST "%NSISExePath%" (
+    FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+  
+  rem proper x64 registry checks
+  IF NOT EXIST "%NSISExePath%" (
+    ECHO using x64 registry entries
+    FOR /F "tokens=2* delims=  " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+  IF NOT EXIST "%NSISExePath%" (
+    rem try with space delim instead of tab
+    FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+  IF NOT EXIST "%NSISExePath%" (
+    rem on win 7 x64, the previous fails
+    FOR /F "tokens=3* delims=  " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+  IF NOT EXIST "%NSISExePath%" (
+    rem try with space delim instead of tab
+    FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\Wow6432Node\NSIS" /ve') DO SET NSISExePath=%%B
+  )
+
+  SET NSISExe=%NSISExePath%\makensis.exe
+  "%NSISExe%" /V1 /X"SetCompressor /FINAL lzma" /Dxbmc_root="%CD%\BUILD_WIN32" /Dxbmc_revision="%GIT_REV%" /Dxbmc_target="%target%" "XBMC for Windows.nsi"
+  IF NOT EXIST "%XBMC_SETUPFILE%" (
+         set DIETEXT=Failed to create %XBMC_SETUPFILE%.
+         goto DIE
+  )
+  ECHO ------------------------------------------------------------
+  ECHO Done!
+  ECHO Setup is located at %CD%\%XBMC_SETUPFILE%
+  ECHO ------------------------------------------------------------
+  GOTO VIEWLOG_EXE
+  
+:DIE
+  ECHO ------------------------------------------------------------
+  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
+  ECHO    ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
+  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
+  set DIETEXT=ERROR: %DIETEXT%
+  echo %DIETEXT%
+  ECHO ------------------------------------------------------------
+
+:VIEWLOG_EXE
+  IF %promptlevel%==noprompt (
+  goto END
+  )
+  IF %comp%==vs2008 (
+    SET log="%CD%\..\vs2008express\XBMC\%buildconfig%\objs\BuildLog.htm"
+  ) ELSE (
+    SET log="%CD%\..\vs2010express\XBMC\%buildconfig%\objs\BuildLog.htm"
+  )
+  IF NOT EXIST %log% goto END
+  
+  copy %log% ./buildlog.html > NUL
+  
+  set /P XBMC_BUILD_ANSWER=View the build log in your HTML browser? [y/n]
+  if /I %XBMC_BUILD_ANSWER% NEQ y goto END
+  
+  IF %comp%==vs2008 (
+    SET log="%CD%\..\vs2008express\XBMC\%buildconfig%\objs\" BuildLog.htm
+  ) ELSE (
+    SET log="%CD%\..\vs2010express\XBMC\%buildconfig%\objs\" BuildLog.htm
+  )
+  
+  start /D%log%
+  goto END
+
+:END
+  IF %promptlevel% NEQ noprompt (
+  ECHO Press any key to exit...
+  pause > NUL
diff --git a/project/Win32BuildSetup/extract_git_rev.bat b/project/Win32BuildSetup/extract_git_rev.bat
new file mode 100644 (file)
index 0000000..a2b8202
--- /dev/null
@@ -0,0 +1,34 @@
+@echo off
+
+rem Batch file output: %GIT_REV% variable, containing the git revision
+
+rem Use tgit.exe of TortoiseGit if available
+SET GITEXE="tgit.exe"
+%GITEXE% --version > NUL 2>&1
+if errorlevel 1 goto :notgit
+GOTO :extract
+
+:notgit
+
+rem Fallback on msysgit - must be in the path
+SET GITEXE="git.exe"
+%GITEXE% --help > NUL 2>&1
+if errorlevel 1 goto :nogit
+GOTO :extract
+
+:nogit
+
+rem Failure - no git tool to extract information.
+SET GIT_REV=Unknown
+GOTO :done
+
+:extract
+
+set oldCurrentDir=%CD%
+cd ..\..
+FOR /F "tokens=1 delims= " %%A IN ('%GITEXE% rev-parse --short HEAD') DO SET GIT_REV=%%A
+cd %oldCurrentDir%
+
+:done
+
+SET GITEXE=