@btc-vision/bitcoin 6.4.10 → 6.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/.babelrc +13 -4
  2. package/.mocharc.json +13 -13
  3. package/.prettierrc.json +12 -12
  4. package/CHANGELOG.md +403 -403
  5. package/CONTRIBUTING.md +83 -83
  6. package/LICENSE +21 -21
  7. package/README.md +201 -201
  8. package/browser/chunks/crypto-C6FlKKmp.js +2006 -0
  9. package/browser/chunks/payments-BE4vwHhV.js +1045 -0
  10. package/browser/chunks/psbt-Dlosf9CT.js +3853 -0
  11. package/browser/chunks/script-COWGdiOo.js +318 -0
  12. package/browser/chunks/transaction-BiXwH2v4.js +421 -0
  13. package/browser/chunks/utils-BKmkTzNZ.js +759 -0
  14. package/browser/crypto/crypto.d.ts +1 -1
  15. package/browser/index.d.ts +7 -27
  16. package/browser/index.js +92 -2
  17. package/build/index.d.ts +7 -27
  18. package/build/index.js +2 -2
  19. package/cjs/package.json +3 -3
  20. package/gulpfile.js +42 -42
  21. package/package.json +153 -150
  22. package/src/bip66.ts +107 -107
  23. package/src/block.ts +233 -233
  24. package/src/bufferutils.ts +188 -188
  25. package/src/crypto.ts +108 -108
  26. package/src/ecc_lib.ts +94 -94
  27. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  28. package/src/hooks/SignatureManager.ts +84 -84
  29. package/src/index.ts +83 -105
  30. package/src/merkle.ts +31 -31
  31. package/src/opcodes.ts +280 -280
  32. package/src/payments/bip341.ts +140 -140
  33. package/src/payments/embed.ts +61 -61
  34. package/src/payments/index.ts +172 -172
  35. package/src/payments/lazy.ts +28 -28
  36. package/src/payments/p2ms.ts +156 -156
  37. package/src/payments/p2op.ts +195 -195
  38. package/src/payments/p2pk.ts +93 -93
  39. package/src/payments/p2pkh.ts +214 -214
  40. package/src/payments/p2tr.ts +309 -309
  41. package/src/psbt/bip371.ts +441 -441
  42. package/src/push_data.ts +97 -97
  43. package/src/script.ts +247 -247
  44. package/src/script_number.ts +72 -72
  45. package/src/script_signature.ts +91 -91
  46. package/src/transaction.ts +656 -656
  47. package/test/address.spec.ts +155 -155
  48. package/test/bitcoin.core.spec.ts +212 -212
  49. package/test/block.spec.ts +171 -171
  50. package/test/bufferutils.spec.ts +450 -450
  51. package/test/crypto.spec.ts +49 -49
  52. package/test/fixtures/address.json +329 -329
  53. package/test/fixtures/block.json +148 -148
  54. package/test/fixtures/bufferutils.json +102 -102
  55. package/test/fixtures/core/README.md +26 -26
  56. package/test/fixtures/core/base58_encode_decode.json +50 -50
  57. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  58. package/test/fixtures/core/base58_keys_valid.json +452 -452
  59. package/test/fixtures/core/blocks.json +27 -27
  60. package/test/fixtures/core/sig_canonical.json +7 -7
  61. package/test/fixtures/core/sig_noncanonical.json +33 -33
  62. package/test/fixtures/core/sighash.json +3505 -3505
  63. package/test/fixtures/core/tx_valid.json +2023 -2023
  64. package/test/fixtures/crypto.json +43 -43
  65. package/test/fixtures/ecdsa.json +217 -217
  66. package/test/fixtures/ecpair.json +141 -141
  67. package/test/fixtures/embed.json +108 -108
  68. package/test/fixtures/p2ms.json +434 -434
  69. package/test/fixtures/p2pk.json +179 -179
  70. package/test/fixtures/p2pkh.json +276 -276
  71. package/test/fixtures/p2sh.json +508 -508
  72. package/test/fixtures/p2tr.json +1198 -1198
  73. package/test/fixtures/p2wpkh.json +290 -290
  74. package/test/fixtures/p2wsh.json +489 -489
  75. package/test/fixtures/psbt.json +924 -924
  76. package/test/fixtures/script.json +465 -465
  77. package/test/fixtures/script_number.json +225 -225
  78. package/test/fixtures/signature.json +140 -140
  79. package/test/fixtures/transaction.json +916 -916
  80. package/test/integration/_regtest.ts +6 -6
  81. package/test/integration/addresses.spec.ts +142 -142
  82. package/test/integration/bip32.spec.ts +130 -130
  83. package/test/integration/blocks.spec.ts +28 -28
  84. package/test/integration/cltv.spec.ts +241 -241
  85. package/test/integration/csv.spec.ts +452 -452
  86. package/test/integration/payments.spec.ts +110 -110
  87. package/test/integration/taproot.spec.ts +663 -663
  88. package/test/integration/transactions.spec.ts +668 -668
  89. package/test/payments.spec.ts +114 -114
  90. package/test/payments.utils.ts +165 -165
  91. package/test/psbt.spec.ts +1285 -1285
  92. package/test/script.spec.ts +186 -186
  93. package/test/script_number.spec.ts +26 -26
  94. package/test/script_signature.spec.ts +66 -66
  95. package/test/transaction.spec.ts +337 -337
  96. package/test/ts-node-register.js +7 -7
  97. package/test/tsconfig.json +48 -48
  98. package/test/types.spec.ts +53 -53
  99. package/tsconfig.base.json +27 -27
  100. package/tsconfig.json +19 -19
  101. package/tsconfig.webpack.json +18 -18
  102. package/vite.config.browser.ts +93 -0
  103. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  104. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  105. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  106. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  107. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  108. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  109. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  110. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  111. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  112. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  113. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  114. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  115. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  116. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  198. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  199. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  200. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  201. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  202. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  203. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  204. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  205. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  206. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  207. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  208. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  209. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  210. package/browser/index.js.LICENSE.txt +0 -14
  211. package/browser/ops.d.ts +0 -126
  212. package/build/ops.d.ts +0 -126
  213. package/build/ops.js +0 -127
  214. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  215. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  216. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  217. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  218. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  219. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  220. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -1,965 +0,0 @@
