Commit Graph

72 Commits

Author SHA1 Message Date
Fabio Porcedda
d3c1c647ff Makefile: test if "dot" exists in "<pkg>-graph-depends"
To be able to check the "dot" command availability in
"<pkg>-graph-depends" move the check to the "graph-depends-requirements" rule.
Also don't use a subshell for the exit command to be sure that the error
will be returned by the shell.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-22 19:24:33 +02:00
Thomas De Schampheleire
7742d073a4 infra: add comment describing single/double dollar-sign rules
As the rules with respect to variable and function references and the need
for single or double dollar signs are not trivial, add a comment in
pkg-generic.mk describing them.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-14 19:10:01 +02:00
Thomas De Schampheleire
54456cc698 infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.

This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.

In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).

Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
  $(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
  originally it would cause very odd results.

- The output of 'make printvars' is now much more useful. This target shows
  the value of all variables, and the expression that led to that value.
  However, if the expression was coming from an inner-xxx-targets block, and
  was using single dollar signs, it would show in printvars as
    VAR = value (value)
  while if double dollar signs are used, it would effectively look like
    VAR = value (actual expression)
  as is intended.
  This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
  FOO_SITE_METHOD and FOO_MAKE.

The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.

Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-14 19:09:54 +02:00
Yann E. MORIN
9c1d3b6325 package infra: remove duplicates in dependencies list
Currently, we just use what a package declares as its dependencies.

But some packages may declare the same depdency more than once. For
example, php has two options to add SQL support: 'mysql' or 'mysqli',
which are not exclusive. So, php.mk has mysql twice as a dependency.

Although that does not cause any grievance for make, we end up generating
dependency graphs where this duplicate dependency is visible.

Add an intermediary variable which contains the $(sort)-ed list of the
dependencies, thus eliminating any duplicates.

This has the side effect of also sorting the list, which is probably
good for reproducibility anyway.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-08 18:50:35 +02:00
Yann E. MORIN
4cca66f877 graph-depends: add option to pass arbitrary dot options
Kids nowaday seem to prefer a left-to-right drawing rather than the
more conventional and historical top-down drawing.

Rather than multiply the number of environment variables, just add
a single one where the user can pass arbitrary dot options, such as:

    make BR2_GRAPH_DOT_OPTS=-Grankdir=LR graph-depends

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-08 16:43:32 +02:00
Thomas De Schampheleire
4d5bf929a6 infra: permissions/users/device tables: avoid adding empty entries
In pkg-generic.mk, an entry would be added to each of the permissions,
devices and users tables, even if FOO_PERMISSIONS/DEVICES/USERS is empty. In
that last case, the entry would contain only the separator, which is
substituted to '\n' in fs/common.mk.
For configurations with many packages, this would render the build output a
bit odd, containing many \n instances (even though the end result in the
target would of course be the same).

This patch cleans up the build output by only adding to these tables when
the package actually specified contents for them.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Tested-by: Romain Naour <romain.naour@openwide.fr>
Acked-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-28 21:19:45 +02:00
Yann E. MORIN
91169d3346 infra/pkg-virtual: validate only one provider provides an implementation
Currently, it is possible that more than one provider of a virtual package
is selected in the menuconfig.

This leads to autobuild failures, and we do not protect the user from
making a mistake in the configuration. The failure is then hard to
troubleshoot in any case.

We can't use kconfig constructs to prevent this, since kconfig does not
tell how many options did a select on another option.

This change introduces a new variable a provider *must* define to include
all the virtual packages it is an implementation of. Then, when evaluating
the package's rules, we check that the provider is indeed the declared one
for each virtual package it claims to be an implementation of.

This works by taking advantage that when more than one provider is
selected, only one of them will 'win' in setting the _PROVIDES_FOO
option. Thus any provider just has to check it is indeed the declared
provider. If not, it means that one or more other provider is selected.

This gives the opportunity to the user to change its configuration, and
we can match the error message in the autobuilders to skip those failures
(we can skip them instead of reporting them, since they are obviously
configuration errors that should not happen in the first place.)

[Note: kudos to Arnout for suggesting this actual implementation. :-)]

