赞
踩
一、系统要求
1、Windows 7或更新的64位系统,至少有8GB内存,强烈推荐超过16GB;
2、源码必须存放在NTFS格式的驱动器上,至少有100GB的空闲磁盘空间;
3、安装合适版本的Visual Studio
二、配置Visual Studio
。截止到2017年9月(R503915),Chromium需要Visual Studio 2017 (15.7.2)编译。必须安装“桌面开发用C++”组件和“MFC和ATL支持”的子组件。
三、代理设置(如有需要)
1、Git代理设置;
- git config --global https.proxy socks5://localhost:1080
- git config --global core.proxy socks5://localhost:1080
- git config --global http.proxy socks5://localhost:1080
- git config --global http.sslVerify false
Git取消代理;
- git config --global --unset http.proxy
- git config --global --unset httpx.proxy
- git config --global --unset core.proxy
2、Python代理设置;
- set http_proxy=http://localhost:1080
- set https_proxy=https://localhost:1080
建议购置阿里云Windows香港服务器,同步好代码之后直接打包下载。
四、安装配置depot_tools
下载depot_tools压缩包https://src.chromium.org/svn/trunk/tools/depot_tools.zip解压, 把depot_tools设置为环境变量, 并且设置环境变量DEPOT_TOOLS_WIN_TOOLCHAIN的值为0;
五、源码下载
1、创建一个chromium目录存放源码(可以在任何地方,只要路径是英文且没空格就行);
mkdir chromium && cd chromium
2、运行depot_tools检查依赖项与检出源码;
fetch chromium
如果不需要历史记录可以添加参数--no-history
fetch chromium --no-history
当fetch完成,会在工作目录创建src目录与一个隐藏的文件.gclient。
六、编译
- set CEF_USE_GN=0
- set GYP_DEFINES=buildtype=Official proprietary_codecs=1 ffmpeg_branding=Chrome
- set GYP_GENERATORS=ninja,msvs-ninja
- set GYP_MSVS_VERSION=2015
- set CEF_ARCHIVE_FORMAT=tar.bz2
- set DEPOT_TOOLS_WIN_TOOLCHAIN=0
-
- cd src
- gn gen --ide=vs out\Default
- devenv out\Default\all.sln
7、问题
(1)使用代理的情况下,gclient runhooks下载gs://xxx出错,设置 .boto内容
- [Boto]
- proxy = 127.0.0.1
- proxy_port = 1080
执行命令
set NO_AUTH_BOTO_CONFIG=E:\Working\ChromiumSrc\.boto
(2)、直接使用国外Windows服务器情况下,gclient runhooks下载gs://xxx出错,
错误1:download_from_google_storage src\buildtools\win\gn.exe.sha1 returned non-zero exit
处理:
修改文件depot_tools\download_from_google_storage.py,增加
import urllib
增加函数
- def download_url(src, target):
- """ the contents of src, which may be a URL or local file, to the
- target directory. """
- if src[:4] == 'http':
- # Attempt to download a URL.
- opener = urllib.FancyURLopener({})
- response = opener.open(src)
- CHUNK = 16 * 1024
- with open(target, 'wb') as f:
- while True:
- chunk = response.read(CHUNK)
- if not chunk:
- break
- f.write(chunk)
- else:
- raise Exception('Path type is unsupported or does not exist: ' + src)
查找# Check if file exists,如下注释部分代码,如:
- # Check if file exists.
- file_url = '%s/%s' % (base_url, input_sha1_sum)
- #(code, _, err) = gsutil.check_call('ls', file_url)
- #if code != 0:
- # if code == 404:
- # out_q.put('%d> File %s for %s does not exist, skipping.' % (
- # thread_num, file_url, output_filename))
- # ret_codes.put((1, 'File %s for %s does not exist.' % (
- # file_url, output_filename)))
- # else:
- # # Other error, probably auth related (bad ~/.boto, etc).
- # out_q.put('%d> Failed to fetch file %s for %s, skipping. [Err: %s]' % (
- # thread_num, file_url, output_filename, err))
- # ret_codes.put((1, 'Failed to fetch file %s for %s. [Err: %s]' % (
- # file_url, output_filename, err)))
- # continue
查找# Fetch the file,如下注释部分代码,如:
- # Fetch the file.
- out_q.put('%d> Downloading %s...' % (thread_num, output_filename))
- try:
- if delete:
- os.remove(output_filename) # Delete the file if it exists already.
- except OSError:
- if os.path.exists(output_filename):
- out_q.put('%d> Warning: deleting %s failed.' % (
- thread_num, output_filename))
- #code, _, err = gsutil.check_call('cp', file_url, output_filename)
- #if code != 0:
- # out_q.put('%d> %s' % (thread_num, err))
- # ret_codes.put((code, err))
- # continue
- download_url(file_url, output_filename)
错误2:src\build\get_syzygy_binaries.py
处理:
修改文件chromium\src\build\get_syzygy_binaries.py,增加
import urllib
增加函数
- def download_url(src, target):
- """ the contents of src, which may be a URL or local file, to the
- target directory. """
- if src[:4] == 'http':
- # Attempt to download a URL.
- opener = urllib.FancyURLopener({})
- response = opener.open(src)
- CHUNK = 16 * 1024
- with open(target, 'wb') as f:
- while True:
- chunk = response.read(CHUNK)
- if not chunk:
- break
- f.write(chunk)
- else:
- raise Exception('Path type is unsupported or does not exist: ' + src)
将函数 _Download修改为
- def _Download(resource):
- """Downloads the given GS resource to a temporary file, returning its path."""
- tmp = tempfile.mkstemp(suffix='syzygy_archive')
- os.close(tmp[0])
- tmp_file = tmp[1]
- url = 'gs://syzygy-archive' + resource
- if sys.platform == 'cygwin':
- # Change temporary path to Windows path for gsutil
- def winpath(path):
- return subprocess.check_output(['cygpath', '-w', path]).strip()
- tmp_file = winpath(tmp_file)
- #_GsUtil('cp', url, tmp_file)
- url=url.replace("gs://","https://storage.googleapis.com/")
- download_url(url,tmp_file)
- return tmp[1]
参考:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。