2
1

adding-packages-hooks.adoc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[hooks]]
  4. === Hooks available in the various build steps
  5. The generic infrastructure (and as a result also the derived autotools
  6. and cmake infrastructures) allow packages to specify hooks.
  7. These define further actions to perform after existing steps.
  8. Most hooks aren't really useful for generic packages, since the +.mk+
  9. file already has full control over the actions performed in each step
  10. of the package construction.
  11. The following hook points are available:
  12. * +LIBFOO_PRE_DOWNLOAD_HOOKS+
  13. * +LIBFOO_POST_DOWNLOAD_HOOKS+
  14. * +LIBFOO_PRE_EXTRACT_HOOKS+
  15. * +LIBFOO_POST_EXTRACT_HOOKS+
  16. * +LIBFOO_PRE_RSYNC_HOOKS+
  17. * +LIBFOO_POST_RSYNC_HOOKS+
  18. * +LIBFOO_PRE_PATCH_HOOKS+
  19. * +LIBFOO_POST_PATCH_HOOKS+
  20. * +LIBFOO_PRE_CONFIGURE_HOOKS+
  21. * +LIBFOO_POST_CONFIGURE_HOOKS+
  22. * +LIBFOO_PRE_BUILD_HOOKS+
  23. * +LIBFOO_POST_BUILD_HOOKS+
  24. * +LIBFOO_PRE_INSTALL_HOOKS+ (for host packages only)
  25. * +LIBFOO_POST_INSTALL_HOOKS+ (for host packages only)
  26. * +LIBFOO_PRE_INSTALL_STAGING_HOOKS+ (for target packages only)
  27. * +LIBFOO_POST_INSTALL_STAGING_HOOKS+ (for target packages only)
  28. * +LIBFOO_PRE_INSTALL_TARGET_HOOKS+ (for target packages only)
  29. * +LIBFOO_POST_INSTALL_TARGET_HOOKS+ (for target packages only)
  30. * +LIBFOO_PRE_INSTALL_IMAGES_HOOKS+
  31. * +LIBFOO_POST_INSTALL_IMAGES_HOOKS+
  32. * +LIBFOO_PRE_LEGAL_INFO_HOOKS+
  33. * +LIBFOO_POST_LEGAL_INFO_HOOKS+
  34. * +LIBFOO_TARGET_FINALIZE_HOOKS+
  35. These variables are 'lists' of variable names containing actions to be
  36. performed at this hook point. This allows several hooks to be
  37. registered at a given hook point. Here is an example:
  38. ----
  39. define LIBFOO_POST_PATCH_FIXUP
  40. action1
  41. action2
  42. endef
  43. LIBFOO_POST_PATCH_HOOKS += LIBFOO_POST_PATCH_FIXUP
  44. ----
  45. [[hooks-rsync]]
  46. ==== Using the +POST_RSYNC+ hook
  47. The +POST_RSYNC+ hook is run only for packages that use a local source,
  48. either through the +local+ site method or the +OVERRIDE_SRCDIR+
  49. mechanism. In this case, package sources are copied using +rsync+ from
  50. the local location into the buildroot build directory. The +rsync+
  51. command does not copy all files from the source directory, though.
  52. Files belonging to a version control system, like the directories
  53. +.git+, +.hg+, etc. are not copied. For most packages this is
  54. sufficient, but a given package can perform additional actions using
  55. the +POST_RSYNC+ hook.
  56. In principle, the hook can contain any command you want. One specific
  57. use case, though, is the intentional copying of the version control
  58. directory using +rsync+. The +rsync+ command you use in the hook can, among
  59. others, use the following variables:
  60. * +$(SRCDIR)+: the path to the overridden source directory
  61. * +$(@D)+: the path to the build directory
  62. ==== Target-finalize hook
  63. Packages may also register hooks in +LIBFOO_TARGET_FINALIZE_HOOKS+.
  64. These hooks are run after all packages are built, but before the
  65. filesystem images are generated. They are seldom used, and your
  66. package probably do not need them.