• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/docs/manual/adding-packages-rebar.txt
Yann E. MORINYann E. MORIN committed 0fe05ff3e1612 Jan 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
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:
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.