Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/3] improve virtual package management
@ 2014-03-07 13:22 Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 1/3] manual: add virtual package tutorial Eric Le Bihan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-07 13:22 UTC (permalink / raw)
  To: buildroot

This patch series improves virtual package management by:

- using make control functions in dependency check.
- adding a tutorial to the user manual.

Changes v2 -> v3:
  - rebased on master.
  - removed already converted packages (lua, libegl, ...).
  - converted cryptodev and jpeg (reported by Yann E. Morin).
  - fixed comments on virtual package provider *.mk not being in the correct
    section of tutorial (reported by S. Martin).

Changes v1 -> v2:
  - rebased on master.
  - replaced 'infrastructure' by 'management' as this mechanism does not (yet?)
    provide a "$(eval $(virtual-package))" helper
  - converted code examples to plain sections (suggested by Yann E. Morin).

Best regards,
ELB

Eric Le Bihan (3):
  manual: add virtual package tutorial.
  cryptodev: convert to new virtual package management.
  jpeg: convert to new virtual package management.

 docs/manual/adding-packages-virtual.txt |   97 +++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt         |    2 +
 package/cryptodev/Config.in             |    3 +
 package/cryptodev/cryptodev.mk          |    7 +--
 package/jpeg/Config.in                  |    3 +
 package/jpeg/jpeg.mk                    |    7 +--
 6 files changed, 111 insertions(+), 8 deletions(-)
 create mode 100644 docs/manual/adding-packages-virtual.txt

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 1/3] manual: add virtual package tutorial.
  2014-03-07 13:22 [Buildroot] [PATCH v3 0/3] improve virtual package management Eric Le Bihan