1
- # User Documentation
2
-
3
- ## Introduction
4
-
5
- This document is intended to provide a user-level guide to GYP. The
6
- emphasis here is on how to use GYP to accomplish specific tasks, not on
7
- the complete technical language specification. (For that, see the
8
- [LanguageSpecification](LanguageSpecification.md).)
9
-
10
- The document below starts with some overviews to provide context: an
11
- overview of the structure of a `.gyp` file itself, an overview of a
12
- typical executable-program target in a `.gyp` file, an an overview of a
13
- typical library target in a `.gyp` file.
14
-
15
- After the overviews, there are examples of `gyp` patterns for different
16
- common use cases.
17
-
18
- ## Skeleton of a typical Chromium .gyp file
19
-
20
- Here is the skeleton of a typical `.gyp` file in the Chromium tree:
21
-
22
- ```
23
- {
24
- 'variables': {
25
- .
26
- .
27
- .
28
- },
29
- 'includes': [
30
- '../build/common.gypi',
31
- ],
32
- 'target_defaults': {
33
- .
34
- .
35
- .
36
- },
37
- 'targets': [
38
- {
39
- 'target_name': 'target_1',
40
- .
41
- .
42
- .
43
- },
44
- {
45
- 'target_name': 'target_2',
46
- .
47
- .
48
- .
49
- },
50
- ],
51
- 'conditions': [
52
- ['OS=="linux"', {
53
- 'targets': [
54
- {
55
- 'target_name': 'linux_target_3',
56
- .
57
- .
58
- .
59
- },
60
- ],
61
- }],
62
- ['OS=="win"', {
63
- 'targets': [
64
- {
65
- 'target_name': 'windows_target_4',
66
- .
67
- .
68
- .
69
- },
70
- ],
71
- }, { # OS != "win"
72
- 'targets': [
73
- {
74
- 'target_name': 'non_windows_target_5',
75
- .
76
- .
77
- .
78
- },
79
- }],
80
- ],
81
- }
82
- ```
83
-
84
- The entire file just contains a Python dictionary. (It's actually JSON,
85
- with two small Pythonic deviations: comments are introduced with `#`,
86
- and a `,` (comma)) is legal after the last element in a list or
87
- dictionary.)
88
-
89
- The top-level pieces in the `.gyp` file are as follows:
90
-
91
- `'variables'`: Definitions of variables that can be interpolated and
92
- used in various other parts of the file.
93
-
94
- `'includes'`: A list of of other files that will be included in this
95
- file. By convention, included files have the suffix `.gypi` (gyp
96
- include).
97
-
98
- `'target_defaults'`: Settings that will apply to _all_ of the targets
99
- defined in this `.gyp` file.
100
-
101
- `'targets'`: The list of targets for which this `.gyp` file can
102
- generate builds. Each target is a dictionary that contains settings
103
- describing all the information necessary to build the target.
104
-
105
- `'conditions'`: A list of condition specifications that can modify the
106
- contents of the items in the global dictionary defined by this `.gyp`
107
- file based on the values of different variablwes. As implied by the
108
- above example, the most common use of a `conditions` section in the
109
- top-level dictionary is to add platform-specific targets to the
110
- `targets` list.
111
-
112
- ## Skeleton of a typical executable target in a .gyp file
113
-
114
- The most straightforward target is probably a simple executable program.
115
- Here is an example `executable` target that demonstrates the features
116
- that should cover most simple uses of gyp:
117
-
118
- ```
119
- {
120
- 'targets': [
121
- {
122
- 'target_name': 'foo',
123
- 'type': 'executable',
124
- 'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',
125
- 'dependencies': [
126
- 'xyzzy',
127
- '../bar/bar.gyp:bar',
128
- ],
129
- 'defines': [
130
- 'DEFINE_FOO',
131
- 'DEFINE_A_VALUE=value',
132
- ],
133
- 'include_dirs': [
134
- '..',
135
- ],
136
- 'sources': [
137
- 'file1.cc',
138
- 'file2.cc',
139
- ],
140
- 'conditions': [
141
- ['OS=="linux"', {
142
- 'defines': [
143
- 'LINUX_DEFINE',
144
- ],
145
- 'include_dirs': [
146
- 'include/linux',
147
- ],
148
- }],
149
- ['OS=="win"', {
150
- 'defines': [
151
- 'WINDOWS_SPECIFIC_DEFINE',
152
- ],
153
- }, { # OS != "win",
154
- 'defines': [
155
- 'NON_WINDOWS_DEFINE',
156
- ],
157
- }]
158
- ],
159
- },
160
- ],
161
- }
162
- ```
163
-
164
- The top-level settings in the target include:
165
-
166
- `'target_name'`: The name by which the target should be known, which
167
- should be unique across all `.gyp` files. This name will be used as the
168
- project name in the generated Visual Studio solution, as the target name
169
- in the generated XCode configuration, and as the alias for building this
170
- target from the command line of the generated SCons configuration.
171
-
172
- `'type'`: Set to `executable`, logically enough.
173
-
174
- `'msvs_guid'`: THIS IS ONLY TRANSITIONAL. This is a hard-coded GUID
175
- values that will be used in the generated Visual Studio solution
176
- file(s). This allows us to check in a `chrome.sln` file that
177
- interoperates with gyp-generated project files. Once everything in
178
- Chromium is being generated by gyp, it will no longer be important that
179
- the GUIDs stay constant across invocations, and we'll likely get rid of
180
- these settings,
181
-
182
- `'dependencies'`: This lists other targets that this target depends on.
183
- The gyp-generated files will guarantee that the other targets are built
184
- before this target. Any library targets in the `dependencies` list will
185
- be linked with this target. The various settings (`defines`,
186
- `include_dirs`, etc.) listed in the `direct_dependent_settings` sections
187
- of the targets in this list will be applied to how _this_ target is
188
- built and linked. See the more complete discussion of
189
- `direct_dependent_settings`, below.
190
-
191
- `'defines'`: The C preprocessor definitions that will be passed in on
192
- compilation command lines (using `-D` or `/D` options).
193
-
194
- `'include_dirs'`: The directories in which included header files live.
195
- These will be passed in on compilation command lines (using `-I` or `/I`
196
- options).
197
-
198
- `'sources'`: The source files for this target.
199
-
200
- `'conditions'`: A block of conditions that will be evaluated to update
201
- the different settings in the target dictionary.
202
-
203
- ## Skeleton of a typical library target in a .gyp file
204
-
205
- The vast majority of targets are libraries. Here is an example of a
206
- library target including the additional features that should cover most
207
- needs of libraries:
208
-
209
- ```
210
- {
211
- 'targets': [
212
- {
213
- 'target_name': 'foo',
214
- 'type': '<(library)'
215
- 'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',
216
- 'dependencies': [
217
- 'xyzzy',
218
- '../bar/bar.gyp:bar',
219
- ],
220
- 'defines': [
221
- 'DEFINE_FOO',
222
- 'DEFINE_A_VALUE=value',
223
- ],
224
- 'include_dirs': [
225
- '..',
226
- ],
227
- 'direct_dependent_settings': {
228
- 'defines': [
229
- 'DEFINE_FOO',
230
- 'DEFINE_ADDITIONAL',
231
- ],
232
- 'linkflags': [
233
- ],
234
- },
235
- 'export_dependent_settings': [
236
- '../bar/bar.gyp:bar',
237
- ],
238
- 'sources': [
239
- 'file1.cc',
240
- 'file2.cc',
241
- ],
242
- 'conditions': [
243
- ['OS=="linux"', {
244
- 'defines': [
245
- 'LINUX_DEFINE',
246
- ],
247
- 'include_dirs': [
248
- 'include/linux',
249
- ],
250
- ],
251
- ['OS=="win"', {
252
- 'defines': [
253
- 'WINDOWS_SPECIFIC_DEFINE',
254
- ],
255
- }, { # OS != "win",
256
- 'defines': [
257
- 'NON_WINDOWS_DEFINE',
258
- ],
259
- }]
260
- ],
261
- ],
262
- }
263
- ```
264
-
265
- The possible entries in a library target are largely the same as those
266
- that can be specified for an executable target (`defines`,
267
- `include_dirs`, etc.). The differences include:
268
-
269
- `'type'`: This should almost always be set to '<(library)', which allows
270
- the user to define at gyp time whether libraries are to be built static
271
- or shared. (On Linux, at least, linking with shared libraries saves
272
- significant link time.) If it's necessary to pin down the type of
273
- library to be built, the `type` can be set explicitly to
274
- `static_library` or `shared_library`.
275
-
276
- `'direct_dependent_settings'`: This defines the settings that will be
277
- applied to other targets that _directly depend_ on this target--that is,
278
- that list _this_ target in their `'dependencies'` setting. This is
279
- where you list the `defines`, `include_dirs`, `cflags` and `linkflags`
280
- that other targets that compile or link against this target need to
281
- build consistently.
282
-
283
- `'export_dependent_settings'`: This lists the targets whose
284
- `direct_dependent_settings` should be "passed on" to other targets that
285
- use (depend on) this target. `TODO: expand on this description.`
286
-
287
- ## Use Cases
288
-
289
- These use cases are intended to cover the most common actions performed
290
- by developers using GYP.
291
-
292
- Note that these examples are _not_ fully-functioning, self-contained
293
- examples (or else they'd be way too long). Each example mostly contains
294
- just the keywords and settings relevant to the example, with perhaps a
295
- few extra keywords for context. The intent is to try to show the
296
- specific pieces you need to pay attention to when doing something.
297
- [NOTE: if practical use shows that these examples are confusing without
298
- additional context, please add what's necessary to clarify things.]
299
-
300
- ### Add new source files
301
-
302
- There are similar but slightly different patterns for adding a
303
- platform-independent source file vs. adding a source file that only
304
- builds on some of the supported platforms.
305
-
306
- #### Add a source file that builds on all platforms
307
-
308
- **Simplest possible case**: You are adding a file(s) that builds on all
309
- platforms.
310
-
311
- Just add the file(s) to the `sources` list of the appropriate dictionary
312
- in the `targets` list:
313
-
314
- ```
315
- {
316
- 'targets': [
317
- {
318
- 'target_name': 'my_target',
319
- 'type': 'executable',
320
- 'sources': [
321
- '../other/file_1.cc',
322
- 'new_file.cc',
323
- 'subdir/file3.cc',
324
- ],
325
- },
326
- ],
327
- },
328
- ```
329
-
330
- File path names are relative to the directory in which the `.gyp` file lives.
331
-
332
- Keep the list sorted alphabetically (unless there's a really, really,
333
- _really_ good reason not to).
334
-
335
- #### Add a platform-specific source file
336
-
337
- ##### Your platform-specific file is named `*_linux.{ext}`, `*_mac.{ext}`, `*_posix.{ext}` or `*_win.{ext}`
338
-
339
- The simplest way to add a platform-specific source file, assuming you're
340
- adding a completely new file and get to name it, is to use one of the
341
- following standard suffixes:
342
-
343
- * `_linux` (e.g. `foo_linux.cc`)
344
- * `_mac` (e.g. `foo_mac.cc`)
345
- * `_posix` (e.g. `foo_posix.cc`)
346
- * `_win` (e.g. `foo_win.cc`)
347
-
348
- Simply add the file to the `sources` list of the appropriate dict within
349
- the `targets` list, like you would any other source file.
350
-
351
- ```
352
- {
353
- 'targets': [
354
- {
355
- 'target_name': 'foo',
356
- 'type': 'executable',
357
- 'sources': [
358
- 'independent.cc',
359
- 'specific_win.cc',
360
- ],
361
- },
362
- ],
363
- },
364
- ```
365
-
366
- The Chromium `.gyp` files all have appropriate `conditions` entries to
367
- filter out the files that aren't appropriate for the current platform.
368
- In the above example, the `specific_win.cc` file will be removed
369
- automatically from the source-list on non-Windows builds.
370
-
371
- ##### Your platform-specific file does not use an already-defined pattern
372
-
373
- If your platform-specific file does not contain a
374
- `*_{linux,mac,posix,win}` substring (or some other pattern that's
375
- already in the `conditions` for the target), and you can't change the
376
- file name, there are two patterns that can be used.
377
-
378
- **Prefererred**: Add the file to the `sources` list of the appropriate
379
- dictionary within the `targets` list. Add an appropriate `conditions`
380
- section to exclude the specific files name:
381
-
382
- ```
383
- {
384
- 'targets': [
385
- {
386
- 'target_name': 'foo',
387
- 'type': 'executable',
388
- 'sources': [
389
- 'linux_specific.cc',
390
- ],
391
- 'conditions': [
392
- ['OS != "linux"', {
393
- 'sources!': [
394
- # Linux-only; exclude on other platforms.
395
- 'linux_specific.cc',
396
- ]
397
- }[,
398
- ],
399
- },
400
- ],
401
- },
402
- ```
403
-
404
- Despite the duplicate listing, the above is generally preferred because
405
- the `sources` list contains a useful global list of all sources on all
406
- platforms with consistent sorting on all platforms.
407
-
408
- **Non-preferred**: In some situations, however, it might make sense to
409
- list a platform-specific file only in a `conditions` section that
410
- specifically _includes_ it in the `sources` list:
411
-
412
- ```
413
- {
414
- 'targets': [
415
- {
416
- 'target_name': 'foo',
417
- 'type': 'executable',
418
- 'sources': [],
419
- ['OS == "linux"', {
420
- 'sources': [
421
- # Only add to sources list on Linux.
422
- 'linux_specific.cc',
423
- ]
424
- }],
425
- },
426
- ],
427
- },
428
- ```
429
-
430
- The above two examples end up generating equivalent builds, with the
431
- small exception that the `sources` lists will list the files in
432
- different orders. (The first example defines explicitly where
433
- `linux_specific.cc` appears in the list--perhaps in in the
434
- middle--whereas the second example will always tack it on to the end of
435
- the list.)
436
-
437
- **Including or excluding files using patterns**: There are more
438
- complicated ways to construct a `sources` list based on patterns. See
439
- `TODO` below.
440
-
441
- ### Add a new executable
442
-
443
- An executable program is probably the most straightforward type of
444
- target, since all it typically needs is a list of source files, some
445
- compiler/linker settings (probably varied by platform), and some library
446
- targets on which it depends and which must be used in the final link.
447
-
448
- #### Add an executable that builds on all platforms
449
-
450
- Add a dictionary defining the new executable target to the `targets`
451
- list in the appropriate `.gyp` file. Example:
452
-
453
- ```
454
- {
455
- 'targets': [
456
- {
457
- 'target_name': 'new_unit_tests',
458
- 'type': 'executable',
459
- 'defines': [
460
- 'FOO',
461
- ],
462
- 'include_dirs': [
463
- '..',
464
- ],
465
- 'dependencies': [
466
- 'other_target_in_this_file',
467
- 'other_gyp2:target_in_other_gyp2',
468
- ],
469
- 'sources': [
470
- 'new_additional_source.cc',
471
- 'new_unit_tests.cc',
472
- ],
473
- },
474
- ],
475
- }
476
- ```
477
-
478
- #### Add a platform-specific executable
479
-
480
- Add a dictionary defining the new executable target to the `targets`
481
- list within an appropriate `conditions` block for the platform. The
482
- `conditions` block should be a sibling to the top-level `targets` list:
483
-
484
- ```
485
- {
486
- 'targets': [
487
- ],
488
- 'conditions': [
489
- ['OS=="win"', {
490
- 'targets': [
491
- {
492
- 'target_name': 'new_unit_tests',
493
- 'type': 'executable',
494
- 'defines': [
495
- 'FOO',
496
- ],
497
- 'include_dirs': [
498
- '..',
499
- ],
500
- 'dependencies': [
501
- 'other_target_in_this_file',
502
- 'other_gyp2:target_in_other_gyp2',
503
- ],
504
- 'sources': [
505
- 'new_additional_source.cc',
506
- 'new_unit_tests.cc',
507
- ],
508
- },
509
- ],
510
- }],
511
- ],
512
- }
513
- ```
514
-
515
- ### Add settings to a target
516
-
517
- There are several different types of settings that can be defined for
518
- any given target.
519
-
520
- #### Add new preprocessor definitions (`-D` or `/D` flags)
521
-
522
- New preprocessor definitions are added by the `defines` setting:
523
-
524
- ```
525
- {
526
- 'targets': [
527
- {
528
- 'target_name': 'existing_target',
529
- 'defines': [
530
- 'FOO',
531
- 'BAR=some_value',
532
- ],
533
- },
534
- ],
535
- },
536
- ```
537
-
538
- These may be specified directly in a target's settings, as in the above
539
- example, or in a `conditions` section.
540
-
541
- #### Add a new include directory (`-I` or `/I` flags)
542
-
543
- New include directories are added by the `include_dirs` setting:
544
-
545
- ```
546
- {
547
- 'targets': [
548
- {
549
- 'target_name': 'existing_target',
550
- 'include_dirs': [
551
- '..',
552
- 'include',
553
- ],
554
- },
555
- ],
556
- },
557
- ```
558
-
559
- These may be specified directly in a target's settings, as in the above
560
- example, or in a `conditions` section.
561
-
562
- #### Add new compiler flags
563
-
564
- Specific compiler flags can be added with the `cflags` setting:
565
-
566
- ```
567
- {
568
- 'targets': [
569
- {
570
- 'target_name': 'existing_target',
571
- 'conditions': [
572
- ['OS=="win"', {
573
- 'cflags': [
574
- '/WX',
575
- ],
576
- }, { # OS != "win"
577
- 'cflags': [
578
- '-Werror',
579
- ],
580
- }],
581
- ],
582
- },
583
- ],
584
- },
585
- ```
586
-
587
- Because these flags will be specific to the actual compiler involved,
588
- they will almost always be only set within a `conditions` section.
589
-
590
- #### Add new linker flags
591
-
592
- Setting linker flags is OS-specific. On linux and most non-mac posix
593
- systems, they can be added with the `ldflags` setting:
594
-
595
- ```
596
- {
597
- 'targets': [
598
- {
599
- 'target_name': 'existing_target',
600
- 'conditions': [
601
- ['OS=="linux"', {
602
- 'ldflags': [
603
- '-pthread',
604
- ],
605
- }],
606
- ],
607
- },
608
- ],
609
- },
610
- ```
611
-
612
- Because these flags will be specific to the actual linker involved,
613
- they will almost always be only set within a `conditions` section.
614
-
615
- On OS X, linker settings are set via `xcode_settings`, on Windows via
616
- `msvs_settings`.
617
-
618
- #### Exclude settings on a platform
619
-
620
- Any given settings keyword (`defines`, `include_dirs`, etc.) has a
621
- corresponding form with a trailing `!` (exclamation point) to remove
622
- values from a setting. One useful example of this is to remove the
623
- Linux `-Werror` flag from the global settings defined in
624
- `build/common.gypi`:
625
-
626
- ```
627
- {
628
- 'targets': [
629
- {
630
- 'target_name': 'third_party_target',
631
- 'conditions': [
632
- ['OS=="linux"', {
633
- 'cflags!': [
634
- '-Werror',
635
- ],
636
- }],
637
- ],
638
- },
639
- ],
640
- },
641
- ```
642
-
643
- ### Cross-compiling
644
-
645
- GYP has some (relatively limited) support for cross-compiling.
646
-
647
- If the variable `GYP_CROSSCOMPILE` or one of the toolchain-related
648
- variables (like `CC_host` or `CC_target`) is set, GYP will think that
649
- you wish to do a cross-compile.
650
-
651
- When cross-compiling, each target can be part of a "host" build, a
652
- "target" build, or both. By default, the target is assumed to be (only)
653
- part of the "target" build. The 'toolsets' property can be set on a
654
- target to change the default.
655
-
656
- A target's dependencies are assumed to match the build type (so, if A
657
- depends on B, by default that means that a target build of A depends on
658
- a target build of B). You can explicitly depend on targets across
659
- toolchains by specifying "#host" or "#target" in the dependencies list.
660
- If GYP is not doing a cross-compile, the "#host" and "#target" will be
661
- stripped as needed, so nothing breaks.
662
-
663
- ### Add a new library
664
-
665
- TODO: write intro
666
-
667
- #### Add a library that builds on all platforms
668
-
669
- Add the a dictionary defining the new library target to the `targets`
670
- list in the appropriate `.gyp` file. Example:
671
-
672
- ```
673
- {
674
- 'targets': [
675
- {
676
- 'target_name': 'new_library',
677
- 'type': '<(library)',
678
- 'defines': [
679
- 'FOO',
680
- 'BAR=some_value',
681
- ],
682
- 'include_dirs': [
683
- '..',
684
- ],
685
- 'dependencies': [
686
- 'other_target_in_this_file',
687
- 'other_gyp2:target_in_other_gyp2',
688
- ],
689
- 'direct_dependent_settings': {
690
- 'include_dirs': '.',
691
- },
692
- 'export_dependent_settings': [
693
- 'other_target_in_this_file',
694
- ],
695
- 'sources': [
696
- 'new_additional_source.cc',
697
- 'new_library.cc',
698
- ],
699
- },
700
- ],
701
- }
702
- ```
703
-
704
- The use of the `<(library)` variable above should be the default `type`
705
- setting for most library targets, as it allows the developer to choose,
706
- at `gyp` time, whether to build with static or shared libraries.
707
- (Building with shared libraries saves a _lot_ of link time on Linux.)
708
-
709
- It may be necessary to build a specific library as a fixed type. Is so,
710
- the `type` field can be hard-wired appropriately. For a static library:
711
-
712
- ```
713
- 'type': 'static_library',
714
- ```
715
-
716
- For a shared library:
717
-
718
- ```
719
- 'type': 'shared_library',
720
- ```
721
-
722
- #### Add a platform-specific library
723
-
724
- Add a dictionary defining the new library target to the `targets` list
725
- within a `conditions` block that's a sibling to the top-level `targets`
726
- list:
727
-
728
- ```
729
- {
730
- 'targets': [
731
- ],
732
- 'conditions': [
733
- ['OS=="win"', {
734
- 'targets': [
735
- {
736
- 'target_name': 'new_library',
737
- 'type': '<(library)',
738
- 'defines': [
739
- 'FOO',
740
- 'BAR=some_value',
741
- ],
742
- 'include_dirs': [
743
- '..',
744
- ],
745
- 'dependencies': [
746
- 'other_target_in_this_file',
747
- 'other_gyp2:target_in_other_gyp2',
748
- ],
749
- 'direct_dependent_settings': {
750
- 'include_dirs': '.',
751
- },
752
- 'export_dependent_settings': [
753
- 'other_target_in_this_file',
754
- ],
755
- 'sources': [
756
- 'new_additional_source.cc',
757
- 'new_library.cc',
758
- ],
759
- },
760
- ],
761
- }],
762
- ],
763
- }
764
- ```
765
-
766
- ### Dependencies between targets
767
-
768
- GYP provides useful primitives for establishing dependencies between
769
- targets, which need to be configured in the following situations.
770
-
771
- #### Linking with another library target
772
-
773
- ```
774
- {
775
- 'targets': [
776
- {
777
- 'target_name': 'foo',
778
- 'dependencies': [
779
- 'libbar',
780
- ],
781
- },
782
- {
783
- 'target_name': 'libbar',
784
- 'type': '<(library)',
785
- 'sources': [
786
- ],
787
- },
788
- ],
789
- }
790
- ```
791
-
792
- Note that if the library target is in a different `.gyp` file, you have
793
- to specify the path to other `.gyp` file, relative to this `.gyp` file's
794
- directory:
795
-
796
- ```
797
- {
798
- 'targets': [
799
- {
800
- 'target_name': 'foo',
801
- 'dependencies': [
802
- '../bar/bar.gyp:libbar',
803
- ],
804
- },
805
- ],
806
- }
807
- ```
808
-
809
- Adding a library often involves updating multiple `.gyp` files, adding
810
- the target to the approprate `.gyp` file (possibly a newly-added `.gyp`
811
- file), and updating targets in the other `.gyp` files that depend on
812
- (link with) the new library.
813
-
814
- #### Compiling with necessary flags for a library target dependency
815
-
816
- We need to build a library (often a third-party library) with specific
817
- preprocessor definitions or command-line flags, and need to ensure that
818
- targets that depend on the library build with the same settings. This
819
- situation is handled by a `direct_dependent_settings` block:
820
-
821
- ```
822
- {
823
- 'targets': [
824
- {
825
- 'target_name': 'foo',
826
- 'type': 'executable',
827
- 'dependencies': [
828
- 'libbar',
829
- ],
830
- },
831
- {
832
- 'target_name': 'libbar',
833
- 'type': '<(library)',
834
- 'defines': [
835
- 'LOCAL_DEFINE_FOR_LIBBAR',
836
- 'DEFINE_TO_USE_LIBBAR',
837
- ],
838
- 'include_dirs': [
839
- '..',
840
- 'include/libbar',
841
- ],
842
- 'direct_dependent_settings': {
843
- 'defines': [
844
- 'DEFINE_TO_USE_LIBBAR',
845
- ],
846
- 'include_dirs': [
847
- 'include/libbar',
848
- ],
849
- },
850
- },
851
- ],
852
- }
853
- ```
854
-
855
- In the above example, the sources of the `foo` executable will be
856
- compiled with the options `-DDEFINE_TO_USE_LIBBAR -Iinclude/libbar`,
857
- because of those settings' being listed in the
858
- `direct_dependent_settings` block.
859
-
860
- Note that these settings will likely need to be replicated in the
861
- settings for the library target itsef, so that the library will build
862
- with the same options. This does not prevent the target from defining
863
- additional options for its "internal" use when compiling its own source
864
- files. (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`
865
- define, and the `..` entry in the `include_dirs` list.)
866
-
867
- #### When a library depends on an additional library at final link time
868
-
869
- ```
870
- {
871
- 'targets': [
872
- {
873
- 'target_name': 'foo',
874
- 'type': 'executable',
875
- 'dependencies': [
876
- 'libbar',
877
- ],
878
- },
879
- {
880
- 'target_name': 'libbar',
881
- 'type': '<(library)',
882
- 'dependencies': [
883
- 'libother'
884
- ],
885
- 'export_dependent_settings': [
886
- 'libother'
887
- ],
888
- },
889
- {
890
- 'target_name': 'libother',
891
- 'type': '<(library)',
892
- 'direct_dependent_settings': {
893
- 'defines': [
894
- 'DEFINE_FOR_LIBOTHER',
895
- ],
896
- 'include_dirs': [
897
- 'include/libother',
898
- ],
899
- },
900
- },
901
- ],
902
- }
903
- ```
904
-
905
- ### Support for Mac OS X bundles
906
-
907
- gyp supports building bundles on OS X (.app, .framework, .bundle, etc).
908
- Here is an example of this:
909
-
910
- ```
911
- {
912
- 'target_name': 'test_app',
913
- 'product_name': 'Test App Gyp',
914
- 'type': 'executable',
915
- 'mac_bundle': 1,
916
- 'sources': [
917
- 'main.m',
918
- 'TestAppAppDelegate.h',
919
- 'TestAppAppDelegate.m',
920
- ],
921
- 'mac_bundle_resources': [
922
- 'TestApp/English.lproj/InfoPlist.strings',
923
- 'TestApp/English.lproj/MainMenu.xib',
924
- ],
925
- 'link_settings': {
926
- 'libraries': [
927
- '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
928
- ],
929
- },
930
- 'xcode_settings': {
931
- 'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist',
932
- },
933
- },
934
- ```
935
-
936
- The `mac_bundle` key tells gyp that this target should be a bundle.
937
- `executable` targets get extension `.app` by default, `shared_library`
938
- targets get `.framework` – but you can change the bundle extensions by
939
- setting `product_extension` if you want. Files listed in
940
- `mac_bundle_resources` will be copied to the bundle's `Resource` folder
941
- of the bundle. You can also set
942
- `process_outputs_as_mac_bundle_resources` to 1 in actions and rules to
943
- let the output of actions and rules be added to that folder (similar to
944
- `process_outputs_as_sources`). If `product_name` is not set, the bundle
945
- will be named after `target_name`as usual.
946
-
947
- ### Move files (refactoring)
948
-
949
- TODO
950
-
951
- ### Custom build steps
952
-
953
- TODO
954
-
955
- #### Adding an explicit build step to generate specific files
956
-
957
- TODO
958
-
959
- #### Adding a rule to handle files with a new suffix
960
-
961
- TODO
962
-
963
- ### Build flavors
964
-
965
- TODO