| OLD | NEW |
| 1 # PDFium | 1 # PDFium |
| 2 | 2 |
| 3 ## News | 3 ## News |
| 4 | 4 |
| 5 As of 2016-02-04, the XFA branch is deprecated. Instead, see | 5 As of 2016-05-04, GN is used to generate build files replacing GYP. GYP |
| 6 [the section on configuration](#BuildConfig) below. | 6 support will remain until it is disabled in Chromium and then will be removed |
| 7 from PDFium. |
| 7 | 8 |
| 8 As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the | 9 As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the |
| 9 default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 | 10 default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 |
| 10 if you need to use the system toolchain. See | 11 if you need to use the system toolchain. See |
| 11 [Windows development subsection](#WinDev) for details. | 12 [Windows development subsection](#WinDev) for details. |
| 12 | 13 |
| 13 | 14 |
| 14 ## Prerequisites | 15 ## Prerequisites |
| 15 | 16 |
| 16 Get the chromium depot tools via the instructions at | 17 Get the chromium depot tools via the instructions at |
| 17 http://www.chromium.org/developers/how-tos/install-depot-tools (this provides | 18 http://www.chromium.org/developers/how-tos/install-depot-tools (this provides |
| 18 the gclient utilty needed below). | 19 the gclient utilty needed below). |
| 19 | 20 |
| 20 Also install Python, Subversion, and Git and make sure they're in your path. | 21 Also install Python, Subversion, and Git and make sure they're in your path. |
| 21 | 22 |
| 23 |
| 22 ###<a name="WinDev"></a> Windows development | 24 ###<a name="WinDev"></a> Windows development |
| 23 | 25 |
| 24 PDFium uses a similar Windows toolchain as Chromium: | 26 PDFium uses a similar Windows toolchain as Chromium: |
| 25 | 27 |
| 26 #### Open source contributors | 28 #### Open source contributors |
| 27 Visual Studio 2015 Update 2 or later is highly recommended. | 29 Visual Studio 2015 Update 2 or later is highly recommended. |
| 28 | 30 |
| 29 Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your global | 31 Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your global |
| 30 environment. | 32 environment. |
| 31 | 33 |
| 32 Compilation is done through ninja, **not** Visual Studio. | 34 Compilation is done through ninja, **not** Visual Studio. |
| 33 | 35 |
| 36 |
| 34 #### Google employees | 37 #### Google employees |
| 35 | 38 |
| 36 Run: `download_from_google_storage --config` and follow the | 39 Run: `download_from_google_storage --config` and follow the |
| 37 authentication instructions. **Note that you must authenticate with your | 40 authentication instructions. **Note that you must authenticate with your |
| 38 @google.com credentials**. Enter "0" if asked for a project-id. | 41 @google.com credentials**. Enter "0" if asked for a project-id. |
| 39 | 42 |
| 40 Once you've done this, the toolchain will be installed automatically for | 43 Once you've done this, the toolchain will be installed automatically for |
| 41 you in [the step](#GenBuild) below. | 44 you in [the step](#GenBuild) below. |
| 42 | 45 |
| 43 The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg | 46 The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 ``` | 59 ``` |
| 57 mkdir repo | 60 mkdir repo |
| 58 cd repo | 61 cd repo |
| 59 gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git | 62 gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git |
| 60 gclient sync | 63 gclient sync |
| 61 cd pdfium | 64 cd pdfium |
| 62 ``` | 65 ``` |
| 63 | 66 |
| 64 ##<a name="GenBuild"></a> Generate the build files | 67 ##<a name="GenBuild"></a> Generate the build files |
| 65 | 68 |
| 66 We use the GYP library to generate the build files. | 69 We use GN to generate the build files and |
| 70 [Ninja](http://martine.github.io/ninja/) (also included with the depot\_tools |
| 71 checkout) to execute the build files. |
| 67 | 72 |
| 68 At this point, you have two options. The first option is to use the [Ninja] | 73 ``` |
| 69 (http://martine.github.io/ninja/) build system (also included with the | 74 gn gen <directory> |
| 70 depot\_tools checkout). This is the default as of mid-September, 2015. | 75 ``` |
| 71 Previously, the second option (platform-specific build files) was the default. | |
| 72 Most PDFium developers use Ninja, as does our [continuous build system] | |
| 73 (http://build.chromium.org/p/client.pdfium/). | |
| 74 | 76 |
| 75 * On Windows: `build_gyp\gyp_pdfium` | 77 If you want to set <directory> to `out/Debug` or `out/Release` you'll need to |
| 76 * For all other platforms: `build_gyp/gyp_pdfium` | 78 export `GYP_PDFIUM_NO_ACTION=1` to stop `gclient sync` from executing GYP |
| 77 | 79 and overwritting your build files. |
| 78 The second option is to generate platform-specific build files, i.e. Makefiles | |
| 79 on Linux, sln files on Windows, and xcodeproj files on Mac. To do so, set the | |
| 80 GYP\_GENERATORS environment variable appropriately (e.g. "make", "msvs", or | |
| 81 "xcode") before running the above command. | |
| 82 | 80 |
| 83 ###<a name="BuildConfig"></a> Selecting build configuration | 81 ###<a name="BuildConfig"></a> Selecting build configuration |
| 84 | 82 |
| 85 PDFium may be built either with or without JavaScript support, and with | 83 PDFium may be built either with or without JavaScript support, and with |
| 86 or without XFA forms support. Both of these features are enabled by | 84 or without XFA forms support. Both of these features are enabled by |
| 87 default. Also note that the XFA feature requires JavaScript. | 85 default. Also note that the XFA feature requires JavaScript. |
| 88 | 86 |
| 89 To build without XFA, set `pdf_enable_xfa=0` before running `gyp_pdfium`. | 87 Configuration is done by executing `gn args <directory>` to configure the build. |
| 90 To build without JavaScript, set `pdf_enable_v8=0 pdf_enable_xfa=0` before | 88 This will lauch an editor in which you can set the following arguments. |
| 91 running `gyp_pdfium`. For example | |
| 92 ``` | |
| 93 GYP_DEFINES='pdf_enable_v8=0 pdf_enable_xfa=0' build_gyp/gyp_pdfium | |
| 94 ``` | |
| 95 gives the smallest possible build configuration. | |
| 96 | |
| 97 ### Using goma (Googlers only) | |
| 98 | |
| 99 If you would like to build using goma, pass `use_goma=1` to `gyp_pdfium`. If | |
| 100 you installed goma in a non-standard location, you will also need to set | |
| 101 `gomadir`. e.g. | |
| 102 | 89 |
| 103 ``` | 90 ``` |
| 104 build_gyp/gyp_pdfium -D use_goma=1 -D gomadir=path/to/goma | 91 use_goma = true # Googlers only. |
| 92 is_debug = true # Enable debugging features. |
| 93 |
| 94 pdf_use_skia = false # Set true to enable experimental skia backend. |
| 95 |
| 96 pdf_enable_xfa = true # Set false to remove XFA support (implies JS support). |
| 97 pdf_enable_v8 = true # Set false to remove Javascript support. |
| 98 pdf_is_standalone = true # Set for a non-embedded build. |
| 99 |
| 100 clang_use_chrome_plugins = false # Currently must be false. |
| 105 ``` | 101 ``` |
| 106 | 102 |
| 103 When complete the arguments will be stored in `<directory>/args.gn`. |
| 104 |
| 107 ## Building the code | 105 ## Building the code |
| 108 | 106 |
| 109 If you used Ninja, you can build the sample program by: `ninja -C out/Debug | 107 If you used Ninja, you can build the sample program by: |
| 110 pdfium_test` You can build the entire product (which includes a few unit | 108 `ninja -C <directory>/pdfium_test` You can build the entire product (which |
| 111 tests) by: `ninja -C out/Debug`. | 109 includes a few unit tests) by: `ninja -C <directory>`. |
| 112 | 110 |
| 113 If you're not using Ninja, then building is platform-specific. | |
| 114 | |
| 115 * On Linux: `make pdfium_test` | |
| 116 * On Mac: `open build_gyp/all.xcodeproj` | |
| 117 * On Windows: open build_gyp\all.sln | |
| 118 | 111 |
| 119 ## Running the sample program | 112 ## Running the sample program |
| 120 | 113 |
| 121 The pdfium\_test program supports reading, parsing, and rasterizing the pages of | 114 The pdfium\_test program supports reading, parsing, and rasterizing the pages of |
| 122 a .pdf file to .ppm or .png output image files (windows supports two other | 115 a .pdf file to .ppm or .png output image files (windows supports two other |
| 123 formats). For example: `out/Debug/pdfium_test --ppm path/to/myfile.pdf`. Note | 116 formats). For example: `<directory>/pdfium_test --ppm path/to/myfile.pdf`. Note |
| 124 that this will write output images to `path/to/myfile.pdf.<n>.ppm`. | 117 that this will write output images to `path/to/myfile.pdf.<n>.ppm`. |
| 125 | 118 |
| 126 ## Testing | 119 ## Testing |
| 127 | 120 |
| 128 There are currently several test suites that can be run: | 121 There are currently several test suites that can be run: |
| 129 | 122 |
| 130 * pdfium\_unittests | 123 * pdfium\_unittests |
| 131 * pdfium\_embeddertests | 124 * pdfium\_embeddertests |
| 132 * testing/tools/run\_corpus\_tests.py | 125 * testing/tools/run\_corpus\_tests.py |
| 133 * testing/tools/run\_javascript\_tests.py | 126 * testing/tools/run\_javascript\_tests.py |
| (...skipping 14 matching lines...) Expand all Loading... |
| 148 There are several mailing lists that are setup: | 141 There are several mailing lists that are setup: |
| 149 | 142 |
| 150 * [PDFium](https://groups.google.com/forum/#!forum/pdfium) | 143 * [PDFium](https://groups.google.com/forum/#!forum/pdfium) |
| 151 * [PDFium Reviews](https://groups.google.com/forum/#!forum/pdfium-reviews) | 144 * [PDFium Reviews](https://groups.google.com/forum/#!forum/pdfium-reviews) |
| 152 * [PDFium Bugs](https://groups.google.com/forum/#!forum/pdfium-bugs) | 145 * [PDFium Bugs](https://groups.google.com/forum/#!forum/pdfium-bugs) |
| 153 | 146 |
| 154 Note, the Reviews and Bugs lists are typically read-only. | 147 Note, the Reviews and Bugs lists are typically read-only. |
| 155 | 148 |
| 156 ## Bugs | 149 ## Bugs |
| 157 | 150 |
| 158 We will be using this | 151 We use this |
| 159 [bug tracker](https://code.google.com/p/pdfium/issues/list), but for security | 152 [bug tracker](https://code.google.com/p/pdfium/issues/list), but for security |
| 160 bugs, please use [Chromium's security bug template] | 153 bugs, please use [Chromium's security bug template] |
| 161 (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) | 154 (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) |
| 162 and add the "Cr-Internals-Plugins-PDF" label. | 155 and add the "Cr-Internals-Plugins-PDF" label. |
| 163 | 156 |
| 164 ## Contributing code | 157 ## Contributing code |
| 165 | 158 |
| 166 For contributing code, we will follow | 159 For contributing code, we will follow |
| 167 [Chromium's process](http://dev.chromium.org/developers/contributing-code) | 160 [Chromium's process](http://dev.chromium.org/developers/contributing-code) |
| 168 as much as possible. The main exceptions is: | 161 as much as possible. The main exceptions is: |
| 169 | 162 |
| 170 1. Code has to conform to the existing style and not Chromium/Google style. | 163 1. Code has to conform to the existing style and not Chromium/Google style. |
| 171 | 164 |
| 172 ## Branches | |
| 173 | |
| 174 Prior to 2016-02-04, there existed an actively developed origin/xfa branch. | |
| 175 The origin/xfa branch is now an evolutionary dead-end. Everything you need | |
| 176 to build either with or without the XFA feature is on origin/master. | |
| 177 | |
| OLD | NEW |