adding-packages-hooks.txt 2.3 KB

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