--noclosure \
--output $@ \
--strip-prefix=g \
- --libtool="$(LIBTOOL)" \
+ --libtool="$(LIBTOOL)" \
+ --c-include="glib.h" \
--library=$(GLIB_LIBRARY) \
--pkg glib-2.0 \
$(CPPFLAGS) \
--noclosure \
--output $@ \
--strip-prefix=g \
- --libtool="$(LIBTOOL)" \
- --include=GLib-2.0 \
+ --libtool="$(LIBTOOL)" \
+ --c-include="glib-object.h" \
+ --include=GLib-2.0 \
--library=$(GOBJECT_LIBRARY) \
-I$(GOBJECT_INCLUDEDIR) \
-I$(GOBJECT_LIBDIR)/glib-2.0/include \
-DGOBJECT_COMPILATION \
- --pkg gobject-2.0 \
+ --pkg gobject-2.0 \
$(GLIB_INCLUDEDIR)/gobject/*.h
$(SCANNER) $(SCANNER_ARGS) \
--xpath-assertions=$(srcdir)/GObject-2.0.xpath GObject-2.0.gir
--noclosure \
--output $@ \
--strip-prefix=g \
- --libtool="$(LIBTOOL)" \
- --include=GLib-2.0 \
+ --libtool="$(LIBTOOL)" \
+ --c-include="gmodule.h" \
+ --include=GLib-2.0 \
--library=$(GMODULE_LIBRARY) \
-I$(GMODULE_INCLUDEDIR) \
-I$(GMODULE_LIBDIR)/glib-2.0/include \
- --pkg gmodule-2.0 \
+ --pkg gmodule-2.0 \
$(GLIB_INCLUDEDIR)/gmodule.h
BUILT_GIRSOURCES += GModule-2.0.gir
--noclosure \
--output $@ \
--strip-prefix=g \
- --libtool="$(LIBTOOL)" \
- --include=GObject-2.0 \
+ --libtool="$(LIBTOOL)" \
+ --c-include="gio/gio.h" \
+ --include=GObject-2.0 \
--library=$(GIO_LIBRARY) \
-I$(GIO_INCLUDEDIR) \
-I$(GIO_LIBDIR)/glib-2.0/include \
--noclosure \
--output $@ \
--strip-prefix=g \
- --libtool="$(LIBTOOL)" \
- --include=GObject-2.0 \
+ --libtool="$(LIBTOOL)" \
+ --c-include="girepository.h" \
+ --include=GObject-2.0 \
--library=girepository-1.0 \
-I$(srcdir)/girepository \
- --pkg glib-2.0 \
- --pkg gobject-2.0 \
+ --pkg glib-2.0 \
+ --pkg gobject-2.0 \
$(GIREPOSITORY_FILES)
BUILT_GIRSOURCES += GIRepository-2.0.gir
class GIRWriter(XMLWriter):
- def __init__(self, namespace, shlibs, includes, pkgs):
+ def __init__(self, namespace, shlibs, includes, pkgs, c_includes):
super(GIRWriter, self).__init__()
self.write_comment(
'''This file was automatically generated from C sources - DO NOT EDIT!
To affect the contents of this file, edit the original C definitions,
and/or use gtk-doc annotations. ''')
- self._write_repository(namespace, shlibs, includes, pkgs)
+ self._write_repository(namespace, shlibs, includes, pkgs, c_includes)
def _write_repository(self, namespace, shlibs, includes=None,
- packages=None):
+ packages=None, c_includes=None):
if includes is None:
includes = frozenset()
if packages is None:
packages = frozenset()
+ if c_includes is None:
+ c_includes = frozenset()
attrs = [
('version', '1.0'),
('xmlns', 'http://www.gtk.org/introspection/core/1.0'),
self._write_include(include)
for pkg in sorted(set(packages)):
self._write_pkgconfig_pkg(pkg)
+ for c_include in sorted(set(c_includes)):
+ self._write_c_include(c_include)
self._write_namespace(namespace, shlibs)
def _write_include(self, include):
attrs = [('name', package)]
self.write_tag('package', attrs)
+ def _write_c_include(self, c_include):
+ attrs = [('name', c_include)]
+ self.write_tag('c:include', attrs)
+
def _write_namespace(self, namespace, shlibs):
libraries = []
for l in shlibs:
$(CHECK_DEBUG) $(SCANNER) \
--include=GObject-2.0 \
--include=utility-1.0 \
+ --c-include="foo.h" \
--libtool="$(LIBTOOL)" \
--library=foo \
--namespace=foo \
<include name="GObject" version="2.0"/>
<include name="utility" version="1.0"/>
<package name="gobject-2.0"/>
+ <c:include name="foo.h"/>
<namespace name="foo" version="1.0" shared-library="foo">
<alias name="List" target="GLib.SList" c:type="FooList"/>
<alias name="ObjectCookie" target="any" c:type="FooObjectCookie"/>
parser.add_option("", "--xpath-assertions",
action="store", dest="xpath_assertions",
help="Use given file to create assertions on GIR content")
+ parser.add_option("", "--c-include",
+ action="append", dest="c_includes", default=[],
+ help="headers which should be included in C programs")
group = optparse.OptionGroup(parser, "Preprocessor options")
group.add_option("-I", help="Pre-processor include file",
# Write out AST
writer = Writer(namespace, libraries, transformer.get_includes(),
- options.packages)
+ options.packages, options.c_includes)
data = writer.get_xml()
if options.output:
fd = open(options.output, "w")