// vim: set syntax=asciidoc:
=== Infrastructure for rebar-based packages
[[rebar-package-tutorial]]
==== +rebar-package+ tutorial
First, let's see how to write a +.mk+ file for a rebar-based package,
------------------------------
01: ################################################################################
05: ################################################################################
07: ERLANG_FOOBAR_VERSION = 1.0
08: ERLANG_FOOBAR_SOURCE = erlang-foobar-$(ERLANG_FOOBAR_VERSION).tar.xz
09: ERLANG_FOOBAR_SITE = http://www.foosoftware.org/download
10: ERLANG_FOOBAR_DEPENDENCIES = host-libaaa libbbb
12: $(eval $(rebar-package))
--------------------------------
On line 7, we declare the version of the package.
On line 8 and 9, we declare the name of the tarball (xz-ed tarball
recommended) and the location of the tarball on the Web. Buildroot
will automatically download the tarball from this location.
On line 10, we declare our dependencies, so that they are built
before the build process of our package starts.
Finally, on line 12, we invoke the +rebar-package+ macro that
generates all the Makefile rules that actually allows the package to
[[rebar-package-reference]]
==== +rebar-package+ reference
The main macro of the +rebar+ package infrastructure is
+rebar-package+. It is similar to the +generic-package+ macro. The
ability to have host packages is also available, with the
+host-rebar-package+ macro.
Just like the generic infrastructure, the +rebar+ infrastructure works
by defining a number of variables before calling the +rebar-package+
First, all the package metadata information variables that exist in
the generic infrastructure also exist in the +rebar+ infrastructure:
+ERLANG_FOOBAR_VERSION+, +ERLANG_FOOBAR_SOURCE+,
+ERLANG_FOOBAR_PATCH+, +ERLANG_FOOBAR_SITE+,
+ERLANG_FOOBAR_SUBDIR+, +ERLANG_FOOBAR_DEPENDENCIES+,
+ERLANG_FOOBAR_INSTALL_STAGING+, +ERLANG_FOOBAR_INSTALL_TARGET+,
+ERLANG_FOOBAR_LICENSE+ and +ERLANG_FOOBAR_LICENSE_FILES+.
A few additional variables, specific to the +rebar+ infrastructure,
can also be defined. Many of them are only useful in very specific