adding-packages-tips.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. === Tips and tricks
  4. [[package-name-variable-relation]]
  5. ==== Package name, config entry name and makefile variable relationship
  6. In Buildroot, there is some relationship between:
  7. * the _package name_, which is the package directory name (and the
  8. name of the +*.mk+ file);
  9. * the config entry name that is declared in the +Config.in+ file;
  10. * the makefile variable prefix.
  11. It is mandatory to maintain consistency between these elements,
  12. using the following rules:
  13. * the package directory and the +*.mk+ name are the _package name_
  14. itself (e.g.: +package/foo-bar_boo/foo-bar_boo.mk+);
  15. * the _make_ target name is the _package name_ itself (e.g.:
  16. +foo-bar_boo+);
  17. * the config entry is the upper case _package name_ with `.` and `-`
  18. characters substituted with `_`, prefixed with +BR2_PACKAGE_+ (e.g.:
  19. +BR2_PACKAGE_FOO_BAR_BOO+);
  20. * the +*.mk+ file variable prefix is the upper case _package name_
  21. with `.` and `-` characters substituted with `_` (e.g.:
  22. +FOO_BAR_BOO_VERSION+).
  23. [[github-download-url]]
  24. ==== How to add a package from GitHub
  25. Packages on GitHub often don't have a download area with release tarballs.
  26. However, it is possible to download tarballs directly from the repository
  27. on GitHub. As GitHub is known to have changed download mechanisms in the
  28. past, the 'github' helper function should be used as shown below.
  29. ------------------------
  30. FOO_VERSION = v1.0 # tag or full commit ID
  31. FOO_SITE = $(call github,<user>,<package>,$(FOO_VERSION))
  32. ------------------------
  33. .Notes
  34. - The FOO_VERSION can either be a tag or a commit ID.
  35. - The tarball name generated by github matches the default one from
  36. Buildroot (e.g.: +foo-f6fb6654af62045239caed5950bc6c7971965e60.tar.gz+),
  37. so it is not necessary to specify it in the +.mk+ file.
  38. - When using a commit ID as version, you should use the full 40 hex characters.