From 76c461f297974edb65fee60752de53692fecb0e4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 20 Aug 2008 19:17:14 +0000 Subject: [PATCH] Rename .gir files using GI namespace. Use XDG_DATA_DIRS for looking up 2008-08-20 Colin Walters * gir/Makefile.am: Rename .gir files using GI namespace. * girepository/girepository.c: Use XDG_DATA_DIRS for looking up typelibs. Also typelibs are now suffixed with .typelib. * tests/invoke/Makefile.am: Only use metadata. * girepository/Makefile.am: Remove unnecessary include. * tests/scanner/Makefile.am: Update using GI namespaces for scanner includes. svn path=/trunk/; revision=422 --- ChangeLog | 11 +++++++++++ gir/Makefile.am | 21 +++++++++++++-------- girepository/Makefile.am | 2 -- girepository/girepository.c | 32 +++++++++++--------------------- tests/invoke/Makefile.am | 8 ++------ tests/invoke/invoke.c | 21 ++++----------------- tests/scanner/Makefile.am | 16 ++++++++-------- 7 files changed, 49 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 125d96c..a60318f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2008-08-20 Colin Walters + * gir/Makefile.am: Rename .gir files using GI namespace. + * girepository/girepository.c: Use XDG_DATA_DIRS for + looking up typelibs. Also typelibs are now suffixed + with .typelib. + * tests/invoke/Makefile.am: Only use metadata. + * girepository/Makefile.am: Remove unnecessary include. + * tests/scanner/Makefile.am: Update using GI namespaces + for scanner includes. + +2008-08-20 Colin Walters + * girepository/transformer.py: Suppress aliases whose name is a builtin. * girepository/ast.py: Define some more aliases. diff --git a/gir/Makefile.am b/gir/Makefile.am index 67757a8..9a6b7a6 100644 --- a/gir/Makefile.am +++ b/gir/Makefile.am @@ -7,7 +7,7 @@ G_IR_SCANNER_FILES = $(top_srcdir)/giscanner/*.py \ # glib GLIB_INCLUDEDIR=`pkg-config --variable=includedir glib-2.0`/glib-2.0 GLIB_LIBDIR=`pkg-config --variable=libdir glib-2.0` -glib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) +GLib.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) $(G_IR_SCANNER) -v --namespace GLib \ --noclosure \ --output $@ \ @@ -17,30 +17,29 @@ glib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) -DGETTEXT_PACKAGE=Dummy \ -D__G_I18N_LIB_H__ \ $(GLIB_INCLUDEDIR)/glib/*.h -BUILT_SOURCES += glib-2.0.gir +BUILT_SOURCES += GLib.gir # gobject GOBJECT_INCLUDEDIR=`pkg-config --variable=includedir gobject-2.0`/glib-2.0 GOBJECT_LIBDIR=`pkg-config --variable=libdir gobject-2.0` -gobject-2.0.gir: glib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) +GObject.gir: GLib.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) $(G_IR_SCANNER) -v --namespace GObject \ --noclosure \ --output $@ \ --strip-prefix=g \ - --include=$(builddir)/glib-2.0.gir \ + --include=$(builddir)/GLib.gir \ --library=$(GOBJECT_LIBDIR)/libgobject-2.0.so \ -I$(GOBJECT_INCLUDEDIR) \ -I$(GOBJECT_LIBDIR)/glib-2.0/include \ -DGOBJECT_COMPILATION \ --pkg glib-2.0 \ $(GLIB_INCLUDEDIR)/gobject/*.h -BUILT_SOURCES += gobject-2.0.gir -CLEANFILES = $(BUILT_SOURCES) +BUILT_SOURCES += GObject.gir # gio GIO_INCLUDEDIR=`pkg-config --variable=includedir gio-2.0`/glib-2.0 GIO_LIBDIR=`pkg-config --variable=libdir gio-2.0` -gio-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) +Gio.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) $(G_IR_SCANNER) -v --namespace Gio \ --noclosure \ --output $@ \ @@ -54,10 +53,16 @@ gio-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) --pkg glib-2.0 \ --pkg gobject-2.0 \ $(GLIB_INCLUDEDIR)/gio/*.h -BUILT_SOURCES += gio-2.0.gir +BUILT_SOURCES += Gio.gir CLEANFILES = $(BUILT_SOURCES) girdir=$(datadir)/gir dist_gir_DATA = $(BUILT_SOURCES) +%.typelib: %.gir + $(top_builddir)/tools/g-ir-compiler $< --raw -o $@ + +typelibsdir = $(datadir)/gitypelibs +typelibs_DATA = #Gio.typelib + EXTRA_DIST = glib-2.0-good.gir gobject-2.0-good.gir gobject-2.0-gio.gir diff --git a/girepository/Makefile.am b/girepository/Makefile.am index 36e7baf..fe66da2 100644 --- a/girepository/Makefile.am +++ b/girepository/Makefile.am @@ -2,8 +2,6 @@ include $(top_srcdir)/gcov.mak GCOVSOURCES = $(libgirepository_la_SOURCES) -INCLUDES = -DGIREPO_DEFAULT_SEARCH_PATH="\"$(libdir)\"" - girepodir = $(includedir)/gobject-introspection-1.0/ girepo_HEADERS = girepository.h diff --git a/girepository/girepository.c b/girepository/girepository.c index 765d274..a1759f6 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -114,11 +114,6 @@ g_irepository_register (GIRepository *repository, if (typelib->module == NULL) typelib->module = g_module_open (NULL, 0); - if (g_getenv ("G_IREPOSITORY_VERBOSE")) - { - g_printerr ("Loaded typelib %s\n", name); - } - return name; } @@ -395,22 +390,17 @@ g_irepository_get_shared_library (GIRepository *repository, static inline void g_irepository_build_search_path (void) { - gchar **dir; - gchar **tokens; - - if (g_getenv ("GIREPOPATH")) { - gchar *path; - path = g_strconcat (g_getenv ("GIREPOPATH"), ":", GIREPO_DEFAULT_SEARCH_PATH, NULL); - tokens = g_strsplit (path, ":", 0); - g_free (path); - } else - tokens = g_strsplit (GIREPO_DEFAULT_SEARCH_PATH, ":", 0); - - search_path = g_slist_prepend (search_path, "."); - for (dir = tokens; *dir; ++dir) - search_path = g_slist_prepend (search_path, *dir); + const gchar *const *datadirs; + const gchar *const *dir; + + datadirs = g_get_system_data_dirs (); + + search_path = NULL; + for (dir = datadirs; *dir; dir++) { + char *path = g_build_filename (*dir, "gitypelibs", NULL); + search_path = g_slist_prepend (search_path, path); + } search_path = g_slist_reverse (search_path); - g_free (tokens); } const gchar * @@ -441,7 +431,7 @@ g_irepository_register_file (GIRepository *repository, if (search_path == NULL) g_irepository_build_search_path (); - fname = g_strconcat (namespace, ".repo", NULL); + fname = g_strconcat (namespace, ".typelib", NULL); for (ldir = search_path; ldir; ldir = ldir->next) { dir = ldir->data; diff --git a/tests/invoke/Makefile.am b/tests/invoke/Makefile.am index 653ccc2..f9c87eb 100644 --- a/tests/invoke/Makefile.am +++ b/tests/invoke/Makefile.am @@ -13,15 +13,12 @@ testfns_la_CFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository testfns_la_LDFLAGS = -module -avoid-version testfns_la_LIBADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la -BUILT_SOURCES = testfns-metadata.c test.repo -CLEANFILES = testfns-metadata.c test.repo +BUILT_SOURCES = testfns-metadata.c +CLEANFILES = testfns-metadata.c testfns-metadata.c: testfns.gir $(top_builddir)/tools/g-ir-compiler $(CHECK_DEBUG) $(top_builddir)/tools/g-ir-compiler $(srcdir)/testfns.gir -o testfns-metadata.c -test.repo: testfns.gir testfns.la - $(CHECK_DEBUG) $(top_builddir)/tools/g-ir-compiler --shared-library testfns.la $< --raw -o $@ - invoke_SOURCES = invoke.c invoke_CFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository invoke_LDADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la @@ -30,4 +27,3 @@ TESTS = invoke invoke-namespace-find.sh EXTRA_DIST = invoke-namespace-find.sh testfns.gir -TESTS_ENVIRONMENT = GIREPOPATH="." diff --git a/tests/invoke/invoke.c b/tests/invoke/invoke.c index 01f253e..7962c10 100644 --- a/tests/invoke/invoke.c +++ b/tests/invoke/invoke.c @@ -30,24 +30,11 @@ main (int argc, char *argv[]) testfns, g_irepository_get_n_infos (rep, "test")); - if (argc == 1) + handle = g_module_open (testfns, 0); + if (!handle) { - handle = g_module_open (testfns, 0); - if (!handle) - { - g_error ("module open failed: %s\n", g_module_error ()); - return; - } - } - else - { - name = g_irepository_register_file (rep, "test", &error); - if (error) - { - g_error ("Unable to load typelib 'test': %s", error->message); - return; - } - g_print ("Loaded %s from test.gmeta\n", name); + g_error ("module open failed: %s\n", g_module_error ()); + return 1; } g_print ("after dlopening %s: %d infos in the repository\n", diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index d40ad6d..1ec12c1 100644 --- a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -38,8 +38,8 @@ SCANNER_LIBS = \ annotation.gir: libannotation.la annotation.h $(SCANNER) $(SCANNER_LIBS) $(CHECK_DEBUG) $(SCANNER) -v \ - --include=$(top_srcdir)/gir/glib-2.0.gir \ - --include=$(top_srcdir)/gir/gobject-2.0.gir \ + --include=$(top_srcdir)/gir/GLib.gir \ + --include=$(top_srcdir)/gir/GObject.gir \ --library=libannotation.la \ --namespace=test \ --pkg gobject-2.0 \ @@ -48,8 +48,8 @@ annotation.gir: libannotation.la annotation.h $(SCANNER) $(SCANNER_LIBS) drawable.gir: libdrawable.la drawable.h $(SCANNER) $(SCANNER_LIBS) $(CHECK_DEBUG) $(SCANNER) -v \ - --include=$(top_srcdir)/gir/glib-2.0.gir \ - --include=$(top_srcdir)/gir/gobject-2.0.gir \ + --include=$(top_srcdir)/gir/GLib.gir \ + --include=$(top_srcdir)/gir/GObject.gir \ --library=libdrawable.la \ --namespace=test \ --pkg gobject-2.0 \ @@ -58,8 +58,8 @@ drawable.gir: libdrawable.la drawable.h $(SCANNER) $(SCANNER_LIBS) foo.gir: libfoo.la foo.h $(SCANNER) $(SCANNER_LIBS) $(CHECK_DEBUG) $(SCANNER) -v \ - --include=$(top_srcdir)/gir/glib-2.0.gir \ - --include=$(top_srcdir)/gir/gobject-2.0.gir \ + --include=$(top_srcdir)/gir/GLib.gir \ + --include=$(top_srcdir)/gir/GObject.gir \ --include=$(top_builddir)/tests/scanner/utility.gir \ --library=libfoo.la \ --namespace=foo \ @@ -69,8 +69,8 @@ foo.gir: libfoo.la foo.h $(SCANNER) $(SCANNER_LIBS) utility.gir: libutility.la utility.h $(SCANNER) $(SCANNER_LIBS) $(CHECK_DEBUG) $(SCANNER) -v \ - --include=$(top_srcdir)/gir/glib-2.0.gir \ - --include=$(top_srcdir)/gir/gobject-2.0.gir \ + --include=$(top_srcdir)/gir/GLib.gir \ + --include=$(top_srcdir)/gir/GObject.gir \ --library=libutility.la \ --namespace=utility \ --pkg gobject-2.0 \ -- 2.7.4