Fixes:
    http://autobuild.buildroot.org/results/285/2851069d6964aa46d26b4aabe7d84e8c0c6c72ce
    http://autobuild.buildroot.net/results/9b7/9b7870354d70e27e42d3d9c1f131ab54706bf20e
    [...]

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-21 00:19:45 +02:00
Yann E. MORIN
287a88286b graph-depends: rename the variable to pass the max depth
There will soon be new options to the graph-depends script, which we
can only sanely pass via environment variables.

Currently, we use such an environment variable to pass the maximum depth
of the dependency graph; the name of that variable is explicit that it
contains just the depth.

However, there has been so far no release of Buildroot which would make
use of that variable, so no user should have come to rely on it.

Rename that variable so it is less specific, and more generic, so it can
be used to pass more options to graph-depends.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-17 23:36:06 +02:00
Maxime Hadjinlian
ac93fabb66 infra: Add PRE_*_HOOKS for every step
Add PRE_*_HOOKS to all the different steps through which a package may go.

This will help avoid using POST_*_HOOKS to do tasks that should be done
in the PRE_*_HOOKS of the next step.
Otherwise, when the user would do a make foo-re<step>, this would not do
what was really intented, the POST_*_HOOK of the preceding step not
being executed.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
[ThomasDS: rebase, add images hooks to manual]
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-08 22:00:47 +02:00
Yann E. MORIN
994fcc4a2b graphs: store and keep intermediate 'dot' program for graph-depends
Currently, graph-depends (and PKG-graph-depends) do not store the
intermediate 'dot' program.

Some users would like to get the dot program to be able to further
customise the generated graphs (eg. modify the layout, colorise some
of the packages...)

So, store the intermediate dot program alongside the generated graph.

Reported-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Maxime Hadjinlian" <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-19 23:50:39 +02:00
Yann E. MORIN
9806bf5a9a Makefile: rename USER_HOOKS_EXTRA_ENV to EXTRA_ENV
This variable contains extra environment variables that we can not export
since they are clashing with some build systems (eg. BUILD_DIR with
u-boot).

So, we may need these variables for uses other than the user's hooks
for instrumentation. For example, we'll use them later on to export
BUILD_DIR to the download helper scripts.

Fix comment, too.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-17 23:07:58 +02:00
Yann E. MORIN
12c5e68ea8 support/graph-depends: add option to limit the depth of the graph
Currently, the complete dependency chain of a package is used to
generate the dependency graph. When this dependency chain is long,
the generated graph becomes almost unreadable.

However, it is often sufficient to get the first few levels of
dependency of a package.

Add a new variable BR2_GRAPH_DEPTH, that the user can set to limit
the depth of the dependency list.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-14 20:56:20 +02:00
Yann E. MORIN
3d37950ec1 support/graph-depends: use argparse to parse argv[]
Currently, we are using a crude, ad-hoc parsing of argv[].
This is a limiting factor to adding new options.

Use argparse instead, and introduce a single argument for now:
  --package, -p PACKAGE

In the (near) future, we'll be able to add more option arguments,
such as depth-limiting for big graphs.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-14 20:56:18 +02:00
Yann E. MORIN
22d05901c3 Makefile: rename non-user-facing variable
Variables should be prefixed with BR_ when they are not user-facing.

As a side effect, the new variable is prettier than the previous one. :-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-14 20:56:17 +02:00
Peter Korsgaard
b108fdcb83 Merge branch 'next'
Conflicts:
	Makefile
	package/dmraid/Config.in
	package/gdb/Config.in.host
	package/linux-headers/linux-headers.mk
	package/python/python.mk
	package/python3/python3.mk
	package/rt-tests/Config.in
	package/sdl/sdl.mk
	package/systemd/systemd-01-fix-getty-unit.patch
	package/systemd/systemd-02-fix-page-size.patch
	package/systemd/systemd-03-uclibc-fix.patch
	package/udev/Config.in
	package/udisks/Config.in
	package/vlc/vlc.mk
	system/Config.in

