|
| 1 | +# Build instructions |
| 2 | + |
| 3 | +There are two types of builds you can perform. You can build |
| 4 | +PyCEF using the prebuilt CEF binaries. Or you can build both |
| 5 | +PyCEF and CEF from sources. Building CEF is a long process that |
| 6 | +can take hours. In the tools/ directory there is the automate.py |
| 7 | +script that automates building. However before you can run it |
| 8 | +you must satisfy some requirements. |
| 9 | + |
| 10 | + |
| 11 | +Table of contents: |
| 12 | +* [Requirements](#requirements) |
| 13 | +* [Build PyCEF using prebuilt CEF binaries](#build-pycef-using-prebuilt-cef-binaries) |
| 14 | +* [Build both PyCEF and CEF from sources](#build-both-pycef-and-cef-from-sources) |
| 15 | +* [Build CEF manually](#build-cef-manually) |
| 16 | +* [How to patch](#how-to-patch) |
| 17 | +* [Ninja build slows down computer](#ninja-build-slows-down-computer) |
| 18 | + |
| 19 | + |
| 20 | +## Requirements |
| 21 | + |
| 22 | +Below are platform specific requirements. Do these first before |
| 23 | +following instructions in the "All platforms" section that lists |
| 24 | +requirements common for all platforms. |
| 25 | + |
| 26 | +__Windows__ |
| 27 | + |
| 28 | +* For Python 2.7 - VS2008 compiler is required: |
| 29 | + http://www.microsoft.com/en-us/download/details.aspx?id=44266 |
| 30 | +* For Python 3.4 - VS2010 compiler is required: |
| 31 | + https://docs.python.org/3.4/using/windows.html#compiling-python-on-windows |
| 32 | +* For Python 3.5 - VS2015 compiler is required: |
| 33 | + https://docs.python.org/3.5/using/windows.html#compiling-python-on-windows |
| 34 | +* To build CEF from sources: |
| 35 | + * Use Win7 x64 or later. 32-bit OS'es are not supported. For more details see [here] |
| 36 | + (https://www.chromium.org/developers/how-tos/build-instructions-windows). |
| 37 | + * For CEF branch >= 2704 install VS2015 Update 2 or later |
| 38 | + * For CEF branch < 2704 install VS2013 Update 4 or later |
| 39 | + * Install [CMake](https://cmake.org/) 2.8.12.1 or newer and add cmake.exe |
| 40 | + to PATH |
| 41 | + * Install [ninja](http://martine.github.io/ninja/) and add ninja.exe |
| 42 | + to PATH |
| 43 | + * You need about 16 GB of RAM during linking. If there is an error |
| 44 | + just add additional virtual memory. |
| 45 | + * For Python 2.7 copy "pycef/src/windows/stdint.h" to |
| 46 | + "%LocalAppData%\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include\" |
| 47 | + |
| 48 | +__All platforms__ |
| 49 | + |
| 50 | +* Install dependencies for the automate.py tool by executing: |
| 51 | + `cd tools/ && pip install -r requirements.txt`. This will install |
| 52 | + some PyPI packages including Cython. On Windows installing Cython |
| 53 | + requires a VS compiler - see instructions above for Windows. |
| 54 | + |
| 55 | + |
| 56 | +## Build PyCEF using prebuilt CEF binaries |
| 57 | + |
| 58 | +Run the automate.py tool using the --prebuilt-cef flag: |
| 59 | +``` |
| 60 | +cd tools/ |
| 61 | +python automate.py --prebuilt-cef |
| 62 | +``` |
| 63 | + |
| 64 | +You should be fine by running it with the default options, but if you |
| 65 | +need to customize the build then use the --help flag to see more. |
| 66 | + |
| 67 | + |
| 68 | +## Build both PyCEF and CEF from sources |
| 69 | + |
| 70 | +Run the automate.py tool using the --build-cef flag: |
| 71 | +``` |
| 72 | +cd tools/ |
| 73 | +python automate.py --build-cef --cef-branch 2526 |
| 74 | +``` |
| 75 | + |
| 76 | +You should be fine by running it with the default options, but if you |
| 77 | +need to customize the build then use the --help flag to see more. |
| 78 | + |
| 79 | + |
| 80 | +## Build CEF manually |
| 81 | + |
| 82 | +CEF Python official binaries come with custom CEF binaries with |
| 83 | +a few patches applied for our use case. These patches are in the |
| 84 | +patches/ directory. |
| 85 | + |
| 86 | +On Linux before running any of CEF tools apply the issue73 patch |
| 87 | +first. |
| 88 | + |
| 89 | +To build CEF follow the instructions on the Branches and |
| 90 | +Building CEF wiki page: |
| 91 | +https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding |
| 92 | + |
| 93 | +After it is successfully built - apply patches, rebuild and remake |
| 94 | +distribs. |
| 95 | + |
| 96 | +Note that CEF patches must be applied in the "download_dir/chromium/src/cef/" |
| 97 | +directory, not in the "download_dir/cef/" directory. |
| 98 | + |
| 99 | + |
| 100 | +## How to patch |
| 101 | + |
| 102 | +Create a patch from unstaged changes in current directory: |
| 103 | +``` |
| 104 | +cd chromium/src/cef/ |
| 105 | +git diff --no-prefix --relative > cef.gyp.patch |
| 106 | +``` |
| 107 | + |
| 108 | +Apply a patch in current directory: |
| 109 | +``` |
| 110 | +cd chromium/src/cef/ |
| 111 | +git apply cef.gyp.patch |
| 112 | +``` |
| 113 | + |
| 114 | + |
| 115 | +## Ninja build slows down computer |
| 116 | + |
| 117 | +If ninja slows down your computer too much (6 parallel jobs by default), |
| 118 | +build manually with this command (where -j2 means to run 2 jobs in parallel): |
| 119 | +``` |
| 120 | +cd chromium/src |
| 121 | +ninja -v -j2 -Cout\Release cefclient |
| 122 | +``` |
0 commit comments