blob: c5fc6516e678fc3b5597b9831e93aff3ba7d8031 [file] [log] [blame] [view]
dan sinclair1e27a0e2015-10-16 11:59:22 -04001# PDFium
Tom Sepez20ab0232015-09-22 08:52:52 -07002
3## Prerequisites
4
5Get the chromium depot tools via the instructions at
6http://www.chromium.org/developers/how-tos/install-depot-tools (this provides
dsinclair719a7a72016-05-16 08:11:18 -07007the gclient utility needed below).
Tom Sepez20ab0232015-09-22 08:52:52 -07008
9Also install Python, Subversion, and Git and make sure they're in your path.
10
dsinclairab522f92016-05-04 11:23:52 -070011
weilida4ff182016-10-31 13:19:08 -070012### Windows development
weilie7ca8ba2016-04-29 12:04:30 -070013
14PDFium uses a similar Windows toolchain as Chromium:
15
16#### Open source contributors
17Visual Studio 2015 Update 2 or later is highly recommended.
18
19Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your global
20environment.
21
22Compilation is done through ninja, **not** Visual Studio.
23
weilida4ff182016-10-31 13:19:08 -070024### CPU Architectures supported
25
26The default architecture for Windows, Linux, and Mac is "`x64`". On Windows,
27"`x86`" is also supported. GN parameter "`target_cpu = "x86"`" can be used to
28override the default value. If you specify Android build, the default CPU
29architecture will be "`arm`".
30
dsinclairab522f92016-05-04 11:23:52 -070031
weilie7ca8ba2016-04-29 12:04:30 -070032#### Google employees
33
34Run: `download_from_google_storage --config` and follow the
35authentication instructions. **Note that you must authenticate with your
36@google.com credentials**. Enter "0" if asked for a project-id.
37
38Once you've done this, the toolchain will be installed automatically for
39you in [the step](#GenBuild) below.
40
41The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg
42can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`.
43
44If you want the IDE for debugging and editing, you will need to install
45it separately, but this is optional and not needed for building PDFium.
46
47
Tom Sepez20ab0232015-09-22 08:52:52 -070048## Get the code
49
Oliver Chang5a21e142015-10-21 15:19:20 -070050The name of the top-level directory does not matter. In our examples, we use
51"repo". This directory must not have been used before by `gclient config` as
52each directory can only house a single gclient configuration.
53
Tom Sepez20ab0232015-09-22 08:52:52 -070054```
Oliver Chang5a21e142015-10-21 15:19:20 -070055mkdir repo
56cd repo
57gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git
Tom Sepez20ab0232015-09-22 08:52:52 -070058gclient sync
Oliver Chang5a21e142015-10-21 15:19:20 -070059cd pdfium
Tom Sepez20ab0232015-09-22 08:52:52 -070060```
61
weilie7ca8ba2016-04-29 12:04:30 -070062##<a name="GenBuild"></a> Generate the build files
Tom Sepez20ab0232015-09-22 08:52:52 -070063
dsinclairab522f92016-05-04 11:23:52 -070064We use GN to generate the build files and
65[Ninja](http://martine.github.io/ninja/) (also included with the depot\_tools
66checkout) to execute the build files.
Tom Sepez20ab0232015-09-22 08:52:52 -070067
dsinclairab522f92016-05-04 11:23:52 -070068```
69gn gen <directory>
70```
Tom Sepez20ab0232015-09-22 08:52:52 -070071
weilida4ff182016-10-31 13:19:08 -070072### Selecting build configuration
Tom Sepezd43654a2016-02-04 15:36:13 -080073
74PDFium may be built either with or without JavaScript support, and with
75or without XFA forms support. Both of these features are enabled by
76default. Also note that the XFA feature requires JavaScript.
77
dsinclairab522f92016-05-04 11:23:52 -070078Configuration is done by executing `gn args <directory>` to configure the build.
dsinclair719a7a72016-05-16 08:11:18 -070079This will launch an editor in which you can set the following arguments.
Oliver Chang14591ce2015-11-03 13:12:46 -080080
81```
dsinclairab522f92016-05-04 11:23:52 -070082use_goma = true # Googlers only.
83is_debug = true # Enable debugging features.
84
85pdf_use_skia = false # Set true to enable experimental skia backend.
caryclarkaf177fe2016-11-16 10:10:03 -080086pdf_use_skia_paths = false # Set true to enable experimental skia backend (paths only).
dsinclairab522f92016-05-04 11:23:52 -070087
thestig543651f2016-09-01 07:11:45 -070088pdf_enable_xfa = true # Set false to remove XFA support (implies JS support).
dsinclairab522f92016-05-04 11:23:52 -070089pdf_enable_v8 = true # Set false to remove Javascript support.
90pdf_is_standalone = true # Set for a non-embedded build.
npm21ce1a62016-08-31 07:53:08 -070091is_component_build = false # Disable component build (must be false)
dsinclairab522f92016-05-04 11:23:52 -070092
thestig543651f2016-09-01 07:11:45 -070093clang_use_chrome_plugins = false # Currently must be false.
94use_sysroot = false # Currently must be false on Linux.
Oliver Chang14591ce2015-11-03 13:12:46 -080095```
96
dsinclair719a7a72016-05-16 08:11:18 -070097Note, you must set `pdf_is_standalone = true` if you want the sample
98applications like `pdfium_test` to build.
99
dsinclairab522f92016-05-04 11:23:52 -0700100When complete the arguments will be stored in `<directory>/args.gn`.
101
Tom Sepez20ab0232015-09-22 08:52:52 -0700102## Building the code
103
dsinclairab522f92016-05-04 11:23:52 -0700104If you used Ninja, you can build the sample program by:
105`ninja -C <directory>/pdfium_test` You can build the entire product (which
106includes a few unit tests) by: `ninja -C <directory>`.
Tom Sepez20ab0232015-09-22 08:52:52 -0700107
Tom Sepez20ab0232015-09-22 08:52:52 -0700108
109## Running the sample program
110
111The pdfium\_test program supports reading, parsing, and rasterizing the pages of
dan sinclair1e27a0e2015-10-16 11:59:22 -0400112a .pdf file to .ppm or .png output image files (windows supports two other
dsinclairab522f92016-05-04 11:23:52 -0700113formats). For example: `<directory>/pdfium_test --ppm path/to/myfile.pdf`. Note
dan sinclair1e27a0e2015-10-16 11:59:22 -0400114that this will write output images to `path/to/myfile.pdf.<n>.ppm`.
115
116## Testing
117
118There are currently several test suites that can be run:
119
120 * pdfium\_unittests
121 * pdfium\_embeddertests
122 * testing/tools/run\_corpus\_tests.py
123 * testing/tools/run\_javascript\_tests.py
124 * testing/tools/run\_pixel\_tests.py
125
126It is possible the tests in the `testing` directory can fail due to font
127differences on the various platforms. These tests are reliable on the bots. If
128you see failures, it can be a good idea to run the tests on the tip-of-tree
129checkout to see if the same failures appear.
Tom Sepez20ab0232015-09-22 08:52:52 -0700130
131## Waterfall
132
133The current health of the source tree can be found at
134http://build.chromium.org/p/client.pdfium/console
135
dan sinclair1e27a0e2015-10-16 11:59:22 -0400136## Community
137
138There are several mailing lists that are setup:
139
140 * [PDFium](https://groups.google.com/forum/#!forum/pdfium)
141 * [PDFium Reviews](https://groups.google.com/forum/#!forum/pdfium-reviews)
142 * [PDFium Bugs](https://groups.google.com/forum/#!forum/pdfium-bugs)
143
144Note, the Reviews and Bugs lists are typically read-only.
145
146## Bugs
147
dsinclairab522f92016-05-04 11:23:52 -0700148 We use this
dan sinclair1e27a0e2015-10-16 11:59:22 -0400149[bug tracker](https://code.google.com/p/pdfium/issues/list), but for security
150bugs, please use [Chromium's security bug template]
151(https://code.google.com/p/chromium/issues/entry?template=Security%20Bug)
152and add the "Cr-Internals-Plugins-PDF" label.
153
154## Contributing code
155
156For contributing code, we will follow
157[Chromium's process](http://dev.chromium.org/developers/contributing-code)
tandriia5608062016-03-24 13:11:53 -0700158as much as possible. The main exceptions is:
dan sinclair1e27a0e2015-10-16 11:59:22 -0400159
1601. Code has to conform to the existing style and not Chromium/Google style.
dan sinclair1e27a0e2015-10-16 11:59:22 -0400161