adding-packages-waf.txt 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. === Infrastructure for Waf-based packages
  4. [[waf-package-tutorial]]
  5. ==== +waf-package+ tutorial
  6. First, let's see how to write a +.mk+ file for a Waf-based package, with
  7. an example :
  8. ------------------------
  9. 01: ################################################################################
  10. 02: #
  11. 03: # libfoo
  12. 04: #
  13. 05: ################################################################################
  14. 06:
  15. 07: LIBFOO_VERSION = 1.0
  16. 08: LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz
  17. 09: LIBFOO_SITE = http://www.foosoftware.org/download
  18. 10: LIBFOO_CONF_OPTS = --enable-bar --disable-baz
  19. 11: LIBFOO_DEPENDENCIES = bar
  20. 12:
  21. 13: $(eval $(waf-package))
  22. ------------------------
  23. On line 7, we declare the version of the package.
  24. On line 8 and 9, we declare the name of the tarball (xz-ed tarball
  25. recommended) and the location of the tarball on the Web. Buildroot
  26. will automatically download the tarball from this location.
  27. On line 10, we tell Buildroot what options to enable for libfoo.
  28. On line 11, we tell Buildroot the dependencies of libfoo.
  29. Finally, on line line 13, we invoke the +waf-package+
  30. macro that generates all the Makefile rules that actually allows the
  31. package to be built.
  32. [[waf-package-reference]]
  33. ==== +waf-package+ reference
  34. The main macro of the Waf package infrastructure is +waf-package+.
  35. It is similar to the +generic-package+ macro.
  36. Just like the generic infrastructure, the Waf infrastructure works
  37. by defining a number of variables before calling the +waf-package+
  38. macro.
  39. First, all the package metadata information variables that exist in
  40. the generic infrastructure also exist in the Waf infrastructure:
  41. +LIBFOO_VERSION+, +LIBFOO_SOURCE+, +LIBFOO_PATCH+, +LIBFOO_SITE+,
  42. +LIBFOO_SUBDIR+, +LIBFOO_DEPENDENCIES+, +LIBFOO_INSTALL_STAGING+,
  43. +LIBFOO_INSTALL_TARGET+.
  44. An additional variable, specific to the Waf infrastructure, can
  45. also be defined.
  46. * +LIBFOO_SUBDIR+ may contain the name of a subdirectory inside the
  47. package that contains the main wscript file. This is useful,
  48. if for example, the main wscript file is not at the root of
  49. the tree extracted by the tarball. If +HOST_LIBFOO_SUBDIR+ is not
  50. specified, it defaults to +LIBFOO_SUBDIR+.
  51. * +LIBFOO_NEEDS_EXTERNAL_WAF+ can be set to +YES+ or +NO+ to tell
  52. Buildroot to use the bundled +waf+ executable. If set to +NO+, the
  53. default, then Buildroot will use the waf executable provided in the
  54. package source tree; if set to +YES+, then Buildroot will download,
  55. install waf as a host tool and use it to build the package.
  56. * +LIBFOO_WAF_OPTS+, to specify additional options to pass to the
  57. +waf+ script at every step of the package build process: configure,
  58. build and installation. By default, empty.
  59. * +LIBFOO_CONF_OPTS+, to specify additional options to pass to the
  60. +waf+ script for the configuration step. By default, empty.
  61. * +LIBFOO_BUILD_OPTS+, to specify additional options to pass to the
  62. +waf+ script during the build step. By default, empty.
  63. * +LIBFOO_INSTALL_STAGING_OPTS+, to specify additional options to pass
  64. to the +waf+ script during the staging installation step. By default,
  65. empty.
  66. * +LIBFOO_INSTALL_TARGET_OPTS+, to specify additional options to pass
  67. to the +waf+ script during the target installation step. By default,
  68. empty.