summaryrefslogtreecommitdiff
path: root/docs/g-ir-scanner.1
blob: 315f678e9be15ea94ae54f9300ce2f343857cd4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.TH "g-ir-scanner" 1
.SH NAME
g-ir-scanner \- extracting C metadata from sources and headers
.SH SYNOPSIS
.B g-ir-scanner
[OPTION...] FILES...
.SH DESCRIPTION
g-ir-scanner is a tool which generates GIR XML files by parsing headers
and introspecting GObject based libraries.
It is usually invoked during the normal build step for a project and
the information is saved to disk and later installed so language bindings 
and other applications can use it.
Header files and source files are passed in arguments on the command line.
The suffix determines if it should be treated as source (.c) or header (.h),
currently only C based libraries are supported by the scanner.
.SH OPTIONS
.TP
.B \---help
Show help options
.TP
.B \---format=FORMAT
This parameters decides which the resulting format will be used.
The default value is gir.
.TP
.B \---include=NAME
Parses another metadata file. The format is determined by looking
at the file suffix. If a library depends on another the corresponding
metadata file should be included so references to external types are
correctly specified.
.TP
.B \---add-include-path=PATH
Add a directory to the path which the scanner uses to find GIR files.
Can be used multiple times to specify multiple directories
.TP
.B \-i, ---library=LIBRARY
Specifies a library that will be introspected. This means that the 
*_get_type() functions in it will be called for GObject data types.
The name of the library should not contain the leading lib prefix nor
the ending shared library suffix.
.TP
.B \-L, ---library-path=PATH
Include this directory when searching for a library.
This option can be specified multiple times to include more than one
directory to look for libraries in.
.TP
.B \-n, ---namespace=NAME
The namespace name. This name should be capitalized, eg the first letter
should be upper case. Examples: Gtk, Clutter, WebKit.
.TP
.B \---no-libtool
Disable usage of libtool for compiling stub introspection binary.  Use this
if your build system does not require libtool.
.TP
.B ---nsversion=VERSION
The namespace version. For instance 1.0. This is usually the platform version,
eg 2.0 for Gtk+, not 2.12.7.
.TP
.B \-p, ---program=PROGRAM
Specifies a binary that will be introspected. This means that the
*_get_type() functions in it will be called for GObject data types.
The binary must be modified to take a --introspect= option, and
to pass the argument to this function to g_irepository_dump.
.TP
.B \---program-arg=ARG
Additional argument to pass to program for introspection.
.TP
.B \, ---strip-prefix=PREFIX
If this option is specified a prefix will be stripped from all functions.
If not specified, the lower case version of the namespace will be used.
Eg, a strip prefix of 
.B g_
and a namespace set to
.B GLib
will export the function 
.B g_type_name
as 
.B GLib.type_name.
.TP
.B \, ---output=FILENAME
Name of the file to output. Normally namespace + format extension.
Eg, GLib.gir.
.TP
.B \, ---pkg=PACKAGE
List of pkg-config packages to get compiler and linker flags from.
This option can be specified multiple times to include flags from 
several pkg-config packages.
.TP
.B \---verbose                       
Be verbose, include some debugging information.
.TP
.B \---noclosure                       
Do not delete unknown types from the resulting format.
.TP
.B \---typelib-xml                       
Convert the resulting xml to only output the types relevant
to the typelib compiler. This is mainly useful for verifying the
correctness of the typelib itself.
.TP
.B \---inject=FILENAME
Injects a variant of a GIR file into the scanner. This is used to add
custom functions to a GIR wrapping a library without modifying the upstream
library itself. The Format of the inject file is similar to a GIR,
but the root node is <injections> rather than <repository> and
<inject path="..."> where ... is an xpath expression.

Example:

  <inject path="namespace/class[@name='TestDrawable']">
    <method name="get_width" c:identifier="girepo_test_drawable_get_width">
      <return-value transfer-ownership="none">
        <type name="int" c:type="gint"/>
      </return-value>
    </method>
  </inject>

The example above will add a new method called get_with to the TestDrawable class.
.TP
.B \---xpath-assertions=FILENAME
Loads a list xpath assertions from FILENAME, this is useful for verifying
that the GIR itself is properly generated.
.TP
.SH BUGS
Report bugs at http://bugzilla.gnome.org/ in the glib product and
introspection component.
.SH HOMEPAGE and CONTACT
http://live.gnome.org/GObjectIntrospection
.SH AUTHORS
Johan Dahlin