Quite some merge conflicts, hopefully I didn't screw up anything.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-28 14:30:23 +01:00
Yann E. MORIN
8ae7838c70 graphs: rename user-facing variables
Rename the GRAPH_OUT and GRAPH_ALT variables according to our
recently-agreed naming scheme for user-facing variables:
  - GRAPH_OUT -> BR2_GRAPH_OUT
  - GRAPH_ALT -> BR2_GRAPH_ALT

The documentation part of the rename is handled by Thomas as
part of his manual fixing spree. ;-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-24 22:36:50 +01:00
Fabio Porcedda
069b33a30e package: enable jobserver for recursive make
Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS)
commands to enable jobserver for the sub-make.

Without the '+' prefix GNU make does not detect the sub-make so it
disable the jobserver for the sub-make.

>From GNU make documentation:
Using the MAKE variable has the same effect as using a ‘+’ character
at the beginning of the recipe line.  This special feature is only
enabled if the MAKE variable appears directly in the recipe: it does
not apply if the MAKE variable is referenced through expansion of
another variable. In the latter case you must use the ‘+’ token to get
these special effects.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-14 21:09:54 +01:00
Fabio Porcedda
6c5c08b854 package: add support for top-level parallel make
To be able to use top-level parallel make we must not depend in a rule
on the order of evaluation of the prerequisites, so instead of relying
on the left to right ordering of evaluation of the prerequisites add
an explicit rule to describe the dependencies.

We cannot use the pattern rules because they must have the same
dependency for every package, but we need to change the dependencies
depending on $(2)_OVERRIDE_SRCDIR variable value, so we must use a
more flexible way like $(2)_TARGET_% variables.

So add explicit dependencies for the following stamp files:
  $(2)_TARGET_EXTRACT
  $(2)_TARGET_PATCH
  $(2)_TARGET_CONFIGURE
  $(2)_TARGET_BUILD
  $(2)_TARGET_INSTALL_STAGING
  $(2)_TARGET_INSTALL_TARGET
  $(2)_TARGET_INSTALL_IMAGES
  $(2)_TARGET_INSTALL_HOST

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-14 21:08:45 +01:00
Fabio Porcedda
b2fd9f90e2 package: add toolchain dependency to every target package
This commit makes the dependency from the target toolchain explicit.
This way we can buid from command line a package that use
inner-generic-package right after the configuration phase, example:

	make clean <package-name>

Also remove TARGETS_ALL because the only purpose was to add toolchain
dependency so it's superseded by this commit.

To prevent circular dependency add the new variable
<pkgname>_ADD_TOOLCHAIN_DEPENDENCY to avoid adding the toolchain
dependency for toolchain packages.

This is also a step forward supporting top-level parallel make.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-14 21:08:35 +01:00
Fabio Porcedda
6f13130ac9 package: add base dependency to every package
Move "dependencies" "dirs" "prepare" dependencies from "toolchain" to
every package.
This way we can build correctly every package right after the clean
stage.
As example with this commit we can build successfully the glibc right
after the clean stage:
	make clean glibc

This is also a step forward supporting top-level parallel make.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-14 21:08:19 +01:00
Thomas De Schampheleire
26aef889f1 infra: remove unused 4th parameter to package infrastructures (pkgparentdir)
The fourth parameter to inner-generic-package is no longer used. Removing
this parameters requires renaming all usages of $(5) to $(4), and updating
the calls to inner-generic-package (and equivalent for the other package
infrastructures).

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-05 12:10:35 +01:00
Thomas De Schampheleire
ac57c640c6 infra: remove usage of 4th parameter to inner-generic-package
In preparation of the removal of the 4th parameter to inner-generic-package
and the pkgparentdir helper function, this patch removes the direct usage of
this 4th parameter. The remaining usage
ifeq ($(4),boot/)
can become
$(filter boot/%,$(pkgdir))
instead (and similar for toolchain).

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-05 12:10:10 +01:00
Thomas De Schampheleire
604d261fb0 infra: remove variable FOO_DIR_PREFIX
Variable FOO_DIR_PREFIX in inner-generic-package isn't really needed. The
contents of this variable are 'package' for normal packages, 'boot' for
bootloaders, and 'linux' for the linux kernel.
When patching a package, all you need to know is the directory where
patches can reside, which is already returned by $(pkgdir). In order to be
able to use this variable outside of inner-generic-package, we introduce a
target-specific variable PKGDIR that equals to this $(pkgdir).

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-05 12:10:00 +01:00
Thomas De Schampheleire
3880a6ab3c infra: remove redundant $(call) on pkgdir, pkgname, pkgparentdir
When calling make 'functions', the $(call) keyword is only needed if the
function takes arguments. For pkgdir, pkgname and pkgparentdir this is not
the case, so we can remove the call to make things more readable.

Suggested-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-05 12:09:35 +01:00
Yann E. MORIN
56eb3944d5 Makefile: support running graph-depends from out-of-tree
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-01-09 21:16:30 +01:00
Yann E. MORIN
f1fedbb246 graphs: support generating png graphs
PDF files can not be easily embedded in other documents (eg. ODT, or HTML).

Add support for generating PNG graphs, by setting the GRAPH_OUT=pdf|png on
the command line:
    make GRAPH_OUT=png graph-build graph-depends

The default is still to generate PDF graphs.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2013-12-29 12:13:25 +01:00
Yann E. MORIN
0cfe3ab88c Makefile: expose 'graph-depends' to generate a graph of the dependency tree
Generate the graph of the complete dependency tree by calling:
    make graph-depends

It's also possible to generate the graph-depends for a single package:
    make PKG-graph-depends

The graphs are generated in $(O)/graphs/

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2013-12-29 12:13:19 +01:00
Ryan Barnett
bc4f79d665 Support for multiple BR2_GLOBAL_PATCH_DIR
Adding support for specifying multiple directories in
BR2_GLOBAL_PATCH_DIR. This will allow for a layered approach for the
patching of a package.

Signed-off-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2013-12-25 17:31:10 +01:00
Peter Korsgaard
9e8015d465 pkg-generic.mk: handle packages under toolchain
E.G. for toolchain-buildroot / toolchain-external. Now these packages are
correctly handled by make source / external-deps.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-12-16 15:58:36 +01:00
Thomas De Schampheleire
47e82829c2 infra: remove package clean commands
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-12-08 19:42:14 +01:00
Thomas De Schampheleire
b64273db75 infra: remove uninstall commands
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-12-06 09:40:24 +01:00
Thomas De Schampheleire
858334c202 legal info: split sources for host and target
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-17 09:15:09 +01:00
Thomas De Schampheleire
366f17f747 legal info: split license texts for host and target
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-17 09:15:04 +01:00
Thomas De Schampheleire
cc4f34ddd4 legal info: split manifest for host and target
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-17 09:14:51 +01:00
Yann E. MORIN
2522fa8ed7 pkg-infra: add user-supplied step-hooks
Allow user to supply their own step-hooks by passing a variable
on the make command-line:
    make BR2_INSTRUMENTATION_SCRIPTS=/path/to/my/script

This can be useful to run site-specific actions at each step of the
build process, such as logging installed, removed or modified files,
do sanity checks on installed files...

It is possible to call more than one script, by passing a space-separated
lists of scripts to call.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-13 00:27:26 +01:00
Yann E. MORIN
17d4eb1e02 pkg-infra: add hook to log timing of steps
The timing information is stored in the file $(O)/build-time.log

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-13 00:26:27 +01:00
Yann E. MORIN
acd394ae0c pkg-infra: introduce pre/post-step hooks
This hooks will let us instrument the build process in many ways:
  - log current step to see what broke
  - time each step to see what is worth optimising
  - sanity-check installed files (rpath, overwritten files...)
  - call user-provided script
  - ...