@ 2014-03-07 13:22 ` Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 2/3] cryptodev: convert to new virtual package management Eric Le Bihan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-07 13:22 UTC (permalink / raw)
  To: buildroot

The manual now features a new section with instructions about how to add a
virtual package.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 docs/manual/adding-packages-virtual.txt |   97 +++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt         |    2 +
 2 files changed, 99 insertions(+)
 create mode 100644 docs/manual/adding-packages-virtual.txt

diff --git a/docs/manual/adding-packages-virtual.txt b/docs/manual/adding-packages-virtual.txt
new file mode 100644
index 0000000..d92ab59
--- /dev/null
+++ b/docs/manual/adding-packages-virtual.txt
@@ -0,0 +1,97 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+[[virtual-package-tutorial]]
+
+Virtual package tutorial
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+In Buildroot, a virtual package is a package whose functionalities are
+provided by one or more packages, referred to as 'providers'. The virtual
+package infrastructure is an extensible mechanism allowing the user to choose
+the provider used in the rootfs.
+
+For example, 'OpenGL ES' is an API for 2D and 3D graphics on embedded systems.
+The implementation of this API is different for the 'Allwinner Tech Sunxi' and
+the 'Texas Instruments OMAP35xx' plaftorms. So +libgles+ will be a virtual
+package and +sunxi-mali+ and +ti-gfx+ will be the providers.
+
+In the following example, we will explain how to add a new virtual package
+('something-virtual') and a provider for it ('some-provider').
+
+Virtual package +Config.in+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The +Config.in+ file of virtual package 'something-virtual' should contain:
+
+---------------------------
+01: config BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+02:	bool
+03:
+04: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL
+05:	depends on BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+06:	string
+---------------------------
+
+In this file, we declare two options, +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+ and
++BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+, whose values will be used by the
+providers.
+
+Virtual package +*.mk+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Makefile +package/something-virtual/something-virtual.mk+ should contain:
+
+---------------------------
+01: ################################################################################
+02: #
+03: # something-virtual
+04: #
+05: ################################################################################
+06:
+07: SOMETHING_VIRTUAL_SOURCE =
+08: SOMETHING_VIRTUAL_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL))
+09:
+10: ifeq ($(BR2_PACKAGE_HAS_SOMETHING_VIRTUAL),y)
+11: ifeq ($(SOMETHING_VIRTUAL_DEPENDENCIES),)
+12: $(error No something-virtual implementation selected. Configuration error.)
+13: endif
+14: endif
+15:
+16: $(eval $(generic-package))
+---------------------------
+
+The Makefile is quite small as it will only check if a provider for the
+virtual package has been selected.
+
+Provider +Config.in+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When adding a package as a provider, only the +Config.in+ file requires some
+modifications. The +*.mk+ file should follow the Buildroot infrastructure with
+no change at all.
+
+The +Config.in+ file of the package 'some-provider', which provides the
+functionalities of 'something-virtual', should contain:
+
+---------------------------
+01: config BR2_PACKAGE_SOME_PROVIDER
+02:	bool "some-provider"
+03:	select BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+04:	help
+05:	  This is a comment that explains what some-provider is.
+06:
+07:	  http://foosoftware.org/some-provider/
+08:
+09: if BR2_PACKAGE_SOME_PROVIDER
+10: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL
+11:	default "some-provider"
+12: endif
+---------------------------
+
+On line 3, we select +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+, and on line 11, we
+set the value of +BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+ to the name of the
+provider, but only if it is selected.
+
+Of course, do not forget to add the proper build and runtime dependencies for
+this package!
diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
index 745e33a..dbba930 100644
--- a/docs/manual/adding-packages.txt
+++ b/docs/manual/adding-packages.txt
@@ -24,6 +24,8 @@ include::adding-packages-luarocks.txt[]
 
 include::adding-packages-perl.txt[]
 
+include::adding-packages-virtual.txt[]
+
 include::adding-packages-hooks.txt[]
 
 include::adding-packages-gettext.txt[]
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 2/3] cryptodev: convert to new virtual package management.
  2014-03-07 13:22 [Buildroot] [PATCH v3 0/3] improve virtual package management Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 1/3] manual: add virtual package tutorial Eric Le Bihan
@ 2014-03-07 13:22 ` Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 3/3] jpeg: " Eric Le Bihan
  2014-03-07 16:33 ` [Buildroot] [PATCH v3 0/3] improve " Yann E. MORIN
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-07 13:22 UTC (permalink / raw)
  To: buildroot

The dependency check in 'cryptodev' has been updated to match the new
virtual package management.

Since this package is implemented via a choice rather than the usual
separate-package providers, BR2_PACKAGE_HAS_CRYPTODEV is always defined
when the 'cryptodev' package is selected.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/cryptodev/Config.in    |    3 +++
 package/cryptodev/cryptodev.mk |    7 +++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/package/cryptodev/Config.in b/package/cryptodev/Config.in
index 0780cc7..2407e04 100644
--- a/package/cryptodev/Config.in
+++ b/package/cryptodev/Config.in
@@ -37,6 +37,9 @@ config BR2_PACKAGE_OCF_LINUX
 
 endchoice
 
+config BR2_PACKAGE_HAS_CRYPTODEV
+	def_bool y
+
 config BR2_PACKAGE_PROVIDES_CRYPTODEV
 	string
 	default "cryptodev-linux" if BR2_PACKAGE_CRYPTODEV_LINUX
diff --git a/package/cryptodev/cryptodev.mk b/package/cryptodev/cryptodev.mk
index 11e6f48..08a6f3b 100644
--- a/package/cryptodev/cryptodev.mk
+++ b/package/cryptodev/cryptodev.mk
@@ -7,11 +7,10 @@
 CRYPTODEV_SOURCE =
 CRYPTODEV_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_CRYPTODEV))
 
+ifeq ($(BR2_PACKAGE_HAS_CRYPTODEV),y)
 ifeq ($(CRYPTODEV_DEPENDENCIES),)
-define CRYPTODEV_CONFIGURE_CMDS
-	echo "No CRYPTODEV implementation defined. Configuration error"
-	exit 1
-endef
+$(error No CRYPTODEV implementation defined. Configuration error.)
+endif
 endif
 
 $(eval $(generic-package))
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 3/3] jpeg: convert to new virtual package management.
  2014-03-07 13:22 [Buildroot] [PATCH v3 0/3] improve virtual package management Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 1/3] manual: add virtual package tutorial Eric Le Bihan
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 2/3] cryptodev: convert to new virtual package management Eric Le Bihan
@ 2014-03-07 13:22 ` Eric Le Bihan
  2014-03-07 16:33 ` [Buildroot] [PATCH v3 0/3] improve " Yann E. MORIN
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-07 13:22 UTC (permalink / raw)
  To: buildroot

The dependency check in 'jpeg' has been updated to match the new virtual
package management.

Since this package is implemented via a choice rather than the usual
separate-package providers, BR2_PACKAGE_HAS_JPEG is always defined
when the 'jpeg' package is selected.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/jpeg/Config.in |    3 +++
 package/jpeg/jpeg.mk   |    7 +++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/package/jpeg/Config.in b/package/jpeg/Config.in
index b7cdfeb..3042d24 100644
--- a/package/jpeg/Config.in
+++ b/package/jpeg/Config.in
@@ -30,6 +30,9 @@ config BR2_PACKAGE_JPEG_TURBO
 
 endchoice
 
+config BR2_PACKAGE_HAS_JPEG
+	def_bool y
+
 config BR2_PACKAGE_PROVIDES_JPEG
 	string
 	default "libjpeg"    if BR2_PACKAGE_LIBJPEG
diff --git a/package/jpeg/jpeg.mk b/package/jpeg/jpeg.mk
index 3695bc8..5ddc43f 100644
--- a/package/jpeg/jpeg.mk
+++ b/package/jpeg/jpeg.mk
@@ -7,11 +7,10 @@
 JPEG_SOURCE =
 JPEG_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_JPEG))
 
+ifeq ($(BR2_PACKAGE_HAS_JPEG),y)
 ifeq ($(JPEG_DEPENDENCIES),)
-define JPEG_CONFIGURE_CMDS
-	echo "No JPEG implementation defined. Configuration error"
-	exit 1
-endef
+$(error No JPEG implementation defined. Configuration error.)
+endif
 endif
 
 $(eval $(generic-package))
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 0/3] improve virtual package management
  2014-03-07 13:22 [Buildroot] [PATCH v3 0/3] improve virtual package management Eric Le Bihan
                   ` (2 preceding siblings ...)
  2014-03-07 13:22 ` [Buildroot] [PATCH v3 3/3] jpeg: " Eric Le Bihan
@ 2014-03-07 16:33 ` Yann E. MORIN
  2014-03-10 17:51   ` Eric Le Bihan
  3 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2014-03-07 16:33 UTC (permalink / raw)
  To: buildroot

Eric, All,

On 2014-03-07 14:22 +0100, Eric Le Bihan spake thusly:
> This patch series improves virtual package management by:
> 
> - using make control functions in dependency check.
> - adding a tutorial to the user manual.

I've already integrated most of this in my virtual-package branch, which
has already been posted to the list (at least twice) in the recent past.

So, unless the maintainer-of-the-day disagrees, I think it is better to
rather wait for the virtual-package infra to get in.

Which can be sped up by giving some tested-by, reviewed-by or acked-by
tags to the already-posted patches. ;-)

Thanks for your work on this! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 0/3] improve virtual package management
  2014-03-07 16:33 ` [Buildroot] [PATCH v3 0/3] improve " Yann E. MORIN
@ 2014-03-10 17:51   ` Eric Le Bihan
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-10 17:51 UTC (permalink / raw)
  To: buildroot

Hi!

On Fri, Mar 07, 2014 at 05:33:51PM +0100, Yann E. MORIN wrote:
> Eric, All,
>
> On 2014-03-07 14:22 +0100, Eric Le Bihan spake thusly:
> > This patch series improves virtual package management by:
> >
> > - using make control functions in dependency check.
> > - adding a tutorial to the user manual.
>
> I've already integrated most of this in my virtual-package branch, which
> has already been posted to the list (at least twice) in the recent past.
I had not properly reviewed your patches... Sorry for the noise.

> So, unless the maintainer-of-the-day disagrees, I think it is better to
> rather wait for the virtual-package infra to get in.
Of course!

> Which can be sped up by giving some tested-by, reviewed-by or acked-by
> tags to the already-posted patches. ;-)
I'll give them a shot.

Best regards,
ELB

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-10 17:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 13:22 [Buildroot] [PATCH v3 0/3] improve virtual package management Eric Le Bihan
2014-03-07 13:22 ` [Buildroot] [PATCH v3 1/3] manual: add virtual package tutorial Eric Le Bihan
2014-03-07 13:22 ` [Buildroot] [PATCH v3 2/3] cryptodev: convert to new virtual package management Eric Le Bihan
2014-03-07 13:22 ` [Buildroot] [PATCH v3 3/3] jpeg: " Eric Le Bihan
2014-03-07 16:33 ` [Buildroot] [PATCH v3 0/3] improve " Yann E. MORIN
2014-03-10 17:51   ` Eric Le Bihan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox