adding-packages-hooks.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. These variables are 'lists' of variable names containing actions to be
  35. performed at this hook point. This allows several hooks to be
  36. registered at a given hook point. Here is an example:
  37. ----------------------
  38. define LIBFOO_POST_PATCH_FIXUP
  39. action1
  40. action2
  41. endef
  42. LIBFOO_POST_PATCH_HOOKS += LIBFOO_POST_PATCH_FIXUP
  43. ----------------------
  44. [[hooks-rsync]]
  45. ==== Using the +POST_RSYNC+ hook
  46. The +POST_RSYNC+ hook is run only for packages that use a local source,
  47. either through the +local+ site method or the +OVERRIDE_SRCDIR+
  48. mechanism. In this case, package sources are copied using +rsync+ from
  49. the local location into the buildroot build directory. The +rsync+
  50. command does not copy all files from the source directory, though.
  51. Files belonging to a version control system, like the directories
  52. +.git+, +.hg+, etc. are not copied. For most packages this is
  53. sufficient, but a given package can perform additional actions using
  54. the +POST_RSYNC+ hook.
  55. In principle, the hook can contain any command you want. One specific
  56. use case, though, is the intentional copying of the version control
  57. directory using +rsync+. The +rsync+ command you use in the hook can, among
  58. others, use the following variables:
  59. * +$(SRCDIR)+: the path to the overridden source directory
  60. * +$(@D)+: the path to the build directory
  61. ==== Target-finalize hook
  62. Packages may also register hooks in +LIBFOO_TARGET_FINALIZE_HOOKS+.
  63. These hooks are run after all packages are built, but before the
  64. filesystem images are generated. They are seldom used, and your
  65. package probably do not need them.