`
helpbs
  • 浏览: 1154907 次
文章分类
社区版块
存档分类
最新评论

The Chromium Projects---Get the Code 留作备份,万一以后被墙了。。。

 
阅读更多

Get the Code

The Chromium codebase consists of hundreds of thousands of files, which means that a checkout straight from the Subversion (SVN) repository can take a long time. To speed up the process, we have provided a tarball that you can use to bootstrap the download. Alternatively, you can skip the tarball and download straight from SVN (not recommended). If you know what you're doing, you can alternativelycheck out the source from git.
Note:There is no advantage to checking out straight from SVN. The tarball includes SVN directories so that after you unpack the tarball, you can get up to the latest revision by usinggclient sync.
If you just want to see the code without checking it out, you canbrowse SVNor useGoogle Code Search for Chromium.
If you only want to look at the source code on your own machine, you'll need at least 1.6 GB of hard drive space available. (Somewhat less for Linux, since it already has some of the dependencies installed.) If you want to build it, you will need just under 10 GB of space, including all the object files and executables.

Bootstrap using the tarball

  1. Make sure that you have a program that can untar.tgz(.tar.gz)files.
    • Mac OS X and Linux both havetarbuilt in. (On a Mac, use a shell in the Terminal application.)
    • Examples for Windows include the open-source7-Ziparchiver, the free BsdTar utility (part ofLibArchive), and WinZip. Note:Cygwin's tar tool will not work; it will mess up the file permissions.
  2. Download thesource tarball. Some download applications change the file suffix without extracting the file. If yours did, rename it back tochromium.rXXXXX.tgz.
  3. Choose a directory to hold your source code.Important:Make sure the directory path hasno spaces.
    • Windows example:c:/chromiumtrunk
    • Mac OS X (Terminal) or Linux example:~/chromium
  4. Untar the source tarball into the directory you've chosen. Examples: If you're using 7-Zip, extract the .tgz file, then extract the resulting .tar file. If you're using LibArchive, issue the following command:
    "C:/Program Files/GnuWin32/bin/bsdtar.exe" -xzf chromium.tgz
  5. Install the depot_tools.If using Ubuntu, see Bootstrap Notes below.
  6. Updating your checkout once by runninggclientsync--forcein the source code directory (~/chromium/src).
    1. If you don't want to sync, you need to generate the project files withgclient runhooks --force. This will callGYPto generate your platform-specific files. You won't be able to build otherwise. If you don't sync, you'll miss some os-specific dependencies so you're better to sync anyway. :)
This should give you a complete source tree. But if you have any problems, first check that you've installed any prerequisites listed on the build instructions for your platform.
Bootstrap notes forUbuntu:
  • If you see the following message, you will need to update your version of subversion to at least 1.5:
    svn: This client is too old to work with working copy...
    • If you are running Ubuntu 8 and 'sudo apt-get install subversion' doesn't update you past 1.4.6, try the following:
      • $ sudo apt-get install libsvn1=1.5.1dfsg1-1ubuntu2~hardy3
      • $ sudo apt-get install subversion=1.5.1dfsg1-1ubuntu2~hardy3
  • Make sure your dependencies are up to date by running the install-build-deps.sh script:
    • .../chromium/src $ ./build/install-build-deps.sh

Check out the sources

You'll usegclient / depot toolsto download the Chromium code from its subversion repository.The first time you executegclient, there will be a delay (a minute or so) while it updates the depot tools. Downloading the Chromium code takes about an hour.
Thegclient config <url>step only needs to be run once to set up your working directory. It creates a.gclientfile in your working directory that identifies the corresponding structure to pull from the repository. Thegclient syncstep creates several subdirectories. To update your tree in the future, you only need to rungclient syncfrom anywhere within your working directory.
NOTE: These instructions will pull a read-only tree. If you are a committer, and plan to make changes to source code, use the instructions given to you when you received commit access.

Windows

Note:It's not necessary to have Subversion or Python installed already: the first run of gclient will install them for you.On the other hand, if youdoalready have Subversion installed through Cygwin, you'll need to set up your PATH tohave the depot_tools svn ahead of the cygwin svn, anduse only the depot_tools svn, not Cygwin's, to check out Chromium.
  1. Create a directory to hold your source code. This example assumesc:/chromiumtrunk, but other names are fine.
    Important:Make sure the full directory path hasno spaces.
  2. In a shell window, execute the following commands:
    cdc:/chromiumtrunk

    gclient config http://src.chromium.org/svn/trunk/src
    To download the initial code, update your checkout as described below.

Mac OS X

  1. Create a directory to hold the code. This example assumes the directory is~/chromium, but other names are fine. Note that if you have FileVault enabled, you'll want to either disable it or put the code in a folder outside the home directory, as otherwise Xcode will be very slow or hang. You also probably want to disable Spotlight indexing for that folder (System Preferences -> Spotlight -> mark the folder as private).
  2. From a shell in the Terminal, execute the following commands:
    $ cd~/chromium

    $ gclient config http://src.chromium.org/svn/trunk/src
  3. To download the initial code, update your checkout as described below.

Linux

  1. Pick a directory for your build. We will call this directory$CHROMIUM_ROOTbelow.
  2. Check out Chromium:
    $ cd $CHROMIUM_ROOT
    $ gclient config http://src.chromium.org/svn/trunk/src
  3. To download the initial code, update your checkout as described below.

Check out the source for a specific release

Use the same steps for "Check out directly from SVN", except that as opposed to using gclient config onhttp://src.chromium.org/svn/trunk/src, you need to do a checkout for the specific version of Chromium that you are interested in:

For example, if you wanted the source for build 5.0.330.0, the following command would be appropriate:

gclient config http://src.chromium.org/svn/releases/5.0.330.0

Staying Green most of the time

When running gclient config, you can specify a second URL to be referenced when doing updates. Instead of pulling the most recent revision, the version number at this URL will be queried, allowing you to track the "most recent green" revision so you can spend less time debugging other people's issues or running builds only to find out that thewaterfall was red. Chromium has two of these URLs:

Continuous build

    Get the last revision from:
  • http://commondatastorage.googleapis.com/chromium-browser-continuous/Linux/LAST_CHANGE
    http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/LAST_CHANGE
    http://commondatastorage.googleapis.com/chromium-browser-continuous/Win/LAST_CHANGE
  • This corresponds to the most recent revision that passed both unit tests and layout tests on a particular platform (linux, mac, or win). Since layout tests can take a while to run, this revision may be an hour or more "stale".

LKGR

  • http://chromium-status.appspot.com/lkgr
  • This URL holds the version of the latest revision to pass only unit tests (in debug mode). This can happen faster, so for most developers this is probably what you want since it will help you ensure that your changes work against a "fresher" version of Chromium.

Setup

To use one of these URLs, pass it when you rungclient config:
$ cd~/chromium

$ gclient config http://src.chromium.org/svn/trunk/src
http://chromium-status.appspot.com/lkgr

Now whenever you callgclient sync, it will only sync as far as the configured URL specifies. To over-ride this, pass the--headparameter togclient, e.g.:gclient sync --head

You can also add this directly to your .gclient file if you already have one:

solutions = [
{"name" : "src",
"url" : "http://src.chromium.org/svn/trunk/src",
"safesync_url" : "http://chromium-status.appspot.com/lkgr"
},
]

Reducing the size of your checkout

You can edit your .gclient file to avoid pulling down certain pieces of the checkout that you may not want. For example, inserting something like

"custom_deps": {
"src/third_party/WebKit/LayoutTests": None,
"src/chrome/tools/test/reference_build/chrome": None,
"src/chrome_frame/tools/test/reference_build/chrome": None,
"src/chrome/tools/test/reference_build/chrome_linux": None,
"src/chrome/tools/test/reference_build/chrome_mac": None,
"src/third_party/hunspell_dictionaries": None,
}
into one of the solutions (i.e. just underneath the "url": ... line) should save a lot of space. The list of repos that gclient pulls is set in src/DEPS. and listed in .gclient_entries.
As of r48011, the following can definitely be removed if you just want to build Chromium:
src/third_party/WebKit/LayoutTests - All the WebKit layout tests.
src/chrome/tools/test/reference_build/chrome - Windows reference build for performance testing.
src/chrome_frame/tools/test/reference_build/chrome- Chrome Frame reference build for performance testing.
src/chrome/tools/test/reference_build/chrome_linux- Linux reference build for performance testing.
src/chrome/tools/test/reference_build/chrome_mac- Mac reference build for performance testing.
src/third_party/hunspell_dictionaries - spellchecker dictionaries used for unit tests.

Update to the latest revision

Whether you started with a source tarball or an svn checkout, at some point you'll want to update your checkout to the latest revision.
The first time you execute gclient, there will be a delay (a minute or so) while it updates the depot tools. How long the Chromium code update takes depends on how much has changed since you last updated (or since the bootstrap tarball was created).
  1. Install the depot_tools, if you haven't already.
  2. Visit theChromium Buildbot waterfallto see the state of the tree.If the top of the waterfall says:
    OPEN- The tree is in a good state and you should be able to compile the code. Go to the next step.
    CLOSED
    - There might be compile or test failures. You can download the code, but you'll get those same failures when you try to compile or run tests. Best to check back later.
  3. In a shell window, execute the following commands:
    cd[your Chromium source directory]
    gclient sync
To update to a specific revision, use
gclient sync --revision src@####

and the DEPS file will make sure you get the other directories in their matching forms.

Checking out subpart of the tree

svn co http://src.chromium.org/svn/trunk/src/chrome/common/extensions/docs/examples/tutorials/getstarted/

Note the difference in the url, namely/viewvc/chromewas replaced with/svn.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics