All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 07/19] manual: add virtual package tutorial
Date: Sun,  2 Mar 2014 17:52:48 +0100	[thread overview]
Message-ID: <ba6d70930d6ea0bfe8b19e6093e53ede5ffa0237.1393778339.git.yann.morin.1998@free.fr> (raw)
In-Reply-To: <cover.1393778339.git.yann.morin.1998@free.fr>

From: "eric.le.bihan.dev@free.fr" <eric.le.bihan.dev@free.fr>

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>
[yann.morin.1998 at free.fr: move down statement about provider's .mk]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
---
 docs/manual/adding-packages-virtual.txt | 99 +++++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt         |  2 +
 2 files changed, 101 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..76f5794
--- /dev/null
+++ b/docs/manual/adding-packages-virtual.txt
@@ -0,0 +1,99 @@
+// -*- 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 management 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').
+
+First, let's create the virtual package.
+
+Virtual package's +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's +*.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's +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.8.3.2

  parent reply	other threads:[~2014-03-02 16:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 16:52 [Buildroot] [PATCH 0/19 v3] Add new virtual-package infrastructure Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 01/19] package/libgles: rename package and the _HAS and _PROVIDES variables Yann E. MORIN
2014-03-02 17:26   ` Samuel Martin
2014-03-02 16:52 ` [Buildroot] [PATCH 02/19] package/libegl: " Yann E. MORIN
2014-03-02 17:27   ` Samuel Martin
2014-03-02 16:52 ` [Buildroot] [PATCH 03/19] package/libopenmax: rename " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 04/19] package/libopenvg: " Yann E. MORIN
2014-03-02 22:39   ` Jerzy Grzegorek
2014-03-02 16:52 ` [Buildroot] [PATCH 05/19] package/luainterpreter: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 06/19] package/lua: rename config options Yann E. MORIN
2014-03-02 16:52 ` Yann E. MORIN [this message]
2014-03-02 16:52 ` [Buildroot] [PATCH 08/19] packages: add infrastructure for virtual packages Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 09/19] manual: update the virtual package section with the new infrastructure Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 10/19] package/powervr: convert to the virtual-package infrastructure Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 11/19] package/opengl-libgles: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 12/19] package/opengl-libegl: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 13/19] package/libopenmax: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 14/19] package/libopenvg: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 15/19] package/luainterpreter: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 16/19] package/jpeg: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 17/19] package/cryptodev: " Yann E. MORIN
2014-03-02 16:52 ` [Buildroot] [PATCH 18/19] virtual-package: fake a version string for virtual packages Yann E. MORIN
2014-03-02 17:29   ` Samuel Martin
2014-03-02 16:53 ` [Buildroot] [PATCH 19/19] FOO: tentative target and host virt packages Yann E. MORIN
2014-03-03 17:19 ` [Buildroot] [PATCH 0/19 v3] Add new virtual-package infrastructure Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba6d70930d6ea0bfe8b19e6093e53ede5ffa0237.1393778339.git.yann.morin.1998@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.