Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build_2010.bat - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1825b559c15f610200c2f775334e042957b0e61 (plain)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
@ECHO OFF
SETLOCAL

IF /I "%1" == "help" (
TITLE build_2010.bat %1
ECHO.
ECHO:Usage:
ECHO: "build_2010.bat [clean|build|rebuild] [null|x86|x64] [null|Main|Resource] [Debug]"
ECHO:Executing "build_2010.bat" will use the defaults: "build_2010.bat build null null"
ECHO:Examples:
ECHO:build_2010.bat build x86 Resource     -Will build the x86 resources only
ECHO:build_2010.bat build null Resource    -Will build both x86 and x64 resources only
ECHO:build_2010.bat build x86              -Will build x86 Main exe and the resources
ECHO:build_2010.bat build x86 null Debug   -Will build x86 Main Debug exe and resources
ECHO.
ECHO:"null" can be replaced with anything, e.g. "all": build_2010.bat build x86 all Debug
ECHO.
ECHO:NOTE: Debug only applies to Main project [mpc-hc_2010.sln]
ECHO.
ENDLOCAL
EXIT /B
)

REM pre-build checks
IF "%VS100COMNTOOLS%" == "" GOTO :MissingVar
IF "%MINGW32%" == "" GOTO :MissingVar
IF "%MINGW64%" == "" GOTO :MissingVar

REM Detect if we are running on 64bit WIN and use Wow6432Node, and set the path
REM of Inno Setup accordingly
IF "%PROGRAMFILES(x86)%zzz"=="zzz" (SET "U_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
) ELSE (
SET "U_=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)

SET "I_=Inno Setup"
SET "A_=%I_% 5"
FOR /f "delims=" %%a IN (
	'REG QUERY "%U_%\%A_%_is1" /v "%I_%: App Path"2^>Nul^|FIND "REG_"') DO (
	SET "InnoSetupPath=%%a"&CALL :SubIS %%InnoSetupPath:*Z=%%)

GOTO :NoVarMissing

:MissingVar
COLOR 0C
Title Compiling MPC-HC [ERROR]
ECHO:Not all build dependencies found. To build MPC-HC you need:
ECHO:* Visual Studio 2010 installed
ECHO:* MinGW 32 bit build environment with MSYS pointed to in MINGW32 env var
ECHO:* MinGW 64 bit build environment with MSYS pointed to in MINGW64 env var
ECHO. && ECHO.
ECHO:Press any key to exit...
PAUSE >NUL
ENDLOCAL
EXIT /B

:NoVarMissing
REM set up variables
Title Compiling MPC-HC with MSVC 2010...
SET start_time=%date%-%time%

IF "%1" == "" (SET BUILDTYPE=/Build) ELSE (SET BUILDTYPE=/%1)
SET ORIGPATH="%CD%"

REM FIXME: Does this work for x64 builds??
REM we do have a good alternative vcvarsall.bat x86 | x64
REM Default location: "C:\Program Files\Microsoft Visual Studio 9\VC\Vcvarsall.bat"
CALL "%VS100COMNTOOLS%vsvars32.bat"
CD %ORIGPATH%

SET BUILD_APP=devenv /nologo

REM Debug build only applies to Main (mpc-hc_2010.sln)
IF /I "%4" == "Debug" (SET BUILDCONFIG=Debug) ELSE (SET BUILDCONFIG=Release)

REM Do we want to build x86, x64 or both?
IF /I "%2" == "x64" GOTO :skip32
SET COPY_TO_DIR=bin\mpc-hc_x86
SET Platform=Win32
CALL :Sub_build_internal %*

:skip32
IF /I "%2" == "x86" GOTO :END
SET COPY_TO_DIR=bin\mpc-hc_x64
SET Platform=x64
CALL :Sub_build_internal %*
GOTO :END

:EndWithError
Title Compiling MPC-HC [ERROR]
ECHO. && ECHO.
ECHO: **ERROR: Build failed and aborted!**
PAUSE
ENDLOCAL
EXIT /B

:END
Title Compiling MPC-HC with MSVC 2010 [FINISHED]
ECHO. && ECHO.
ECHO:MPC-HC's compilation started on %start_time%
ECHO:and completed on %date%-%time%
ECHO.
ENDLOCAL
EXIT /B


:Sub_build_internal
IF /I "%3"=="Resource" GOTO :skipMain
%BUILD_APP% mpc-hc_2010.sln %BUILDTYPE% "%BUILDCONFIG%|%Platform%"
IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError

:skipMain
IF /I "%3"=="Main" GOTO :skipResource
%BUILD_APP% mpciconlib_2010.sln %BUILDTYPE% "Release|%Platform%"
IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError

DEL/f/a "%COPY_TO_DIR%\mpciconlib.exp" "%COPY_TO_DIR%\mpciconlib.lib" >NUL 2>&1

FOR %%A IN ("Belarusian" "Catalan" "Chinese simplified" "Chinese traditional" 
"Czech" "Dutch" "French" "German" "Hungarian" "Italian" "Japanese" "Korean" 
"Polish" "Portuguese" "Russian" "Slovak" "Spanish" "Swedish" "Turkish" "Ukrainian"
) DO (
CALL :SubMPCRES %%A
)

:skipResource
IF /I "%1" == "Clean" EXIT /B
IF /I "%3" == "Resource" EXIT /B
IF /I "%3" == "Main" EXIT /B
IF /I "%4" == "Debug" EXIT /B

XCOPY "src\apps\mplayerc\Authors.txt" ".\%COPY_TO_DIR%\" /Y /V
XCOPY "src\apps\mplayerc\Changelog.txt" ".\%COPY_TO_DIR%\" /Y /V
XCOPY "COPYING" ".\%COPY_TO_DIR%\" /Y /V

IF /I "%Platform%" == "x64" GOTO :skipx86installer
IF DEFINED InnoSetupPath (
"%InnoSetupPath%\iscc.exe" /Q /O"bin" "distrib\mpc-hc_setup.iss"
IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
) ELSE (
GOTO :END
)
GOTO :EOF

:skipx86installer
IF /I "%Platform%" == "Win32" GOTO :END
IF DEFINED InnoSetupPath (
"%InnoSetupPath%\iscc.exe" /Q /O"bin" "distrib\mpc-hc_setup.iss" /DBuildx64=True
IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
) ELSE (
GOTO :END
)
GOTO :EOF

:SubMPCRES
%BUILD_APP% mpcresources_2010.sln %BUILDTYPE% "Release %~1|%Platform%"
IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
GOTO :EOF

:SubIS
SET InnoSetupPath=%*
GOTO :EOF