summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2014-02-04 13:36:11 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 18:59:00 -0700
commit1e305eca4e87c29c1a1f3a1ef9bc820658838dfe (patch)
treece3d47d7456253128a24fe6c7a706fc2dd31fe17 /bitbake
parentdc42d886ba4232366ee49b0e216efbe97005af08 (diff)
downloadpoky-1e305eca4e87c29c1a1f3a1ef9bc820658838dfe.tar.gz
bitbake: user-manual-metadata.xml: Edits to "Sharing Functionality"
Applied some review edits from Paul to the section. (Bitbake rev: f4dc71a3ff2c7f2ca6093b751883a1244f8d3847) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/doc/user-manual/user-manual-metadata.xml97
1 files changed, 68 insertions, 29 deletions
diff --git a/bitbake/doc/user-manual/user-manual-metadata.xml b/bitbake/doc/user-manual/user-manual-metadata.xml
index d875151443..7c294008c0 100644
--- a/bitbake/doc/user-manual/user-manual-metadata.xml
+++ b/bitbake/doc/user-manual/user-manual-metadata.xml
@@ -488,15 +488,16 @@
488 <title>Sharing Functionality</title> 488 <title>Sharing Functionality</title>
489 489
490 <para> 490 <para>
491 BitBake allows for metadata sharing through include files and 491 BitBake allows for metadata sharing through include files
492 class files (<filename>.bbclass</filename>). 492 (<filename>.inc</filename>) and class files
493 (<filename>.bbclass</filename>).
493 For example, suppose you have a piece of common functionality 494 For example, suppose you have a piece of common functionality
494 such as a task definition that you want to share between 495 such as a task definition that you want to share between
495 more than one recipe. 496 more than one recipe.
496 In this case, creating a <filename>.bbclass</filename> 497 In this case, creating a <filename>.bbclass</filename>
497 file that contains the common functionality and uses the 498 file that contains the common functionality and then using
498 <filename>inherit</filename> directive would be a common 499 the <filename>inherit</filename> directive in your recipes to
499 way to share the task. 500 inherit the class would be a common way to share the task.
500 </para> 501 </para>
501 502
502 <para> 503 <para>
@@ -504,19 +505,24 @@
504 allow you to share functionality between recipes. 505 allow you to share functionality between recipes.
505 Specifically, the mechanisms include <filename>include</filename>, 506 Specifically, the mechanisms include <filename>include</filename>,
506 <filename>inherit</filename>, <filename>INHERIT</filename>, and 507 <filename>inherit</filename>, <filename>INHERIT</filename>, and
507 <filename>require</filename> statements. 508 <filename>require</filename> directives.
508 </para> 509 </para>
509 510
510 <section id='locating-include-and-class-files'> 511 <section id='locating-include-and-class-files'>
511 <title>Locating Include and Class Files</title> 512 <title>Locating Include and Class Files</title>
512 513
513 <para> 514 <para>
514 BitBake uses the <filename>BBPATH</filename> variable 515 BitBake uses the
515 to locate needed class and configuration files. 516 <link linkend='var-BBPATH'><filename>BBPATH</filename></link>
517 variable to locate needed include and class files.
516 The <filename>BBPATH</filename> variable is analogous to 518 The <filename>BBPATH</filename> variable is analogous to
517 the environment variable <filename>PATH</filename>. 519 the environment variable <filename>PATH</filename>.
518 Use of <filename>BBPATH</filename> is specific to the build 520 </para>
519 environment (e.g. Yocto Project, OpenEmbedded, and so forth). 521
522 <para>
523 In order for include and class files to be found by BitBake,
524 they need to be located in a "classes" subdirectory that can
525 be found in <filename>BBPATH</filename>.
520 </para> 526 </para>
521 </section> 527 </section>
522 528
@@ -527,27 +533,36 @@
527 When writing a recipe or class file, you can use the 533 When writing a recipe or class file, you can use the
528 <filename>inherit</filename> directive to inherit the 534 <filename>inherit</filename> directive to inherit the
529 functionality of a class (<filename>.bbclass</filename>). 535 functionality of a class (<filename>.bbclass</filename>).
530 BitBake only supports this directive when used within these 536 BitBake only supports this directive when used within recipe
531 two types of files (i.e. <filename>.bb</filename> and 537 and class files (i.e. <filename>.bb</filename> and
532 <filename>.bbclass</filename> files). 538 <filename>.bbclass</filename>).
533 </para> 539 </para>
534 540
535 <para> 541 <para>
536 The <filename>inherit</filename> directive is a rudimentary 542 The <filename>inherit</filename> directive is a rudimentary
537 means of specifying what classes of functionality your 543 means of specifying what classes of functionality your
538 recipe requires. 544 recipes require.
539 For example, you can easily abstract out the tasks involved in 545 For example, you can easily abstract out the tasks involved in
540 building a package that uses Autoconf and Automake and put 546 building a package that uses Autoconf and Automake and put
541 those tasks into a class file that can be used by your package. 547 those tasks into a class file that can be used by your package.
542 As an example, an <filename>autotools.bbclass</filename> file 548 </para>
543 could use the following directive to inherit needed 549
544 site information: 550 <para>
551 As an example, your recipes could use the following directive
552 to inherit an <filename>autotools.bbclass</filename> file.
553 The class file would contain common functionality for using
554 Autotools that could be shared across recipes:
545 <literallayout class='monospaced'> 555 <literallayout class='monospaced'>
546 inherit siteinfo 556 inherit autotools
547 </literallayout> 557 </literallayout>
548 In this case, BitBake would search for the directory 558 In this case, BitBake would search for the directory
549 <filename>classes/siteinfo.bbclass</filename> 559 <filename>classes/autotools.bbclass</filename>
550 in <filename>BBPATH</filename>. 560 in <filename>BBPATH</filename>.
561 <note>
562 You can override any values and functions of the
563 inherited class within your recipe by doing so
564 after the "inherit" statement.
565 </note>
551 </para> 566 </para>
552 </section> 567 </section>
553 568
@@ -566,9 +581,9 @@
566 581
567 <para> 582 <para>
568 As an example, suppose you needed a recipe to include some 583 As an example, suppose you needed a recipe to include some
569 self-test files: 584 self-test definitions:
570 <literallayout class='monospaced'> 585 <literallayout class='monospaced'>
571 include test_recipe.inc 586 include test_defs.inc
572 </literallayout> 587 </literallayout>
573 <note> 588 <note>
574 The <filename>include</filename> directive does not 589 The <filename>include</filename> directive does not
@@ -598,17 +613,28 @@
598 </para> 613 </para>
599 614
600 <para> 615 <para>
601 Similar to how BitBake uses <filename>include</filename>, 616 Similar to how BitBake uses
617 <link linkend='include-directive'><filename>include</filename></link>,
602 if the path specified 618 if the path specified
603 on the require line is a relative path, BitBake locates 619 on the require line is a relative path, BitBake locates
604 the first file it can find within <filename>BBPATH</filename>. 620 the first file it can find within <filename>BBPATH</filename>.
605 </para> 621 </para>
606 622
607 <para> 623 <para>
608 As an example, suppose you needed a recipe to require some 624 As an example, suppose you have two versions of a recipe
609 self-test files: 625 (e.g. <filename>foo_1.2.2.bb</filename> and
626 <filename>foo_2.0.0.bb</filename>) where
627 each version contains some identical functionality that could be
628 shared.
629 You could create an include file named <filename>foo.inc</filename>
630 that contains the common definitions needed to build "foo".
631 You need to be sure <filename>foo.inc</filename> is located in the
632 same directory as your two recipe files as well.
633 Once these conditions are set up, you can share the functionality
634 using a <filename>require</filename> directive from within each
635 recipe:
610 <literallayout class='monospaced'> 636 <literallayout class='monospaced'>
611 require test_recipe.inc 637 require foo.inc
612 </literallayout> 638 </literallayout>
613 </para> 639 </para>
614 </section> 640 </section>
@@ -625,12 +651,25 @@
625 </para> 651 </para>
626 652
627 <para> 653 <para>
628 Suppose you needed to inherit a multilib global class. 654 As an example, suppose you needed to inherit a class
655 file called <filename>abc.bbclass</filename> from a
656 configuration file as follows:
629 <literallayout class='monospaced'> 657 <literallayout class='monospaced'>
630 INHERIT += "multilib_global" 658 INHERIT += "abc"
631 </literallayout> 659 </literallayout>
632 This configuration directive causes the named class to be inherited 660 This configuration directive causes the named
633 at the point of the directive during parsing. 661 class to be inherited at the point of the directive
662 during parsing.
663 As with the <filename>inherit</filename> directive, the
664 <filename>.bbclass</filename> file must be located in a
665 "classes" subdirectory in one of the directories specified
666 in <filename>BBPATH</filename>.
667 <note>
668 Because <filename>.conf</filename> files are parsed
669 first during BitBake's execution, using
670 <filename>INHERIT</filename> to inherit a class effectively
671 inherits the class globally (i.e. for all recipes).
672 </note>
634 </para> 673 </para>
635 </section> 674 </section>
636 </section> 675 </section>