1Building the Full SDK
2=====================
3
4*Linux users*: Before you run build_sdk.py (below), you must run::
5
6  GYP_DEFINES=target_arch=arm gclient runhooks
7
8This will install some ARM-specific tools that are necessary to build the SDK.
9
10*Everyone else*:
11
12To build the NaCl SDK, run::
13
14  build_tools/build_sdk.py
15
16This will generate a new SDK in your out directory::
17
18  $CHROME_ROOT/out/pepper_XX
19
20Where "XX" in pepper_XX is the current Chrome release (e.g. pepper_38).
21
22The libraries will be built, but no examples will be built by default. This is
23consistent with the SDK that is shipped to users.
24
25
26Testing the SDK
27===============
28
29To build all examples, you can run the test_sdk.py script::
30
31  build_tools/test_sdk.py
32
33This will build all examples and tests, then run tests. It will take a long
34time. You can run a subset of these "phases" by passing the desired phases as
35arguments to test_sdk::
36
37  build_tools/test_sdk.py build_examples copy_tests build_tests
38
39These are the valid phases:
40
41* `build_examples`: Build all examples, for all configurations and toolchains.
42  (everything in the examples directory)
43* `copy_tests`: Copy all tests to the SDK (everything in the tests directory)
44* `build_tests`: Build all tests, for all configurations and toolchains.
45* `sel_ldr_tests`: Run the sel_ldr tests; these run from the command line, and
46  are much faster that browser tests. They can't test PPAPI, however.
47* `browser_tests`: Run the browser tests. This launches a locally built copy of
48  Chrome and runs all examples and tests for all configurations. It is very
49  slow.
50
51
52Testing a Single Example/Test
53=============================
54
55To test a specific example, you can run the test_projects.py script::
56
57  # Test the core example. This will test all toolchains/configs.
58  build_tools/test_projects.py core
59
60  # Test the graphics_2d example, newlib/Debug only.
61  build_tools/test_projects.py graphics_2d -t newlib -c Debug
62
63This assumes that the example is already built. If not, you can use the `-b`
64flag to build it first::
65
66  build_tools/test_projects.py nacl_io_test -t newlib -c Debug -b
67
68
69Rebuilding the Projects
70=======================
71
72If you have made changes to examples, libraries or tests directory, you can
73copy these new sources to the built SDK by running build_projects.py::
74
75  build_tools/build_projects.py
76
77You can then rebuild the example by running Make::
78
79  cd $CHROME_ROOT/out/pepper_XX
80  cd examples/api/graphics_2d  # e.g. to rebuild the Graphics2D example.
81  make -j8
82
83You can build a specific toolchain/configuration combination::
84
85  make TOOLCHAIN=newlib CONFIG=Debug -j8
86
87The valid toolchains are: `newlib`, `glibc`, `pnacl` and `bionic`.
88The valid configurations are: `Debug` and `Release`.
89
90To run the example::
91
92  # Run the default configuration
93  make run
94
95  # Run the newlib/Debug configuration
96  make TOOLCHAIN=newlib CONFIG=Debug -j8
97
98This will try to find Chrome and launch it. You can specify this manually via
99the CHROME_PATH environment variable::
100
101  CHROME_PATH=/absolute/path/to/google-chrome make run
102
103
104Building Standalone Examples/Tests
105-------------------------------
106
107Building the standalone tests is often more convenient, because they are faster
108to run, and don't require a copy of Chrome. We often use the standalone tests
109first when developing for nacl_io, for example. However, note that most tests
110cannot be built this way.
111
112To build the standalone configuration::
113
114  cd tests/nacl_io_test
115  make STANDALONE=1 TOOLCHAIN=newlib -j8
116
117To run the standalone tests, you must specify an architecture explicitly::
118
119  make STANDALONE=1 TOOLCHAIN=newlib NACL_ARCH=x86_64 -j8 run
120