精简组件,优化部分功能设置。
This repository holds the build tools needed to build the Brave desktop browser for macOS, Windows, and Linux. In particular, it fetches and syncs code from the projects defined in package.json and src/brave/DEPS:
- Chromium
- Fetches code via
depot_tools. - sets the branch for Chromium (ex: 65.0.3325.181).
- Fetches code via
- brave-core
- Mounted at
src/brave. - Maintains patches for 3rd party Chromium code.
- Mounted at
- adblock-rust
- Implements Brave's ad-block engine.
- Linked through brave/adblock-rust-ffi.
You can visit our website to get the latest stable release.
For other versions of our browser, please see:
- iOS - brave/brave-ios
Please see the contributing guidelines.
Join the Q&A community if you'd like to get more involved with Brave. You can ask for help, discuss features you'd like to see, and a lot more. We'd love to have your help so that we can continue improving Brave.
Help us translate Brave to your language by submitting translations at https://www.transifex.com/brave/brave/.
Follow @brave on Twitter for important news and announcements.
Follow the instructions for your platform:
Once you have the prerequisites installed, you can get the code and initialize the build environment.
git clone git@github.com:brave/brave-browser.git
cd brave-browser
npm install
# this takes 30-45 minutes to run
# the Chromium source is downloaded, which has a large history
npm run initbrave-core based android builds should use npm run init -- --target_os=android --target_arch=arm (or whichever CPU type you want to build for)
You can also set the target_os and target_arch for init and build using:
npm config set target_os android
npm config set target_arch arm
The default build type is component.
# start the component build compile
npm run build
To do a release build:
# start the release compile
npm run build Release
brave-core based android builds should use npm run build -- --target_os=android --target_arch=arm or set the npm config variables as specified above for init
Running a release build with npm run build Release can be very slow and use a lot of RAM, especially on Linux with the Gold LLVM plugin.
To run a statically linked build (takes longer to build, but starts faster):
npm run build -- StaticTo run a debug build (Component build with is_debug=true):
npm run build -- DebugBrave staff may also want to try Goma for faster builds.
To start the build:
npm start [Release|Component|Static|Debug]
npm run sync -- [--force] [--init] [--create] [brave_core_ref]
This will attempt to stash your local changes in brave-core, but it's safer to commit local changes before running this
npm run sync will (depending on the below flags):
- 📥 Update sub-projects (chromium, brave-core) to latest commit of a git ref (e.g. tag or branch)
- 🤕 Apply patches
- 🔄 Update gclient DEPS dependencies
- ⏩ Run hooks (e.g. to perform
npm installon child projects)
Run npm run sync brave_core_ref to checkout the specified brave-core ref and update all dependent repos including chromium if needed.
brave-core> git checkout -b branch_namebrave-core> git fetch origin
brave-core> git checkout [-b] branch_name
brave-core> npm run sync
...Updating 2 patches...
...Updating child dependencies...
...Running hooks...brave-core> git pull
brave-core> npm run sync
...Updating 2 patches...
...Updating child dependencies...
...Running hooks...Reset to latest brave-browser master and brave-core master (via init, will always result in a longer build and will remove any pending changes in your brave-core working directory):
brave-browser> git checkout master
brave-browser> git pull
brave-browser> npm run sync -- --initWhen you know that DEPS didn't change, but .patch files did (quickest attempt to perform a mini-sync before a build):
brave-core> git checkout featureB
brave-core> git pull
brave-browser> npm run apply_patches
...Applying 2 patches...- Google Safe Browsing: Get an API key with SafeBrowsing API enabled from https://console.developers.google.com/. Update the
GOOGLE_API_KEYenvironment variable with your key as per https://www.chromium.org/developers/how-tos/api-keys to enable Google SafeBrowsing.
See Troubleshooting for solutions to common problems.
