BUILDING.rst 3.5 KB

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