adding-packages-host.txt 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. Infrastructure for host packages
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. [[host-package-tutorial]]
  6. First, let's see how to write a +Makefile+ for an host only package, required
  7. by another target package to build, with an example:
  8. ------------------------
  9. 01: # This file is part of the OpenADK project. OpenADK is copyrighted
  10. 02: # material, please see the LICENCE file in the top-level directory.
  11. 03:
  12. 04: include $(TOPDIR)/rules.mk
  13. 05:
  14. 06: PKG_NAME:= hostfoo
  15. 07: PKG_VERSION:= 1.0
  16. 08: PKG_RELEASE:= 1
  17. 09: PKG_MD5SUM:= 291ba57c0acd218da0b0916c280dcbae
  18. 10: PKG_DESCR:= hostfoo utility
  19. 11: PKG_SECTION:= misc
  20. 12: PKG_URL:= http://www.foo.org/
  21. 13: PKG_SITES:= http://download.foo.org/
  22. 14:
  23. 15: PKG_CFLINE_HOSTFOO:= depends on ADK_HOST_ONLY
  24. 16:
  25. 17: include $(TOPDIR)/mk/host.mk
  26. 18: include $(TOPDIR)/mk/package.mk
  27. 19:
  28. 20: $(eval $(call HOST_template,HOSTFOO,hostfoo,$(PKG_VERSION)-${PKG_RELEASE}))
  29. 21:
  30. 22: HOST_STYLE:= auto
  31. 23:
  32. 24: include ${TOPDIR}/mk/host-bottom.mk
  33. 25: include ${TOPDIR}/mk/pkg-bottom.mk
  34. ------------------------
  35. The differences to a target package is the inclusion of +mk/host.mk+ in line 17 and
  36. +mk/host-bottom.mk+ in line 24. Furthermore the HOST_template is called instead of
  37. the PKG_template. The last difference is the usage of +PKG_CFLINE_HOSTFOO+ to mark
  38. the package as host only package.
  39. Following mix between host and target package is possible, too:
  40. ------------------------
  41. 01: # This file is part of the OpenADK project. OpenADK is copyrighted
  42. 02: # material, please see the LICENCE file in the top-level directory.
  43. 03:
  44. 04: include ${TOPDIR}/rules.mk
  45. 05:
  46. 06: PKG_NAME:= foo
  47. 07: PKG_VERSION:= 1.0
  48. 08: PKG_RELEASE:= 1
  49. 09: PKG_MD5SUM:= 032a7b7b9f1a6e278ccde73f82cec5c2
  50. 10: PKG_DESCR:= foo tool
  51. 11: PKG_SECTION:= lang
  52. 12: PKG_BUILDDEP:= foo-host
  53. 13: PKG_URL:= http://www.foo.org/
  54. 14: PKG_SITES:= http://download.foo.org/
  55. 15:
  56. 16: include ${TOPDIR}/mk/host.mk
  57. 17: include ${TOPDIR}/mk/package.mk
  58. 18:
  59. 19: $(eval $(call HOST_template,FOO,foo,${PKG_VERSION}-${PKG_RELEASE}))
  60. 20: $(eval $(call PKG_template,FOO,foo,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
  61. 21:
  62. 22: HOST_STYLE:= auto
  63. 23:
  64. 24: foo-install:
  65. 25: ${INSTALL_DIR} ${IDIR_FOO}/usr/bin
  66. 26: ${INSTALL_BIN} ${WRKINST}/usr/bin/foo ${IDIR_FOO}/usr/bin
  67. 27:
  68. 28: include ${TOPDIR}/mk/host-bottom.mk
  69. 29: include ${TOPDIR}/mk/pkg-bottom.mk
  70. ------------------------
  71. It is important to have foo-host as package build dependency, see line 12, so that the order is always build the host package
  72. and then the target package.
  73. If you need to rebuild a mixed package, you are advised to use:
  74. ------------
  75. $ make package=<package> clean hostpackage package
  76. ------------
  77. At the moment there is one limitation regarding the recursive dependency resolving. It is just not implemented, yet.
  78. So you always need to set +PKG_BUILDDEP+ to all host tools dependencies in the right order. If package foo needs host
  79. tool bar, and host tool bar needs host library libbaz, you have to use following +PKG_BUILDDEP+ variable:
  80. ------------
  81. PKG_BUILDDEP:=libbaz-host bar-host
  82. ------------