The steps are coarse-grain, and all have a 'start' and a 'end' hooks.
Here is the list of available steps (8 total):
  - extract
  - patch
  - configure
  - build
  - install-host
  - install-staging
  - install-image
  - install-target

The download, clean and uninstall steps are not instrumented on purpose.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-13 00:25:51 +01:00
Thomas De Schampheleire
003d38da3a legal info: fix saving of host package licenses
Due to some tricky make behavior, the license texts of host packages that
did not provide an explicit HOST_FOO_LICENSE_FILES definition was not saved.
The problem is that it is not straightforward to use a variable
defined/updated inside an evaluated block as input to a foreach statement.
If you try to use $(FOO) then only the original value of FOO is used for
foreach, any update inside the block is ignored. However, if you use
$$(FOO), the entire contents of FOO (typically a list of items) is passed
as one item to foreach, thus causing just one iteration instead of several.

>From Arnout Vandecapelle's explanation:
Any variable referenced with a single $ inside the inner-generic-package
macro is expanded before the resulting contents are eval'ed. Therefore, it
is not possible to refer to variables defined by the inner-generic-package
macro from within a single-$ function call.

To fix the problem, one should defer the evaluation of the entire block
using double dollar signs.

Additionally, a few empty lines have been added to the legal-info-foo block
for clarity.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-12 23:20:37 +01:00
Thomas De Schampheleire
b40341e14a infra: clean up 'Patching' message
The 'Patching' message in the generic infrastructure prints not only the
package name, but also a reference to the assumed package directory, based
on FOO_DIR_PREFIX/FOO_RAWNAME. This doesn't really add value, as the name
of the package is already apparent from the message and its location should
be obvious. Hence, this patch simply reduces the print to "Patching".

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:15:01 +01:00
Thomas De Schampheleire
9e7e9b2150 infra: remove incorrect default for FOO_DIR_PREFIX
Variable FOO_DIR_PREFIX is populated from pkgparentdir by the various
package infrastructures. However, if that would be empty (which in fact is
the case for the linux package), FOO_DIR_PREFIX would be set to
'$(TOP_SRCDIR)/package'.
Not only does this make no sense (LINUX_DIR_PREFIX becomes /package/linux,
and for all other packages pkgparentdir is not-empty anyway), but it is also
using a non-existing variable TOP_SRCDIR.
This patch therefore removes the incorrect default.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:14:36 +01:00
Thomas De Schampheleire
7ad286563e infra: centralize rsync exclude list for VCS files
Buildroot has three places where rsync is used:
1. to copy the target skeleton
2. to copy the rootfs overlay(s)
3. to copy overridden package sources

In all of these cases, we want to exclude version control files by default.
Place 1 and 2 used an identical set of explicit --exclude options, while
place 3 used the option --cvs-exclude. This last option, however, not only
excludes version control files, but also binary files (.o, .so) and any file
or directory named 'core' (a problem for the linux kernel that has several
directories with this name). Moreover, the exact list of excluded files when
using --cvs-exclude depends on the version of rsync.

This patch creates one global variable RSYNC_VCS_EXCLUSIONS that can be used
by the various rsync commands. It excludes the version control files of
svn, git, hg, cvs and bzr.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:10:58 +01:00
Thomas De Schampheleire
e8ab39a7b5 infra: Add POST_RSYNC_HOOKS support
One of the use cases is for the 'local packages' to restore
the SCM info.  Some packages use this information to generate
version info during build time.  In this case, the local package
can have this hook to restore it by symbolic link for example.

[Thomas: update commit title]
Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:10:45 +01:00
Thomas Petazzoni
86e61d2050 package: fix 'local' site method for host packages
Using the 'local' site method works just fine for target
packages. However, for host packages, when HOST_<pkg>_SITE is
automatically defined by the package infrastructure to be equal to
<pkg>_SITE, when defining the <pkg>_OVERRIDE_SRCDIR, the $($(2)_SITE)
is empty, due to a missing additional dollar sign.

