forked from ClearFoundry/ClearScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathV8Update.cmd
More file actions
360 lines (301 loc) · 9.03 KB
/
Copy pathV8Update.cmd
File metadata and controls
360 lines (301 loc) · 9.03 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
@echo off
setlocal
::-----------------------------------------------------------------------------
:: process arguments
::-----------------------------------------------------------------------------
set v8testedrev=5.5.372.40
set gyprev=e7079f0e0e14108ab0dba58728ff219637458563
set cygwinrev=c89e446b273697fadf3a10ff1007a97c0b7de6df
set clangrev=1f92f999fc374a479e98a189ebdfe25c09484486
set traceeventcommonrev=e0fa02a02f61430dae2bddfd89a334ea4389f495
set gtestrev=6f8a66431cb592dad629028a50b3dd418a408c87
set gmockrev=0421b6f358139f02e102c9c332ce19a33faf75be
:ProcessArgs
set download=true
set mode=Release
set isdebug=false
:ProcessArg
if "%1"=="" goto ProcessArgsDone
if "%1"=="/?" goto EchoUsage
if /i "%1"=="/n" goto SetDownloadFalse
if /i "%1"=="\n" goto SetDownloadFalse
if /i "%1"=="-n" goto SetDownloadFalse
if /i "%1"=="debug" goto SetDebugMode
if /i "%1"=="release" goto SetReleaseMode
goto SetV8Rev
:EchoUsage
echo Downloads, builds, and imports V8 for use with ClearScript.
echo.
echo V8UPDATE [/N] [mode] [revision]
echo.
echo /N Do not download; use previously downloaded files if possible.
echo mode Build mode: "Debug" or "Release" (default).
echo revision V8 revision: "Latest", "Tested" (default) or branch/commit/tag.
echo * Examples: "candidate", "3.29.88.16".
echo * View history at https://chromium.googlesource.com/v8/v8.git.
goto Exit
:SetDownloadFalse
set download=false
goto NextArg
:SetDebugMode
set mode=Debug
set isdebug=true
goto NextArg
:SetReleaseMode
set mode=Release
set isdebug=false
goto NextArg
:SetV8Rev
set v8rev=%1
goto NextArg
:NextArg
shift
goto ProcessArg
:ProcessArgsDone
::-----------------------------------------------------------------------------
:: check environment
::-----------------------------------------------------------------------------
:CheckOS
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto CheckOSDone
if defined PROCESSOR_ARCHITEW6432 goto CheckOSDone
echo Error: This script requires a 64-bit operating system.
goto Exit
:CheckOSDone
:CheckMSVS
if "%VisualStudioVersion%"=="12.0" goto UseMSVS2013
if "%VisualStudioVersion%"=="14.0" goto UseMSVS2015
echo Error: This script requires a Visual Studio 2013 or 2015 Developer Command
echo Prompt. Browse to http://www.visualstudio.com for more information.
goto Exit
:UseMSVS2013
set GYP_MSVS_VERSION=2013
goto CheckMSVSDone
:UseMSVS2015
set GYP_MSVS_VERSION=2015
:CheckMSVSDone
::-----------------------------------------------------------------------------
:: main
::-----------------------------------------------------------------------------
:Main
echo Build mode: %mode%
cd ClearScript\v8\v8
if errorlevel 1 goto Exit
if /i "%download%"=="true" goto Download
if exist build\ goto SkipDownload
echo *** BUILD DIRECTORY NOT FOUND; DOWNLOAD REQUIRED ***
choice /m Continue
if errorlevel 2 goto Exit
goto Download
:SkipDownload
cd build
goto Build
::-----------------------------------------------------------------------------
:: download
::-----------------------------------------------------------------------------
:Download
:ResolveRev
if "%v8rev%"=="" goto UseTestedRev
if /i "%v8rev%"=="latest" goto UseLatestRev
if /i "%v8rev%"=="tested" goto UseTestedRev
if /i "%v8rev%"=="%v8testedrev%" goto UseTestedRev
echo V8 revision: %v8rev%
echo *** WARNING: THIS V8 REVISION MAY NOT BE COMPATIBLE WITH CLEARSCRIPT ***
choice /m Continue
if errorlevel 2 goto Exit
goto ResolveRevDone
:UseTestedRev
set v8rev=%v8testedrev%
echo V8 revision: Tested (%v8testedrev%)
goto ResolveRevDone
:UseLatestRev
set v8rev=master
echo V8 revision: Latest
echo *** WARNING: THIS V8 REVISION MAY NOT BE COMPATIBLE WITH CLEARSCRIPT ***
choice /m Continue
if errorlevel 2 goto Exit
:ResolveRevDone
:EnsureBuildDir
if not exist build\ goto CreateBuildDir
echo Removing old build directory ...
rd /s /q build
:CreateBuildDir
echo Creating build directory ...
md build
if errorlevel 1 goto Error
:EnsureBuildDirDone
cd build
:DownloadV8
echo Downloading V8 ...
git clone -n -q https://chromium.googlesource.com/v8/v8.git
if errorlevel 1 goto Error
cd v8
git checkout -q "%v8rev%"
if errorlevel 1 goto Error
cd ..
:DownloadV8Done
cd v8
:PatchV8
echo Patching V8 ...
git apply --ignore-whitespace ..\..\V8Patch.txt 2>applyPatch.log
if errorlevel 1 goto Error
:PatchV8Done
:DownloadGYP
echo Downloading GYP ...
git clone -n -q https://chromium.googlesource.com/external/gyp.git tools/gyp
if errorlevel 1 goto Error
cd tools\gyp
git checkout -q "%gyprev%"
if errorlevel 1 goto Error
cd ..\..
:DownloadGYPDone
:DownloadCygwin
echo Downloading Cygwin ...
git clone -n -q https://chromium.googlesource.com/chromium/deps/cygwin.git third_party/cygwin
if errorlevel 1 goto Error
cd third_party/cygwin
git checkout -q "%cygwinrev%"
if errorlevel 1 goto Error
cd ..\..
:DownloadCygwinDone
:DownloadClang
echo Downloading Clang ...
git clone -n -q https://chromium.googlesource.com/chromium/src/tools/clang.git tools/clang
if errorlevel 1 goto Error
cd tools\clang
git checkout -q "%clangrev%"
if errorlevel 1 goto Error
cd ..\..
:DownloadClangDone
:DownloadTraceEventCommon
echo Downloading TraceEventCommon ...
git clone -n -q https://chromium.googlesource.com/chromium/src/base/trace_event/common.git base/trace_event/common
if errorlevel 1 goto Error
cd base\trace_event\common
git checkout -q "%traceeventcommonrev%"
if errorlevel 1 goto Error
cd ..\..\..
:DownloadTraceEventCommonDone
:DownloadGTest
echo Downloading GTest ...
git clone -n -q https://chromium.googlesource.com/external/github.com/google/googletest.git testing/gtest
if errorlevel 1 goto Error
cd testing\gtest
git checkout -q "%gtestrev%"
if errorlevel 1 goto Error
cd ..\..
:DownloadGTestDone
:DownloadGMock
echo Downloading GMock ...
git clone -n -q https://chromium.googlesource.com/external/googlemock.git testing/gmock
if errorlevel 1 goto Error
cd testing\gmock
git checkout -q "%gmockrev%"
if errorlevel 1 goto Error
cd ..\..
:DownloadGMockDone
cd ..
:DownloadDone
::-----------------------------------------------------------------------------
:: build
::-----------------------------------------------------------------------------
:Build
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_GENERATORS=msvs
:CreatePatchFile
echo Creating patch file ...
cd v8
git diff --ignore-space-change --ignore-space-at-eol >V8Patch.txt 2>createPatch.log
if errorlevel 1 goto Error
cd ..
:CreatePatchFileDone
:Copy32Bit
echo Building 32-bit V8 ...
if exist v8-ia32\ goto Copy32BitDone
md v8-ia32
if errorlevel 1 goto Error
xcopy v8\*.* v8-ia32\ /e /y >nul
if errorlevel 1 goto Error
:Copy32BitDone
:Build32Bit
cd v8-ia32
python gypfiles\gyp_v8 -Dtarget_arch=ia32 -Dcomponent=shared_library -Dis_debug=%isdebug% -Dv8_use_snapshot=true -Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 >gyp.log
if errorlevel 1 goto Error
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 src\v8.sln >build.log
if errorlevel 1 goto Error
cd ..
:Build32BitDone
:Copy64Bit
echo Building 64-bit V8 ...
if exist v8-x64\ goto Copy64BitDone
md v8-x64
if errorlevel 1 goto Error
xcopy v8\*.* v8-x64\ /e /y >nul
if errorlevel 1 goto Error
:Copy64BitDone
:Build64Bit
cd v8-x64
python gypfiles\gyp_v8 -Dtarget_arch=x64 -Dcomponent=shared_library -Dis_debug=%isdebug% -Dv8_use_snapshot=true -Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 >gyp.log
if errorlevel 1 goto Error
msbuild /p:Configuration=%mode% /p:Platform=x64 /t:v8 src\v8.sln >build.log
if errorlevel 1 goto Error
cd ..
:Build64BitDone
:BuildDone
::-----------------------------------------------------------------------------
:: import
::-----------------------------------------------------------------------------
:Import
cd ..
:EnsureLibDir
if not exist lib\ goto CreateLibDir
echo Removing old lib directory ...
rd /s /q lib
:CreateLibDir
echo Creating lib directory ...
md lib
if errorlevel 1 goto Error
:EnsureLibDirDone
:ImportLibs
echo Importing V8 libraries ...
copy build\v8-ia32\build\%mode%\v8-ia32.dll lib\ >nul
if errorlevel 1 goto Error
copy build\v8-ia32\build\%mode%\v8-ia32.pdb lib\ >nul
if errorlevel 1 goto Error
copy build\v8-ia32\build\%mode%\lib\v8-ia32.lib lib\ >nul
if errorlevel 1 goto Error
copy build\v8-x64\build\%mode%\v8-x64.dll lib\ >nul
if errorlevel 1 goto Error
copy build\v8-x64\build\%mode%\v8-x64.pdb lib\ >nul
if errorlevel 1 goto Error
copy build\v8-x64\build\%mode%\lib\v8-x64.lib lib\ >nul
if errorlevel 1 goto Error
:ImportLibsDone
:EnsureIncludeDir
if not exist include\ goto CreateIncludeDir
echo Removing old include directory ...
rd /s /q include
:CreateIncludeDir
echo Creating include directory ...
md include
if errorlevel 1 goto Error
:EnsureIncludeDirDone
:ImportHeaders
echo Importing V8 header files ...
copy build\v8\include\*.* include\ >nul
if errorlevel 1 goto Error
:ImportHeadersDone
:ImportPatchFile
echo Importing patch file ...
copy build\v8\V8Patch.txt .\ >nul
if errorlevel 1 goto Error
:ImportPatchFileDone
:ImportDone
::-----------------------------------------------------------------------------
:: exit
::-----------------------------------------------------------------------------
echo Succeeded!
goto Exit
:Error
echo *** THE PREVIOUS STEP FAILED ***
:Exit
endlocal