Skip to content

Instantly share code, notes, and snippets.

@ewencp
Created January 9, 2012 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewencp/1580251 to your computer and use it in GitHub Desktop.
Save ewencp/1580251 to your computer and use it in GitHub Desktop.
Helper script for building berkelium on Windows. Assumes you have required build tools for Chromium, cygwin for svn.exe and patch.exe. You'll need to manually set the version of Chromium to build.
REM This entire upper block is for determining where Visual Studio is. Search for TOPDIR for the real code (after a big empty block)
@SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0
@SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET Framework35Version=v3.5
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
@echo Setting environment for using Microsoft Visual Studio 2008 x86 tools.
@call :GetWindowsSdkDir
@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin;%PATH%"
set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
set "LIB=%WindowsSdkDir%lib;%LIB%"
)
@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCPackages;%PATH%
@set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE;%INCLUDE%
@set LIB=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\LIB;%LIB%
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\LIB;%LIBPATH%
@goto end
:GetWindowsSdkDir
@call :GetWindowsSdkDirHelper HKLM > nul 2>&1
@if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
@if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\
@exit /B 0
:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
if "%%i"=="CurrentInstallFolder" (
SET "WindowsSdkDir=%%k"
)
)
@if "%WindowsSdkDir%"=="" exit /B 1
@exit /B 0
:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set.
@goto end
:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end
:end
set TOPDIR=%CD%
REM Setup initial directory structure, get berkelium
mkdir %TOPDIR%\chromium
call :CloneBerkelium
REM Checkout and setup depot_tools
cd %TOPDIR%\chromium
C:\cygwin\bin\svn.exe co http://src.chromium.org/svn/trunk/tools/depot_tools
cd depot_tools
call gclient.bat
set PATH=%PATH%;%CD%
REM Config for the right version. FIXME get version from VERSION.txt
mkdir %TOPDIR%\chromium\chromium
cd %TOPDIR%\chromium\chromium
REM 11.0.696.77
call gclient config http://src.chromium.org/svn/releases/8.0.552.237
REM FIXME Disable layout tests
call gclient sync
REM Apply patches
cd %TOPDIR%\chromium\chromium\src
FOR %%P IN (..\..\..\berkelium\patches\*.patch) DO (C:\cygwin\bin\patch.exe -p0 -s -f < "%%P")
REM Build Chromium
cd %TOPDIR%\chromium\chromium\src
echo
echo
echo
echo Visual Studio may need to convert the solution. Let it convert, then close it and continue.
echo
echo
echo
VCExpress.exe chrome\chrome.sln
PAUSE
VCExpress.exe /build Release /project chrome /log chrome.warning.log /out chrome.error.log chrome\chrome.sln
cd %TOPDIR%
exit /B 0
:CloneBerkelium
git clone git://github.com/sirikata/berkelium.git %TOPDIR%\berkelium
exit /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment