Make g-ir-compiler find files installed by make install

When ./configure --prefix $HOME/some/where is used gobject-introspection
will happily install the files into $HOME/some/where/data/gir-1.0 but
it will refuse to find them. Apply the same trick as in
girepository/girepository.c:init_globals to find the gir files.

Unifiy the name gir-1.0 in GIR_SUFFIX and use it throughout the
project, introduce GIR_DIR which holds the path to the gir files and
update girparser and transformer.py to look into this path.
This commit is contained in:
Holger Hans Peter Freyther 2009-06-01 09:18:43 +02:00 committed by Colin Walters
parent 7f29f620a4
commit 5917b5ba42

View File

@ -27,6 +27,7 @@
#include "girmodule.h" #include "girmodule.h"
#include "girnode.h" #include "girnode.h"
#include "gtypelib.h" #include "gtypelib.h"
#include "config.h"
struct _GIrParser struct _GIrParser
{ {
@ -245,13 +246,18 @@ locate_gir (GIrParser *parser,
} }
for (dir = datadirs; *dir; dir++) for (dir = datadirs; *dir; dir++)
{ {
path = g_build_filename (*dir, "gir-1.0", girname, NULL); path = g_build_filename (*dir, GIR_SUFFIX, girname, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
return path; return path;
g_free (path); g_free (path);
path = NULL; path = NULL;
} }
return path;
path = g_build_filename (GIR_DIR, girname, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
return path;
g_free (path);
return NULL;
} }
#define MISSING_ATTRIBUTE(ctx,error,element,attribute) \ #define MISSING_ATTRIBUTE(ctx,error,element,attribute) \