adding-packages-hooks.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_POST_DOWNLOAD_HOOKS+
  13. * +LIBFOO_POST_EXTRACT_HOOKS+
  14. * +LIBFOO_POST_RSYNC_HOOKS+
  15. * +LIBFOO_PRE_PATCH_HOOKS+
  16. * +LIBFOO_POST_PATCH_HOOKS+
  17. * +LIBFOO_PRE_CONFIGURE_HOOKS+
  18. * +LIBFOO_POST_CONFIGURE_HOOKS+
  19. * +LIBFOO_POST_BUILD_HOOKS+
  20. * +LIBFOO_POST_INSTALL_HOOKS+ (for host packages only)
  21. * +LIBFOO_POST_INSTALL_STAGING_HOOKS+ (for target packages only)
  22. * +LIBFOO_POST_INSTALL_TARGET_HOOKS+ (for target packages only)
  23. * +LIBFOO_POST_LEGAL_INFO_HOOKS+
  24. These variables are 'lists' of variable names containing actions to be
  25. performed at this hook point. This allows several hooks to be
  26. registered at a given hook point. Here is an example:
  27. ----------------------
  28. define LIBFOO_POST_PATCH_FIXUP
  29. action1
  30. action2
  31. endef
  32. LIBFOO_POST_PATCH_HOOKS += LIBFOO_POST_PATCH_FIXUP
  33. ----------------------
  34. ==== Using the +POST_RSYNC+ hook
  35. The +POST_RSYNC+ hook is run only for packages that use a local source,
  36. either through the +local+ site method or the +OVERRIDE_SRCDIR+
  37. mechanism. In this case, package sources are copied using +rsync+ from
  38. the local location into the buildroot build directory. The +rsync+
  39. command does not copy all files from the source directory, though.
  40. Files belonging to a version control system, like the directories
  41. +.git+, +.hg+, etc. are not copied. For most packages this is
  42. sufficient, but a given package can perform additional actions using
  43. the +POST_RSYNC+ hook.
  44. In principle, the hook can contain any command you want. One specific
  45. use case, though, is the intentional copying of the version control
  46. directory using +rsync+. The +rsync+ command you use in the hook can, among
  47. others, use the following variables:
  48. * +$(SRCDIR)+: the path to the overridden source directory
  49. * +$(@D)+: the path to the build directory