Add a GIRepository-2.0.gir. Change the libtool lookup slightly so we can
authorJohan Dahlin <jdahlin@async.com.br>
Wed, 12 Nov 2008 12:04:54 +0000 (12:04 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Wed, 12 Nov 2008 12:04:54 +0000 (12:04 +0000)
2008-11-12  Johan Dahlin  <jdahlin@async.com.br>

        * gir/Makefile.am:
        * giscanner/glibtransformer.py:
        * tools/g-ir-scanner:
        Add a GIRepository-2.0.gir. Change the libtool lookup slightly
        so we can just pass in --library=foo/bar/baz.la and the scanner
        does the right thing.
        Don't warn for _get_type() functions if they don't take any
        parameters

svn path=/trunk/; revision=890

ChangeLog
gir/Makefile.am
giscanner/glibtransformer.py
tools/g-ir-scanner

index 371f08a9772595440051e00359526650ec5aeb50..acc3b988f4c8dfd33509bd81032eab4f7b3057d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-12  Johan Dahlin  <jdahlin@async.com.br>
+
+       * gir/Makefile.am:
+       * giscanner/glibtransformer.py:
+       * tools/g-ir-scanner:
+       Add a GIRepository-2.0.gir. Change the libtool lookup slightly
+       so we can just pass in --library=foo/bar/baz.la and the scanner
+       does the right thing.
+       Don't warn for _get_type() functions if they don't take any
+       parameters
+
 2008-11-11  Owen Taylor  <otaylor@redhat.com>
 
        Bug 560404 – Prefix types when resolving aliases in included modules
index 437adbf9112abeeede018b17411f3b06ea2df60f..99650be708f873bad16dcb3b07e20a7b1c22c1ed 100644 (file)
@@ -16,7 +16,7 @@ else
 GLIB_LIBRARY=glib-2.0
 endif
 
-GLib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile glib-2.0.c
+GLib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) glib-2.0.c
        PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
            -v --namespace GLib --nsversion=2.0 \
            --add-include-path=. \
@@ -47,7 +47,7 @@ else
 GOBJECT_LIBRARY=gobject-2.0
 endif
 
-GObject-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile
+GObject-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
        PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
            -v --namespace GObject --nsversion=2.0 \
            --add-include-path=. \
@@ -98,7 +98,7 @@ else
 GIO_LIBRARY=gio-2.0
 endif
 
-Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile $(srcdir)/gio-2.0.c
+Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) $(srcdir)/gio-2.0.c
        PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
            -v --namespace Gio --nsversion=2.0 \
            --add-include-path=. \
@@ -116,16 +116,43 @@ Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile $(sr
            $(GLIB_INCLUDEDIR)/gio/*.h
 BUILT_SOURCES += Gio-2.0.gir
 EXTRA_DIST += gio-2.0.c
-CLEANFILES = $(BUILT_SOURCES)
 
+# girepository
+GIREPOSITORY_INCLUDEDIR=`pkg-config --variable=includedir girepository-2.0`/glib-2.0
+GIREPOSITORY_LIBDIR=`pkg-config --variable=libdir girepository-2.0`
+
+GIRepository-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
+       PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
+           -v --namespace GIRepository --nsversion=1.0\
+           --add-include-path=. \
+           --noclosure \
+           --output $@ \
+           --strip-prefix=g \
+            --include=GObject-2.0 \
+           --library=$(top_builddir)/girepository/libgirepository.la \
+           -I$(srcdir)/girepository \
+            --pkg glib-2.0 \
+            --pkg gobject-2.0 \
+           $(top_srcdir)/girepository/girepository.c \
+           $(top_srcdir)/girepository/girepository.h
+BUILT_SOURCES += GIRepository-2.0.gir
+
+# Generic rules
+CLEANFILES = $(BUILT_SOURCES)
 girdir=$(datadir)/gir
 dist_gir_DATA = $(BUILT_SOURCES)
 
-%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
+%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT)
        $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $@
 
 typelibsdir = $(libdir)/girepository
-typelibs_DATA = GLib-2.0.typelib GModule-2.0.typelib GObject-2.0.typelib Gio-2.0.typelib
+typelibs_DATA =                \
+       GLib-2.0.typelib        \
+       GModule-2.0.typelib     \
+       GObject-2.0.typelib     \
+       Gio-2.0.typelib         \
+       GIRepository-2.0.typelib
+
 CLEANFILES += $(typelibs_DATA)
 
 # Check that typelib -> gir -> typelib transformation is lossless.
@@ -133,10 +160,10 @@ CLEANFILES += $(typelibs_DATA)
 # values, etc.) but the typelibs should identical as long as the gir files are
 # semantically equivalent.
 
-%.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+%.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT)
        $(DEBUG) $(top_builddir)/tools/g-ir-generate$(EXEEXT) --includedir=. $< -o $@
 
-testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT)
        $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $*.test.typelib
        cmp $*.typelib $*.test.typelib && rm $*.test.typelib
 
index 4e9de790b261178b05b0b814f93b43af98612a2b..d8639e43402bf02d2bd99f8f00219ec2d217eed7 100644 (file)
@@ -84,13 +84,17 @@ class GLibTransformer(object):
             found_libname = os.path.abspath(libname)
         elif os.path.exists(libtool_libname):
             found_libname = extract_libtool(libtool_libname)
-        elif libname.endswith('.la'):
-            found_libname = extract_libtool(libname)
+            libname = os.path.basename(found_libname)
         else:
             found_libname = find_library(libname)
+
+        if libname.endswith('.la'):
+            found_libname = extract_libtool(libname)
+            libname = os.path.basename(found_libname)
         if not found_libname:
             raise ValueError("Failed to find library: %r" % (libname, ))
         self._libraries.append(ctypes.cdll.LoadLibrary(found_libname))
+        return libname
 
     def _print_statistics(self):
         nodes = list(self._names.names.itervalues())
@@ -267,6 +271,8 @@ class GLibTransformer(object):
         if self._namespace_name == 'GLib':
             # No GObjects in GLib
             return False
+        if func.parameters:
+            return False
         # GType *_get_type(void)
         if func.retval.type.name not in ['Type',
                                          'GType',
@@ -275,8 +281,6 @@ class GLibTransformer(object):
             print ("Warning: *_get_type function returns '%r'"
                    ", not GObject.Type") % (func.retval.type.name, )
             return False
-        if func.parameters:
-            return False
 
         if not self._libraries:
             print "Warning: No libraries loaded, cannot call %s" % (symbol, )
index 82bbf34dad25d6bcda46a4d24701dd210ff2f59c..337f9b6e3ec10441024e34c20a27e2dcb2ab1589 100755 (executable)
@@ -211,7 +211,6 @@ def main(args):
 
     if not options.libraries:
         _error("Must specify --library at least one primary library")
-    libraries = options.libraries
 
     for package in options.packages:
         output = subprocess.Popen(['pkg-config', '--cflags', package],
@@ -252,7 +251,6 @@ def main(args):
         os.environ['LPATH'] = ':'.join([lpath, library_path])
     else:
         os.environ['LPATH'] = library_path
-
     filenames = []
     for arg in args:
         if (arg.endswith('.c') or
@@ -290,9 +288,10 @@ def main(args):
     # Transform the C AST nodes into higher level
     # GLib/GObject nodes
     glibtransformer = GLibTransformer(transformer, noclosure=options.noclosure)
+    libraries = []
     if options.libraries:
         for library in options.libraries:
-            glibtransformer.add_library(library)
+            libraries.append(glibtransformer.add_library(library))
 
     namespace = glibtransformer.parse()