/
buildpvraddons.bat
131 lines (106 loc) · 4.01 KB
/
buildpvraddons.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@ECHO OFF
REM Batch file to download and build xbmc-pvr-addons and place them in xbmc's addons folder
SET CUR_DIR=%CD%
SET EXITCODE=0
SET DEPS_DIR=..\BuildDependencies
SET TMP_DIR=%DEPS_DIR%\tmp
SET LIBNAME=xbmc-pvr-addons
SET VERSION=2955e1dd62f4047b2782cb927f7671ae209f20d8
SET SOURCE=%LIBNAME%
SET GIT_URL=git://github.com/opdenkamp/%LIBNAME%.git
SET SOURCE_DIR=%TMP_DIR%\%SOURCE%
SET BUILT_ADDONS_DIR=%SOURCE_DIR%\addons
rem ***********************************************************************
rem workaround to use vs2010 for pvr addons until they are switch to vs2013
REM look for MSBuild.exe in .NET Framework 4.x
FOR /F "tokens=3* delims= " %%A IN ('REG QUERY HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 /v MSBuildToolsPath') DO SET OLDNET=%%AMSBuild.exe
IF NOT EXIST "!OLDNET!" (
FOR /F "tokens=3* delims= " %%A IN ('REG QUERY HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 /v MSBuildToolsPath') DO SET OLDNET=%%AMSBuild.exe
)
IF EXIST "!OLDNET!" (
set msbuildemitsolution=1
set OPTS_EXE="..\VS2010Express\XBMC for Windows.sln" /t:Build /p:Configuration="%buildconfig%"
set CLEAN_EXE="..\VS2010Express\XBMC for Windows.sln" /t:Clean /p:Configuration="%buildconfig%"
) ELSE (
IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.com" (
set OLDNET="%VS100COMNTOOLS%\..\IDE\devenv.com"
) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" (
set OLDNET="%VS100COMNTOOLS%\..\IDE\devenv.exe"
) ELSE IF "%VS100COMNTOOLS%"=="" (
set OLDNET="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe"
) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" (
set OLDNET="%VS100COMNTOOLS%\..\IDE\VCExpress.exe"
)
)
rem *************************************************************************
REM check if MSBuild.exe is used because it requires different command line switches
IF "%msbuildemitsolution%" == "1" (
rem set OPTS_EXE=%SOURCE_DIR%\project\VS2010Express\xbmc-pvr-addons.sln /t:Build /p:Configuration="Release" /property:VCTargetsPath="%MSBUILDROOT%Microsoft.Cpp\v4.0\V120"
set OPTS_EXE=%SOURCE_DIR%\project\VS2010Express\xbmc-pvr-addons.sln /t:Build /p:Configuration="Release"
) ELSE (
set OPTS_EXE=%SOURCE_DIR%\project\VS2010Express\xbmc-pvr-addons.sln /build Release
)
REM Try wrapped msysgit - must be in the path
SET GITEXE=git.cmd
CALL %GITEXE% --help > NUL 2>&1
IF errorlevel 1 GOTO nowrapmsysgit
GOTO work
:nowrapmsysgit
REM Fallback on regular msysgit - must be in the path
SET GITEXE=git.exe
%GITEXE% --help > NUL
IF errorlevel 9009 IF NOT errorlevel 9010 GOTO nomsysgit
GOTO work
:nomsysgit
REM Fallback on tgit.exe of TortoiseGit if available
SET GITEXE=tgit.exe
%GITEXE% --version > NUL 2>&1
IF errorlevel 9009 IF NOT errorlevel 9010 GOTO error
GOTO work
:work
IF NOT EXIST "%TMP_DIR%" MD "%TMP_DIR%"
REM clone the git repository into SOURCE_DIR
CALL %GITEXE% clone %GIT_URL% "%SOURCE_DIR%" > NUL 2>&1
CD "%SOURCE_DIR%"
REM get the proper revision
CALL %GITEXE% checkout %VERSION% > NUL 2>&1
:build
REM run DownloadBuildDeps.bat of xbmc-pvr-addons
CD "project\BuildDependencies"
CALL DownloadBuildDeps.bat > NUL 2>&1
CD "%CUR_DIR%"
REM build xbmc-pvr-addons.sln
ECHO Building PVR addons
rem "%MSBUILDROOT%12.0\bin\MSBuild.exe" %OPTS_EXE%
%OLDNET% %OPTS_EXE%
IF %errorlevel%==1 (
goto fail
)
REM copy the built pvr addons into ADDONS_DIR
CD "%BUILT_ADDONS_DIR%"
SET ADDONS_DIR=..\..\..\..\Win32BuildSetup\BUILD_WIN32\Xbmc\xbmc-pvr-addons
REM exclude some files
ECHO addon.xml.in > exclude.txt
ECHO _win32.exp >> exclude.txt
ECHO _win32.lib >> exclude.txt
ECHO _win32.pdb >> exclude.txt
FOR /D %%A IN ("pvr.*") DO (
IF EXIST "%%A\addon" (
ECHO Installing %%A
XCOPY "%%A\addon\*" "%ADDONS_DIR%\%%A" /E /Q /I /Y /EXCLUDE:exclude.txt > NUL
)
)
DEL exclude.txt > NUL
CD "%CUR_DIR%"
REM cleanup temporary directories
RMDIR "%TMP_DIR%" /S /Q > NUL
GOTO done
:error
ECHO No git command available. Unable to fetch and build xbmc-pvr-addons.
SET EXITCODE=1
:fail
ECHO Failed to build one or more pvr addons
SET EXITCODE=1
:done
SET GITEXE=
EXIT /B %EXITCODE%