xenomai: new package, only mercury for now supported
[openadk.git] / docs / adding-packages-auto.txt
blobb84ce0a9f009a788dd6dc5d0354f47a655137236
1 // -*- mode:doc; -*-
2 // vim: set syntax=asciidoc:
4 Infrastructure for autotools-based packages
5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 [[auto-package-tutorial]]
9 First, let's see how to write a +Makefile+ file for an autotools-based
10 package, with an example:
12 ------------------------
13 01: # This file is part of the OpenADK project. OpenADK is copyrighted
14 02: # material, please see the LICENCE file in the top-level directory.
15 03: 
16 04: include ${ADK_TOPDIR}/rules.mk
17 05:
18 06: PKG_NAME:=          libfoo
19 07: PKG_VERSION:=       1.0
20 08: PKG_RELEASE:=       1
21 09: PKG_HASH:=          62333167b79afb0b25a843513288c67b59547acf653e8fbe62ee64e71ebd1587
22 10: PKG_DESCR:=         foo library
23 11: PKG_SECTION:=       libs
24 12: PKG_BUILDDEP:=      curl
25 13: PKG_DEPENDS:=       libcurl
26 14: PKG_URL:=           http://www.libfoo.org/
27 15: PKG_SITES:=         http://downloads.libfoo.org/
28 16:
29 17: include ${ADK_TOPDIR}/mk/package.mk
30 18:
31 19: $(eval $(call PKG_template,LIBFOO,libfoo,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
32 20:
33 21: libfoo-install:
34 22:     ${INSTALL_DIR} ${IDIR_LIBFOO}/usr/lib
35 23:     ${CP} ${WRKINST}/usr/lib/libfoo.so* ${IDIR_LIBFOO}/usr/lib
36 24:
37 25: include ${ADK_TOPDIR}/mk/pkg-bottom.mk
39 ------------------------
41 The Makefile begins with line 4 with the inclusion of the top level rules.mk
42 file.  After that the Makefile starts on line 6 to 15 with metadata
43 information: the name of the package (+PKG_NAME+), the version of the package
44 (+PKG_VERSION+), the release number of the package (+PKG_RELEASE+), which is
45 used in OpenADK to mark any package updates, the sha256 hash of the source archive
46 (+PKG_HASH+), the short one line description for the package (+PKG_DESCR+),
47 the package section for the menu configuration system (+PKG_SECTION+), the
48 package buildtime dependencies (+PKG_BUILDDEP+), the package runtime
49 dependencies (+PKG_DEPENDS+), the package homepage (+PKG_URL+) and finally the
50 internet locations at which the tarball can be downloaded from (+PKG_SITES+).
51 Normally ${PKG_NAME}-${PKG_VERSION}.tar.gz will be downloaded. You can
52 overwrite the default via the +DISTFILES+ variable. You can add more then one
53 archive name in +DISTFILES+ via space separated. If you have no source archive
54 at all, just use the boolean variable +NO_DISTFILES+ and set it to 1.
56 On line 17 the +mk/package.mk+ file is included, which contains the PKG_template
57 function, which is used in line 19.
59 On line 21-23 we install the shared library into the package installation
60 directory, which is used to create the resulting binary package or tar archive
61 for the target.
63 On line 25 we include +mk/pkg-bottom.mk+, which includes common functions used
64 by the package fetching and building process.
66 With the autotools infrastructure, all the steps required to build
67 and install the packages are already defined, and they generally work
68 well for most autotools-based packages. However, when required, it is
69 still possible to customize what is done in any particular step.
70 By adding a post-operation hook (after extract, patch, configure,
71 build or install). See xref:hooks[] for details.