2012-11-11 04:14:42 +01:00
|
|
|
// -*- mode:doc; -*-
|
2013-02-13 13:59:02 +01:00
|
|
|
// vim: set syntax=asciidoc:
|
2012-11-11 04:14:42 +01:00
|
|
|
|
2011-10-10 10:46:39 +02:00
|
|
|
Package directory
|
2012-11-11 04:14:42 +01:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
First of all, create a directory under the +package+ directory for
|
|
|
|
your software, for example +libfoo+.
|
|
|
|
|
|
|
|
Some packages have been grouped by topic in a sub-directory:
|
2012-11-27 12:59:16 +01:00
|
|
|
+multimedia+, +x11r7+, +efl+ and +matchbox+. If your package fits in
|
2011-10-10 10:46:39 +02:00
|
|
|
one of these categories, then create your package directory in these.
|
2012-11-27 12:59:17 +01:00
|
|
|
New subdirectories are discouraged, however.
|
2011-10-10 10:46:39 +02:00
|
|
|
|
2012-03-18 09:54:02 +01:00
|
|
|
|
2011-10-10 10:46:39 +02:00
|
|
|
+Config.in+ file
|
2012-11-27 12:59:20 +01:00
|
|
|
~~~~~~~~~~~~~~~~
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
Then, create a file named +Config.in+. This file will contain the
|
|
|
|
option descriptions related to our +libfoo+ software that will be used
|
2012-03-18 09:54:02 +01:00
|
|
|
and displayed in the configuration tool. It should basically contain:
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
---------------------------
|
|
|
|
config BR2_PACKAGE_LIBFOO
|
|
|
|
bool "libfoo"
|
|
|
|
help
|
|
|
|
This is a comment that explains what libfoo is.
|
|
|
|
|
|
|
|
http://foosoftware.org/libfoo/
|
|
|
|
---------------------------
|
|
|
|
|
2011-11-13 09:54:44 +01:00
|
|
|
The +bool+ line, +help+ line and other meta-informations about the
|
|
|
|
configuration option must be indented with one tab. The help text
|
|
|
|
itself should be indented with one tab and two spaces, and it must
|
|
|
|
mention the upstream URL of the project.
|
|
|
|
|
2012-11-27 12:59:17 +01:00
|
|
|
You can add other sub-options into a +if
|
2011-11-13 09:54:43 +01:00
|
|
|
BR2_PACKAGE_LIBFOO...endif+ statement to configure particular things
|
|
|
|
in your software. You can look at examples in other packages. The
|
|
|
|
syntax of the +Config.in+ file is the same as the one for the kernel
|
|
|
|
Kconfig file. The documentation for this syntax is available at
|
2012-11-27 12:59:17 +01:00
|
|
|
http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[]
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
Finally you have to add your new +libfoo/Config.in+ to
|
|
|
|
+package/Config.in+ (or in a category subdirectory if you decided to
|
|
|
|
put your package in one of the existing categories). The files
|
|
|
|
included there are 'sorted alphabetically' per category and are 'NOT'
|
|
|
|
supposed to contain anything but the 'bare' name of the package.
|
|
|
|
|
|
|
|
--------------------------
|
|
|
|
source "package/libfoo/Config.in"
|
|
|
|
--------------------------
|
|
|
|
|
2012-11-11 04:14:47 +01:00
|
|
|
[[depends-on-vs-select]]
|
2012-11-27 12:59:20 +01:00
|
|
|
Choosing +depends on+ or +select+
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2011-11-13 09:54:45 +01:00
|
|
|
The +Config.in+ file of your package must also ensure that
|
|
|
|
dependencies are enabled. Typically, Buildroot uses the following
|
|
|
|
rules:
|
|
|
|
|
|
|
|
* Use a +select+ type of dependency for dependencies on
|
|
|
|
libraries. These dependencies are generally not obvious and it
|
|
|
|
therefore make sense to have the kconfig system ensure that the
|
|
|
|
dependencies are selected. For example, the _libgtk2_ package uses
|
|
|
|
+select BR2_PACKAGE_LIBGLIB2+ to make sure this library is also
|
|
|
|
enabled.
|
2012-11-11 04:14:47 +01:00
|
|
|
The +select+ keyword express the dependency with a backward
|
|
|
|
semantic.
|
2011-11-13 09:54:45 +01:00
|
|
|
|
|
|
|
* Use a +depends on+ type of dependency when the user really needs to
|
|
|
|
be aware of the dependency. Typically, Buildroot uses this type of
|
2012-11-11 04:14:47 +01:00
|
|
|
dependency for dependencies on toolchain options (target
|
|
|
|
architecture, MMU support, C library, C++ support, large file
|
|
|
|
support, thread support, RPC support, IPV6 support, WCHAR support),
|
2012-11-27 12:59:17 +01:00
|
|
|
or for dependencies on "big" things, such as the X.org system. For
|
|
|
|
dependencies on toolchain options, there should be a +comment+ that
|
|
|
|
is displayed when the option is not
|
2012-11-11 04:14:47 +01:00
|
|
|
enabled, so that the user knows why the package is not available.
|
|
|
|
The +depends on+ keyword express the dependency with a forward
|
|
|
|
semantic.
|
|
|
|
|
|
|
|
.Note
|
|
|
|
The current problem with the _kconfig_ language is that these two
|
|
|
|
dependency semantics are not internally linked. Therefore, it may be
|
|
|
|
possible to select a package, whom one of its dependencies/requirement
|
|
|
|
is not met.
|
2011-11-13 09:54:45 +01:00
|
|
|
|
|
|
|
An example illustrates both the usage of +select+ and +depends on+.
|
|
|
|
|
|
|
|
--------------------------
|
|
|
|
config BR2_PACKAGE_ACL
|
|
|
|
bool "acl"
|
|
|
|
select BR2_PACKAGE_ATTR
|
|
|
|
depends on BR2_LARGEFILE
|
|
|
|
help
|
|
|
|
POSIX Access Control Lists, which are used to define more
|
|
|
|
fine-grained discretionary access rights for files and
|
|
|
|
directories.
|
|
|
|
This package also provides libacl.
|
|
|
|
|
|
|
|
http://savannah.nongnu.org/projects/acl
|
|
|
|
|
|
|
|
comment "acl requires a toolchain with LARGEFILE support"
|
|
|
|
depends on !BR2_LARGEFILE
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
|
2012-03-18 09:54:03 +01:00
|
|
|
Note that these two dependency types are only transitive with the
|
|
|
|
dependencies of the same kind.
|
|
|
|
|
|
|
|
This means, in the following example:
|
|
|
|
|
|
|
|
--------------------------
|
|
|
|
config BR2_PACKAGE_A
|
|
|
|
bool "Package A"
|
|
|
|
|
|
|
|
config BR2_PACKAGE_B
|
|
|
|
bool "Package B"
|
|
|
|
depends on BR2_PACKAGE_A
|
|
|
|
|
|
|
|
config BR2_PACKAGE_C
|
|
|
|
bool "Package C"
|
|
|
|
depends on BR2_PACKAGE_B
|
|
|
|
|
|
|
|
config BR2_PACKAGE_D
|
|
|
|
bool "Package D"
|
|
|
|
select BR2_PACKAGE_B
|
|
|
|
|
|
|
|
config BR2_PACKAGE_E
|
|
|
|
bool "Package E"
|
|
|
|
select BR2_PACKAGE_D
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
* Selecting +Package C+ will be visible if +Package B+ has been
|
|
|
|
selected, which in turn is only visible if +Package A+ has been
|
|
|
|
selected.
|
|
|
|
|
|
|
|
* Selecting +Package E+ will select +Package D+, which will select
|
|
|
|
+Package B+, it will not check for the dependencies of +Package B+,
|
|
|
|
so it will not select +Package A+.
|
|
|
|
|
|
|
|
* Since +Package B+ is selected but +Package A+ is not, this violates
|
|
|
|
the dependency of +Package B+ on +Package A+. Therefore, in such a
|
|
|
|
situation, the transitive dependency has to be added explicitly:
|
|
|
|
|
|
|
|
--------------------------
|
|
|
|
config BR2_PACKAGE_D
|
|
|
|
bool "Package D"
|
|
|
|
select BR2_PACKAGE_B
|
|
|
|
depends on BR2_PACKAGE_A
|
|
|
|
|
|
|
|
config BR2_PACKAGE_E
|
|
|
|
bool "Package E"
|
|
|
|
select BR2_PACKAGE_D
|
|
|
|
depends on BR2_PACKAGE_A
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
Overall, for package library dependencies, +select+ should be
|
|
|
|
preferred.
|
|
|
|
|
2012-11-16 05:54:19 +01:00
|
|
|
Note that such dependencies will ensure that the dependency option
|
2011-11-13 09:54:45 +01:00
|
|
|
is also enabled, but not necessarily built before your package. To do
|
|
|
|
so, the dependency also needs to be expressed in the +.mk+ file of the
|
|
|
|
package.
|
|
|
|
|
2012-11-16 05:54:19 +01:00
|
|
|
Further formatting details: see xref:writing-rules-config-in[the
|
2012-11-27 12:59:17 +01:00
|
|
|
coding style].
|
2012-11-11 04:14:47 +01:00
|
|
|
|
2011-10-10 10:46:39 +02:00
|
|
|
The +.mk+ file
|
2012-11-27 12:59:20 +01:00
|
|
|
~~~~~~~~~~~~~~
|
2013-02-05 08:15:59 +01:00
|
|
|
[[adding-packages-mk]]
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
Finally, here's the hardest part. Create a file named +libfoo.mk+. It
|
|
|
|
describes how the package should be downloaded, configured, built,
|
|
|
|
installed, etc.
|
|
|
|
|
|
|
|
Depending on the package type, the +.mk+ file must be written in a
|
|
|
|
different way, using different infrastructures:
|
|
|
|
|
2011-11-13 09:54:46 +01:00
|
|
|
* *Makefiles for generic packages* (not using autotools or CMake):
|
|
|
|
These are based on an infrastructure similar to the one used for
|
2012-11-16 05:54:19 +01:00
|
|
|
autotools-based packages, but require a little more work from the
|
2011-10-10 10:46:39 +02:00
|
|
|
developer. They specify what should be done for the configuration,
|
|
|
|
compilation, installation and cleanup of the package. This
|
|
|
|
infrastructure must be used for all packages that do not use the
|
|
|
|
autotools as their build system. In the future, other specialized
|
|
|
|
infrastructures might be written for other build systems. We cover
|
2012-07-06 00:06:46 +02:00
|
|
|
them through in a xref:generic-package-tutorial[tutorial] and a
|
|
|
|
xref:generic-package-reference[reference].
|
2011-10-10 10:46:39 +02:00
|
|
|
|
|
|
|
* *Makefiles for autotools-based software* (autoconf, automake, etc.):
|
|
|
|
We provide a dedicated infrastructure for such packages, since
|
|
|
|
autotools is a very common build system. This infrastructure 'must'
|
|
|
|
be used for new packages that rely on the autotools as their build
|
2012-07-06 00:06:46 +02:00
|
|
|
system. We cover them through a xref:autotools-package-tutorial[tutorial]
|
|
|
|
and xref:autotools-package-reference[reference].
|
2011-10-10 10:46:39 +02:00
|
|
|
|
2011-11-13 09:54:46 +01:00
|
|
|
* *Makefiles for cmake-based software*: We provide a dedicated
|
|
|
|
infrastructure for such packages, as CMake is a more and more
|
|
|
|
commonly used build system and has a standardized behaviour. This
|
|
|
|
infrastructure 'must' be used for new packages that rely on
|
2012-07-06 00:06:46 +02:00
|
|
|
CMake. We cover them through a xref:cmake-package-tutorial[tutorial]
|
|
|
|
and xref:cmake-package-reference[reference].
|
2011-11-13 09:54:46 +01:00
|
|
|
|
2012-11-11 04:14:47 +01:00
|
|
|
Further formating details: see xref:writing-rules-mk[the writing
|
|
|
|
rules].
|