adding-packages-manual.txt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. Infrastructure for packages with specific build systems
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. By 'packages with specific build systems' we mean all the packages whose build
  6. system is not the standard one, speak 'autotools'. This typically includes
  7. packages whose build system is based on hand-written Makefiles or shell
  8. scripts.
  9. [[manual-package-tutorial]]
  10. ------------------------------
  11. 01: # This file is part of the OpenADK project. OpenADK is copyrighted
  12. 02: # material, please see the LICENCE file in the top-level directory.
  13. 03:
  14. 04: include $(ADK_TOPDIR)/rules.mk
  15. 05:
  16. 06: PKG_NAME:= libfoo
  17. 07: PKG_VERSION:= 1.0
  18. 08: PKG_RELEASE:= 1
  19. 09: PKG_HASH:= 62333167b79afb0b25a843513288c67b59547acf653e8fbe62ee64e71ebd1587
  20. 10: PKG_DESCR:= foo library
  21. 11: PKG_SECTION:= libs
  22. 12: PKG_BUILDDEP:= libressl
  23. 13: PKG_DEPENDS:= libressl
  24. 14: PKG_URL:= http://www.libfoo.org/
  25. 15: PKG_SITES:= http://download.libfoo.org/
  26. 16:
  27. 17: include $(ADK_TOPDIR)/mk/package.mk
  28. 18:
  29. 19: $(eval $(call PKG_template,LIBFOO,libfoo,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
  30. 20:
  31. 21: CONFIG_STYLE:= manual
  32. 22: BUILD_STYLE:= manual
  33. 23: INSTALL_STYLE:= manual
  34. 24:
  35. 25: do-configure:
  36. 26: ${CP} ./files/config ${WRKBUILD}/.config
  37. 27:
  38. 28: do-build:
  39. 29: ${MAKE} -C ${WRKBUILD} all
  40. 30:
  41. 31: do-install:
  42. 32: ${INSTALL_DIR} ${IDIR_LIBFOO}/usr/lib
  43. 33: ${CP} ${WRKBUILD}/libfoo.so* ${IDIR_LIBFOO}/usr/lib
  44. 34:
  45. 35: include ${ADK_TOPDIR}/mk/pkg-bottom.mk
  46. --------------------------------
  47. The Makefile begins with line 4 with the inclusion of the top level rules.mk
  48. file. After that the Makefile starts on line 6 to 15 with metadata
  49. information: the name of the package (+PKG_NAME+), the version of the package
  50. (+PKG_VERSION+), the release number of the package (+PKG_RELEASE+), which is
  51. used in OpenADK to mark any package updates, the sha256 hash of the source archive
  52. (+PKG_HASH+), the short one line description for the package (+PKG_DESCR+),
  53. the package section for the menu configuration system (+PKG_SECTION+), the
  54. package buildtime dependencies (+PKG_BUILDDEP+), the package runtime
  55. dependencies (+PKG_DEPENDS+), the package homepage (+PKG_URL+) and finally the
  56. internet locations at which the tarball can be downloaded from (+PKG_SITES+).
  57. Normally ${PKG_NAME}-${PKG_VERSION}.tar.gz will be downloaded. You can
  58. override the default via the +DISTFILES+ variable. You can add more then one
  59. archive name in +DISTFILES+ via space separated. If you have no source archive
  60. at all, just use the boolean variable +NO_DISTFILES+ and set it to 1.
  61. On line 17 the +mk/package.mk+ file is included, which contains the PKG_template
  62. function, which is used in line 19.
  63. On line 21 to 23 we define that the configuration step, the building and install
  64. steps are manually provided.
  65. On line 25-26 we implement a manual configuration step of the libfoo package
  66. by copying a manually created config file into the build directory.
  67. On line 28-29 we start the compilation process via make.
  68. On line 31-33 we install the shared library into the package installation
  69. directory, which is used to create the resulting binary package or tar archive
  70. for the target.
  71. On line 35 we include +mk/pkg-bottom.mk+, which includes common functions used
  72. by the package fetching and building process.