summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorScott Rifenbark <srifenbark@gmail.com>2016-04-19 21:50:16 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-29 07:48:22 +0100
commit8aebd1cd0aa9647f341afb4c44a1830c36c55c7e (patch)
tree2bbbd894ebca53be71d2c1f88efe7aab7d81f159 /documentation
parentab3147e9959b9975d76d8d6956da8b736e672b5a (diff)
downloadpoky-8aebd1cd0aa9647f341afb4c44a1830c36c55c7e.tar.gz
dev-manual: Added Gobject Introspection section.
(From yocto-docs rev: be442bcb971c8685f8a2c6dde92b64479a211e2e) Signed-off-by: Scott Rifenbark <srifenbark@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r--documentation/dev-manual/dev-manual-common-tasks.xml240
1 files changed, 232 insertions, 8 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml
index 7aff0bc0d5..a634ef16c7 100644
--- a/documentation/dev-manual/dev-manual-common-tasks.xml
+++ b/documentation/dev-manual/dev-manual-common-tasks.xml
@@ -3726,6 +3726,230 @@
3726 </section> 3726 </section>
3727 </section> 3727 </section>
3728 3728
3729 <section id='enabling-gobject-introspection-support'>
3730 <title>Enabling GObject Introspection Support</title>
3731
3732 <para>
3733 <ulink url='https://wiki.gnome.org/Projects/GObjectIntrospection'>GObject introspection</ulink>
3734 is the standard mechanism for accessing GObject-based software
3735 from runtime environments.
3736 GObject is a feature of the GLib library that provides an object
3737 framework for the GNOME desktop and related software.
3738 GObject Introspection adds information to GObject that allows
3739 objects created within it to be represented across different
3740 programming languages.
3741 If you want to construct GStreamer pipelines using Python, or
3742 control UPnP infrastructure using Javascript and GUPnP,
3743 GObject introspection is the only way to do it.
3744 </para>
3745
3746 <para>
3747 This section describes the Yocto Project support for generating
3748 and packaging GObject introspection data.
3749 GObject introspection data is a description of the
3750 API provided by libraries built on top of GLib framework,
3751 and, in particular, that framework's GObject mechanism.
3752 GObject Introspection Repository (GIR) files go to
3753 <filename>-dev</filename> packages,
3754 <filename>typelib</filename> files go to main packages as they
3755 are packaged together with libraries that are introspected.
3756 </para>
3757
3758 <para>
3759 The data is generated when building such a library, by linking
3760 the library with a small executable binary that asks the library
3761 to describe itself, and then executing the binary and
3762 processing its output.
3763 </para>
3764
3765 <para>
3766 Generating this data in a cross-compilation environment
3767 is difficult because the library is produced for the target
3768 architecture, but its code needs to be executed on the build host.
3769 This problem is solved with the OpenEmbedded build system by
3770 running the code through QEMU, which allows precisely that.
3771 Unfortunately, QEMU does not always work perfectly as mentioned
3772 in the xxx section.
3773 </para>
3774
3775 <section id='enabling-the-generation-of-introspection-data'>
3776 <title>Enabling the Generation of Introspection Data</title>
3777
3778 <para>
3779 Enabling the generation of introspection data (GIR files)
3780 in your library package involves the following:
3781 <orderedlist>
3782 <listitem><para>
3783 Inherit the
3784 <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-gobject-introspection'><filename>gobject-introspection</filename></ulink>
3785 class.
3786 </para></listitem>
3787 <listitem><para>
3788 Make sure introspection is not disabled anywhere in
3789 the recipe or from anything the recipe includes.
3790 Also, make sure that "gobject-introspection-data" is
3791 not in
3792 <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_FEATURES_BACKFILL_CONSIDERED'><filename>DISTRO_FEATURES_BACKFILL_CONSIDERED</filename></ulink>
3793 and that "qemu-usermode" is not in
3794 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_FEATURES_BACKFILL_CONSIDERED'><filename>MACHINE_FEATURES_BACKFILL_CONSIDERED</filename></ulink>.
3795 If either of these conditions exist, nothing will
3796 happen.
3797 </para></listitem>
3798 <listitem><para>
3799 Try to build the recipe.
3800 If you encounter build errors that look like
3801 something is unable to find
3802 <filename>.so</filename> libraries, check where these
3803 libraries are located in the source tree and add
3804 the following to the recipe:
3805 <literallayout class='monospaced'>
3806 GIR_EXTRA_LIBS_PATH = "${B}/<replaceable>something</replaceable>/.libs"
3807 </literallayout>
3808 <note>
3809 See recipes in the <filename>oe-core</filename>
3810 repository that use that
3811 <filename>GIR_EXTRA_LIBS_PATH</filename> variable
3812 as an example.
3813 </note>
3814 </para></listitem>
3815 <listitem><para>
3816 Look for any other errors, which probably mean that
3817 introspection support in a package is not entirely
3818 standard, and thus breaks down in a cross-compilation
3819 environment.
3820 For such cases, custom-made fixes are needed.
3821 A good place to ask and receive help in these cases
3822 is the
3823 <ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Yocto Project mailing lists</ulink>.
3824 </para></listitem>
3825 </orderedlist>
3826 <note>
3827 Using a library that no longer builds against the latest
3828 Yocto Project release and prints introspection related
3829 errors is a good candidate for the previous procedure.
3830 </note>
3831 </para>
3832 </section>
3833
3834 <section id='disabling-the-generation-of-introspection-data'>
3835 <title>Disabling the Generation of Introspection Data</title>
3836
3837 <para>
3838 You might find that you do not want to generate
3839 introspection data.
3840 Or, perhaps QEMU does not work on your build host and
3841 target architecture combination.
3842 If so, you can use either of the following methods to
3843 disable GIR file generations:
3844 <itemizedlist>
3845 <listitem><para>
3846 Add the following to your distro configuration:
3847 <literallayout class='monospaced'>
3848 DISTRO_FEATURES_BACKFILL_CONSIDERED = "gobject-introspection-data"
3849 </literallayout>
3850 Adding this statement disables generating
3851 introspection data using QEMU but will still enable
3852 building introspection tools and libraries
3853 (i.e. building them does not require the use of QEMU).
3854 </para></listitem>
3855 <listitem><para>
3856 Add the following to your machine configuration:
3857 <literallayout class='monospaced'>
3858 MACHINE_FEATURES_BACKFILL_CONSIDERED = "qemu-usermode"
3859 </literallayout>
3860 Adding this statement disables the use of QEMU
3861 when building packages for your machine.
3862 Currently, this feature is used only by introspection
3863 recipes and has the same effect as the previously
3864 described option.
3865 <note>
3866 Future releases of the Yocto Project might have
3867 other features affected by this option.
3868 </note>
3869 </para></listitem>
3870 </itemizedlist>
3871 If you disable introspection data, you can still
3872 obtain it through other means such as copying the data
3873 from a suitable sysroot, or by generating it on the
3874 target hardware.
3875 The OpenEmbedded build system does not currently
3876 provide specific support for these techniques.
3877 </para>
3878 </section>
3879
3880 <section id='testing-that-introspection-works-in-an-image'>
3881 <title>Testing that Introspection Works in an Image</title>
3882
3883 <para>
3884 Use the following procedure to test if generating
3885 introspection data is working in an image:
3886 <orderedlist>
3887 <listitem><para>
3888 Make sure that "gobject-introspection-data" is not in
3889 <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_FEATURES_BACKFILL_CONSIDERED'><filename>DISTRO_FEATURES_BACKFILL_CONSIDERED</filename></ulink>
3890 and that "qemu-usermode" is not in
3891 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_FEATURES_BACKFILL_CONSIDERED'><filename>MACHINE_FEATURES_BACKFILL_CONSIDERED</filename></ulink>.
3892 </para></listitem>
3893 <listitem><para>
3894 Build <filename>core-image-sato</filename>.
3895 </para></listitem>
3896 <listitem><para>
3897 Launch a Terminal and then start Python in the
3898 terminal.
3899 </para></listitem>
3900 <listitem><para>
3901 Enter the following in the terminal:
3902 <literallayout class='monospaced'>
3903 >>> from gi.repository import GLib
3904 >>> GLib.get_host_name()
3905 </literallayout>
3906 </para></listitem>
3907 <listitem><para>
3908 For something a little more advanced, enter the
3909 following:
3910 <literallayout class='monospaced'>
3911 http://python-gtk-3-tutorial.readthedocs.org/en/latest/introduction.html
3912 </literallayout>
3913 </para></listitem>
3914 </orderedlist>
3915 </para>
3916 </section>
3917
3918 <section id='known-issues'>
3919 <title>Known Issues</title>
3920
3921 <para>
3922 The following know issues exist for
3923 GObject Introspection Support:
3924 <itemizedlist>
3925 <listitem><para>
3926 <filename>qemu-ppc64</filename> immediately crashes.
3927 Consequently, you cannot build introspection data on
3928 that architecture.
3929 </para></listitem>
3930 <listitem><para>
3931 x32 is not supported by QEMU.
3932 Consequently, introspection data is disabled.
3933 </para></listitem>
3934 <listitem><para>
3935 musl causes transient GLib binaries to crash on
3936 assertion failures.
3937 Consequently, generating introspection data is
3938 disabled.
3939 </para></listitem>
3940 <listitem><para>
3941 Because QEMU is not able to run the binaries correctly,
3942 introspection is disabled for some specific packages
3943 under specific architectures (e.g.
3944 <filename>gcr</filename>,
3945 <filename>libsecret</filename>, and
3946 <filename>webkit</filename>).
3947 </para></listitem>
3948 </itemizedlist>
3949 </para>
3950 </section>
3951 </section>
3952
3729 <section id='dev-optionally-using-an-external-toolchain'> 3953 <section id='dev-optionally-using-an-external-toolchain'>
3730 <title>Optionally Using an External Toolchain</title> 3954 <title>Optionally Using an External Toolchain</title>
3731 3955
@@ -3802,10 +4026,10 @@
3802 it is based on is by definition incomplete. 4026 it is based on is by definition incomplete.
3803 Its purpose is to allow the generation of customized images, 4027 Its purpose is to allow the generation of customized images,
3804 and as such was designed to be completely extensible through a 4028 and as such was designed to be completely extensible through a
3805 plugin interface. 4029 plug-in interface.
3806 See the 4030 See the
3807 "<link linkend='openembedded-kickstart-plugins'>Plugins</link>" 4031 "<link linkend='openembedded-kickstart-plugins'>Plug-ins</link>"
3808 section for information on these plugins. 4032 section for information on these plug-ins.
3809 </para> 4033 </para>
3810 4034
3811 <para> 4035 <para>
@@ -4367,21 +4591,21 @@
4367 </section> 4591 </section>
4368 4592
4369 <section id='openembedded-kickstart-plugins'> 4593 <section id='openembedded-kickstart-plugins'>
4370 <title>Plugins</title> 4594 <title>Plug-ins</title>
4371 4595
4372 <para> 4596 <para>
4373 Plugins allow <filename>wic</filename> functionality to 4597 Plug-ins allow <filename>wic</filename> functionality to
4374 be extended and specialized by users. 4598 be extended and specialized by users.
4375 This section documents the plugin interface, which is 4599 This section documents the plugin interface, which is
4376 currently restricted to source plugins. 4600 currently restricted to source plug ins.
4377 </para> 4601 </para>
4378 4602
4379 <para> 4603 <para>
4380 Source plugins provide a mechanism to customize 4604 Source plug ins provide a mechanism to customize
4381 various aspects of the image generation process in 4605 various aspects of the image generation process in
4382 <filename>wic</filename>, mainly the contents of 4606 <filename>wic</filename>, mainly the contents of
4383 partitions. 4607 partitions.
4384 The plugins provide a mechanism for mapping values 4608 The plug ins provide a mechanism for mapping values
4385 specified in <filename>.wks</filename> files using the 4609 specified in <filename>.wks</filename> files using the
4386 <filename>--source</filename> keyword to a 4610 <filename>--source</filename> keyword to a
4387 particular plugin implementation that populates a 4611 particular plugin implementation that populates a