]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6129 More improvements for V8 Windows build on 32-bit machines.
authorPeter Olsson <peter@olssononline.se>
Thu, 23 Jan 2014 12:39:34 +0000 (13:39 +0100)
committerPeter Olsson <peter@olssononline.se>
Thu, 23 Jan 2014 12:39:34 +0000 (13:39 +0100)
libs/win32/v8/build-v8.bat

index 1590dba2c688e26e02eb72ea8cf809771889bdad..0b78ac43c97fdc31f4513b9d9077807e699bab7a 100644 (file)
@@ -1,28 +1,49 @@
 @ECHO OFF\r
 \r
+REM First argument is the target architecture\r
+REM Second argument is "Debug" or "Release" mode\r
+REM Third argument is the V8 root directory path\r
+REM Fourth argument is the version of Visual Studio (optional)\r
+\r
 IF "%1" == "" GOTO Fail\r
 IF "%2" == "" GOTO Fail\r
 IF "%3" == "" GOTO Fail\r
 \r
+REM Go into the V8 lib directory\r
 cd "%3"\r
 \r
+REM Check the last build info, so we know if we're supposed to build again or not\r
 SET /P LAST_BUILD_INFO=<last_build\r
-\r
 IF "%1-%2" == "%LAST_BUILD_INFO%" (\r
-       ECHO V8 is already built!\r
-       SET COPY_FILES_ONLY=1\r
+       IF EXIST ".\build\%2\v8.dll" (\r
+               ECHO V8 is already built!\r
+               SET COPY_FILES_ONLY=1\r
+       )\r
 )\r
 \r
 SET LIB_DEST_DIR=\r
 \r
+IF NOT "%4" == "" (\r
+       SET VS_VERSION=-Gmsvs_version=%4\r
+       ECHO Forcing build to use Visual Studio %4\r
+)\r
+\r
 IF "%1" == "x64" (\r
-       IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dtarget_arch=x64 -Dcomponent=shared_library -Dv8_use_snapshot=false\r
+       REM If this is a 32-bit system (but we target x64), we must disable the snapshot feature to get it to build.\r
+       IF NOT EXIST "%PROGRAMFILES(X86)%" (\r
+               SET SKIP_V8_SNAPSHOT=-Dv8_use_snapshot=false\r
+       )\r
+)\r
+\r
+IF "%1" == "x64" (\r
+       IF NOT "%SKIP_V8_SNAPSHOT%" == "" ECHO Targeting x64 platform on a x86 system, disabling V8 snapshout feature to make this work [%SKIP_V8_SNAPSHOT%]\r
+       IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dtarget_arch=x64 -Dcomponent=shared_library %SKIP_V8_SNAPSHOT% %VS_VERSION%\r
        IF NOT ERRORLEVEL 0 GOTO Fail\r
        SET LIB_DEST_DIR=..\..\x64\%2\\r
 )\r
 \r
 IF "%1" == "x86" (\r
-       IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dcomponent=shared_library\r
+       IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dcomponent=shared_library %VS_VERSION%\r
        IF NOT ERRORLEVEL 0 GOTO Fail\r
        SET LIB_DEST_DIR=..\..\Win32\%2\\r
 )\r
@@ -31,10 +52,16 @@ IF "%LIB_DEST_DIR%" == "" GOTO Fail
 \r
 IF "%COPY_FILES_ONLY%" == "1" GOTO CopyFiles\r
 \r
-devenv.com /clean %2 tools\gyp\v8.sln\r
+REM Clean build before we continue\r
+devenv /clean %2 tools\gyp\v8.sln\r
 IF NOT ERRORLEVEL 0 GOTO Fail\r
 \r
-devenv.com /build %2 tools\gyp\v8.sln\r
+REM Just to make sure that everything is cleaned up\r
+rmdir /S /Q .\build\%2\r
+\r
+REM Build the V8 library\r
+devenv /build %2 "tools\gyp\v8.sln" /project "tools\gyp\v8.vcxproj" /projectconfig %2\r
+REM devenv /build %2 tools\gyp\v8.sln\r
 IF NOT ERRORLEVEL 0 GOTO Fail\r
 \r
 :CopyFiles\r
@@ -56,4 +83,6 @@ ECHO %1-%2> last_build
 exit\r
 \r
 :Fail\r
+REM Delete the last_build info if this build failed!\r
+@del /Q last_build\r
 exit /b 1\r