This patch ensures that the <pkg>_OVERRIDE_SRCDIR gets the correct
value, regardless of whether the HOST_<pkg>_SITE variable has been
defined by the package itself, or inferred by the package
infrastructure using the <pkg>_SITE value.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reported-by: http://stackoverflow.com/questions/19311747/buildroot-cant-use-local-site-method-for-custom-host-packages
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-10-14 21:58:03 +02:00
Thomas Petazzoni
2c13d5bc60 package: add a <pkg>_EXTRA_DOWNLOADS variable
Converting the external toolchain logic into a package raises a very
special use case that wasn't handled by the package infrastructure:
the Blackfin toolchain is delivered as two tarballs instead of
one. Unfortunately <pkg>_SOURCE only allows to pass one tarball name.

However, we really want both tarballs to be known by the package
infrastructure, so that the normal 'source' and 'external-deps'
mechanism work fine.

In order to achieve this, we add a <pkg>_EXTRA_DOWNLOADS variable,
which allows a package to list other stuff it would like to see
downloaded, but that are otherwise not used by the package
infrastructure itself: it is up to the package to do it by itself.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-10-08 22:58:49 +02:00
Gustavo Zacarias
15eb1fafa3 downloads: add basic CVS support
The support is for pserver mode anonymous CVS.
source-check is based on login since many servers don't support or have
ls/rls disabled.

Usage is pretty straightforward.
PKG_SITE defines the site hostname and remote directory.
The module is defined by the bare package name.
Version is date based.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-13 00:05:43 +02:00
Jérôme Pouiller
3e2d828c0a Add support for plain URL in $(PKG)_PATCH variable
Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball.
This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly
handle them.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-06 23:54:18 +02:00
Thomas De Schampheleire
d1f325f554 xzcat: treat as host prerequisite and build if needed
If xzcat is not present on the host system, buildroot bails out early asking
the developer to install it (xzcat is now a DL_TOOLS_DEPENDENCY)
Conversely, when BR2_TARGET_ROOTFS_CPIO_XZ is enabled, then host-xz is a
build dependency, and no manual action is required from the developer.

Because the second approach is nicer, also build host-xz when xzcat is not
available, using the host-prerequisite and suitable-host-pkg mechanisms,
already used for tar.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-06 23:30:36 +02:00
Thomas De Schampheleire
f8d89f0510 infra: introduce suitable-extractor helper function
In order to simplify determining the right extractor tool for a given
file type, this patch introduces a make function 'suitable-extractor'.
Its usage is $(call suitable-extractor,filename), and it returns the
path to the suitable extractor.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-06 23:30:27 +02:00
Jérôme Pouiller
7a1aa34235 package: make *-rebuild and *-reconfigure only rebuild the given package
Originally, the <pkg>-rebuild and <pkg>-reconfigure targets were meant
to restart the build of the package from a given step (build for
<pkg>-rebuild and configure for <pkg>-reconfigure) and then re-create
the entire root filesystem.

However, further discussion from the community has shown that this is
not really the desired behavior: we instead want <pkg>-rebuild and
<pkg>-reconfigure to only take care of rebuilding the given package,
and not the entire root filesystem.

People willing to rebuild this package and the root filesystem can do:

       make <pkg>-rebuild all

[Thomas P: rewrite commit log, since it's not fixing a bug, but
instead changing what was an intended behavior. ]

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2013-08-13 12:04:55 +02:00
Thomas De Schampheleire
720ca65ce8 trivial: use geturischeme helper function where possible
pkg-download.mk contains some helper functions to obtain subparts of URLs,
like the URI scheme. In pkg-generic.mk, there is still one opportunity to use
that helper function, instead of hardcoding it.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-07-22 00:12:00 +02:00