The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / build / docs / manual / adding-packages-rebar.txt
1 // -*- mode:doc; -*-
2 // vim: set syntax=asciidoc:
3
4 === Infrastructure for rebar-based packages
5
6 [[rebar-package-tutorial]]
7
8 ==== +rebar-package+ tutorial
9
10 First, let's see how to write a +.mk+ file for a rebar-based package,
11 with an example :
12
13 ------------------------------
14 01: ################################################################################
15 02: #
16 03: # erlang-foobar
17 04: #
18 05: ################################################################################
19 06:
20 07: ERLANG_FOOBAR_VERSION = 1.0
21 08: ERLANG_FOOBAR_SOURCE = erlang-foobar-$(ERLANG_FOOBAR_VERSION).tar.xz
22 09: ERLANG_FOOBAR_SITE = http://www.foosoftware.org/download
23 10: ERLANG_FOOBAR_DEPENDENCIES = host-libaaa libbbb
24 11:
25 12: $(eval $(rebar-package))
26 --------------------------------
27
28 On line 7, we declare the version of the package.
29
30 On line 8 and 9, we declare the name of the tarball (xz-ed tarball
31 recommended) and the location of the tarball on the Web. Buildroot
32 will automatically download the tarball from this location.
33
34 On line 10, we declare our dependencies, so that they are built
35 before the build process of our package starts.
36
37 Finally, on line 12, we invoke the +rebar-package+ macro that
38 generates all the Makefile rules that actually allows the package to
39 be built.
40
41 [[rebar-package-reference]]
42
43 ==== +rebar-package+ reference
44
45 The main macro of the +rebar+ package infrastructure is
46 +rebar-package+. It is similar to the +generic-package+ macro. The
47 ability to have host packages is also available, with the
48 +host-rebar-package+ macro.
49
50 Just like the generic infrastructure, the +rebar+ infrastructure works
51 by defining a number of variables before calling the +rebar-package+
52 macro.
53
54 First, all the package metadata information variables that exist in
55 the generic infrastructure also exist in the +rebar+ infrastructure:
56 +ERLANG_FOOBAR_VERSION+, +ERLANG_FOOBAR_SOURCE+,
57 +ERLANG_FOOBAR_PATCH+, +ERLANG_FOOBAR_SITE+,
58 +ERLANG_FOOBAR_SUBDIR+, +ERLANG_FOOBAR_DEPENDENCIES+,
59 +ERLANG_FOOBAR_INSTALL_STAGING+, +ERLANG_FOOBAR_INSTALL_TARGET+,
60 +ERLANG_FOOBAR_LICENSE+ and +ERLANG_FOOBAR_LICENSE_FILES+.
61
62 A few additional variables, specific to the +rebar+ infrastructure,
63 can also be defined. Many of them are only useful in very specific
64 cases, typical packages will therefore only use a few of them.
65
66 * +ERLANG_FOOBAR_USE_AUTOCONF+, to specify that the package uses
67   _autoconf_ at the configuration step.  When a package sets this
68   variable to +YES+, the +autotools+ infrastructure is used.
69 +
70 .Note
71 You can also use some of the variables from the +autotools+
72   infrastructure: +ERLANG_FOOBAR_CONF_ENV+, +ERLANG_FOOBAR_CONF_OPTS+,
73   +ERLANG_FOOBAR_AUTORECONF+, +ERLANG_FOOBAR_AUTORECONF_ENV+ and
74   +ERLANG_FOOBAR_AUTORECONF_OPTS+.
75
76 * +ERLANG_FOOBAR_USE_BUNDLED_REBAR+, to specify that the package has
77   a bundled version of _rebar_ *and* that it shall be used. Valid
78   values are +YES+ or +NO+ (the default).
79 +
80 .Note
81 If the package bundles a _rebar_ utility, but can use the generic
82   one that Buildroot provides, just say +NO+ (i.e., do not specify
83   this variable). Only set if it is mandatory to use the _rebar_
84   utility bundled in this package.
85
86 * +ERLANG_FOOBAR_REBAR_ENV+, to specify additional environment
87   variables to pass to the _rebar_ utility.
88
89 With the rebar infrastructure, all the steps required to build
90 and install the packages are already defined, and they generally work
91 well for most rebar-based packages. However, when required, it is
92 still possible to customize what is done in any particular step:
93
94 * By adding a post-operation hook (after extract, patch, configure,
95   build or install). See xref:hooks[] for details.
96
97 * By overriding one of the steps. For example, even if the rebar
98   infrastructure is used, if the package +.mk+ file defines its
99   own +ERLANG_FOOBAR_BUILD_CMDS+ variable, it will be used instead
100   of the default rebar one. However, using this method should be
101   restricted to very specific cases. Do not use it in the general
102   case.