gobject-introspection r432 - in trunk: . gir giscanner tools



Author: johan
Date: Thu Aug 21 08:42:11 2008
New Revision: 432
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=432&view=rev

Log:
2008-08-21  Johan Dahlin  <johan gnome org>

    * gir/Makefile.am:
    * giscanner/glibtransformer.py:
    * tools/g-ir-scanner:
    Do not hard-core library names in the Makefile, reuse
    ctypes find_library instead.



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

Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am	(original)
+++ trunk/gir/Makefile.am	Thu Aug 21 08:42:11 2008
@@ -8,11 +8,12 @@
 GLIB_INCLUDEDIR=`pkg-config --variable=includedir glib-2.0`/glib-2.0
 GLIB_LIBDIR=`pkg-config --variable=libdir glib-2.0`
 GLib.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
-	$(G_IR_SCANNER) -v --namespace GLib \
+	PYTHONPATH=$(top_srcdir):$$PYTHONPATH $(G_IR_SCANNER) \
+	    -v --namespace GLib \
 	    --noclosure \
 	    --output $@ \
 	    --strip-prefix=g \
-	    --library=$(GOBJECT_LIBDIR)/libglib-2.0.so \
+	    --library=glib-2.0 \
 	    -I$(GLIB_INCLUDEDIR) \
 	    -I$(GLIB_LIBDIR)/glib-2.0/include \
 	    -DGETTEXT_PACKAGE=Dummy \
@@ -24,12 +25,13 @@
 GOBJECT_INCLUDEDIR=`pkg-config --variable=includedir gobject-2.0`/glib-2.0
 GOBJECT_LIBDIR=`pkg-config --variable=libdir gobject-2.0`
 GObject.gir: GLib.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
-	$(G_IR_SCANNER) -v --namespace GObject \
+	PYTHONPATH=$(top_srcdir):$$PYTHONPATH $(G_IR_SCANNER) \
+	    -v --namespace GObject \
 	    --noclosure \
 	    --output $@ \
 	    --strip-prefix=g \
             --include=$(builddir)/GLib.gir \
-	    --library=$(GOBJECT_LIBDIR)/libgobject-2.0.so \
+	    --library=gobject-2.0 \
 	    -I$(GOBJECT_INCLUDEDIR) \
 	    -I$(GOBJECT_LIBDIR)/glib-2.0/include \
 	    -DGOBJECT_COMPILATION \
@@ -41,13 +43,14 @@
 GIO_INCLUDEDIR=`pkg-config --variable=includedir gio-2.0`/glib-2.0
 GIO_LIBDIR=`pkg-config --variable=libdir gio-2.0`
 Gio.gir: GObject.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
-	$(G_IR_SCANNER) -v --namespace Gio \
+	PYTHONPATH=$(top_srcdir):$$PYTHONPATH $(G_IR_SCANNER) \
+	    -v --namespace Gio \
 	    --noclosure \
 	    --output $@ \
 	    --strip-prefix=g \
             --include=$(builddir)/GLib.gir \
             --include=$(builddir)/GObject.gir \
-	    --library=$(GIO_LIBDIR)/libgio-2.0.so \
+	    --library=gio-2.0 \
 	    -I$(GIO_INCLUDEDIR) \
 	    -I$(GIO_LIBDIR)/glib-2.0/include \
 	    -DGIO_COMPILATION \

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Thu Aug 21 08:42:11 2008
@@ -19,6 +19,7 @@
 #
 
 import ctypes
+from ctypes.util import find_library
 
 from . import cgobject
 from .ast import (Callback, Enum, Function, Member, Namespace, Parameter,
@@ -56,6 +57,7 @@
     def add_library(self, libname):
         if libname.endswith('.la'):
             libname = extract_libtool(libname)
+        libname = find_library(libname)
         self._libraries.append(ctypes.cdll.LoadLibrary(libname))
 
     def parse(self):

Modified: trunk/tools/g-ir-scanner
==============================================================================
--- trunk/tools/g-ir-scanner	(original)
+++ trunk/tools/g-ir-scanner	Thu Aug 21 08:42:11 2008
@@ -52,6 +52,9 @@
     parser.add_option("-l", "--library",
                       action="append", dest="libraries", default=[],
                       help="libraries of this unit")
+    parser.add_option("-L", "--library-path",
+                      action="append", dest="library_paths", default=[],
+                      help="directories to search for libraries")
     parser.add_option("-n", "--namespace",
                       action="store", dest="namespace_name",
                       help="name of namespace for this unit")
@@ -120,6 +123,11 @@
         options.cpp_defines.extend(pkg_options.cpp_defines)
         options.cpp_undefines.extend(pkg_options.cpp_undefines)
 
+        output = commands.getoutput('pkg-config --libs-only-L %s' % (
+            package, ))
+        pkg_options, unused = parser.parse_args(output.split())
+        options.library_paths.extend(pkg_options.library_paths)
+
     filenames = []
     for arg in args:
         if (arg.endswith('.c') or



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]