Bug 557076 - move typelibs to $libdir
authorColin Walters <walters@src.gnome.org>
Sat, 25 Oct 2008 14:59:25 +0000 (14:59 +0000)
committerColin Walters <walters@src.gnome.org>
Sat, 25 Oct 2008 14:59:25 +0000 (14:59 +0000)
svn path=/trunk/; revision=813

ChangeLog
acinclude.m4 [new file with mode: 0644]
configure.ac
gir/Makefile.am
girepository/girepository.c

index c47bac7..0143572 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-10-25  Colin Walters  <walters@verbum.org>
+
+       Bug 557076 - move typelibs to $libdir
+
+       * configure.ac: Steal some configury bits from dbus to expand
+       libdir.
+       * gir/Makefile.am: Move to libdir.
+       * girepository/girepository.c: Stop searching XDG_DATA_DIRS;
+       instead just look at one hardcoded path in libdir.
+       * acinclude.m4: Bits from dbus.
+
 2008-10-24  Johan Dahlin  <johan@gnome.org>
 
        * girepository/girnode.c (g_ir_node_check_unhandled_members):
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..deebd2b
--- /dev/null
@@ -0,0 +1,49 @@
+dnl as-ac-expand.m4 0.2.0                                   -*- autoconf -*-
+dnl autostars m4 macro for expanding directories using configure's prefix
+
+dnl (C) 2003, 2004, 2005 Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl Copying and distribution of this file, with or without modification,
+dnl are permitted in any medium without royalty provided the copyright
+dnl notice and this notice are preserved.
+
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
+
+dnl example:
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
+
+AC_DEFUN([AS_AC_EXPAND],
+[
+  EXP_VAR=[$1]
+  FROM_VAR=[$2]
+
+  dnl first expand prefix and exec_prefix if necessary
+  prefix_save=$prefix
+  exec_prefix_save=$exec_prefix
+
+  dnl if no prefix given, then use /usr/local, the default prefix
+  if test "x$prefix" = "xNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  dnl if no exec_prefix given, then use prefix
+  if test "x$exec_prefix" = "xNONE"; then
+    exec_prefix=$prefix
+  fi
+
+  full_var="$FROM_VAR"
+  dnl loop until it doesn't change anymore
+  while true; do
+    new_full_var="`eval echo $full_var`"
+    if test "x$new_full_var" = "x$full_var"; then break; fi
+    full_var=$new_full_var
+  done
+
+  dnl clean up
+  full_var=$new_full_var
+  AC_SUBST([$1], "$full_var")
+
+  dnl restore prefix and exec_prefix
+  prefix=$prefix_save
+  exec_prefix=$exec_prefix_save
+])
index 5202bdc..b7de397 100644 (file)
@@ -88,6 +88,22 @@ if test "X$SHLIB_SUFFIX" = x; then
 fi
 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], "$SHLIB_SUFFIX", [Define to the platform's shared library suffix])
 
+# Copied from dbus configure.in
+#### find the actual value for $prefix that we'll end up with
+##   (I know this is broken and should be done in the Makefile, but
+##    that's a major pain and almost nobody actually seems to care)
+AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
+AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
+AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
+AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
+AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
+AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
+
+#### Directory to install the libexec binaries
+GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
+AC_SUBST(GOBJECT_INTROSPECTION_LIBDIR)
+AC_DEFINE_UNQUOTED(GOBJECT_INTROSPECTION_LIBDIR,"$GOBJECT_INTROSPECTION_LIBDIR", [Directory prefix for typelib installation])
+
 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
 
 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gthread-2.0])
index 4847302..f2f1d11 100644 (file)
@@ -121,7 +121,7 @@ dist_gir_DATA = $(BUILT_SOURCES)
 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
        $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $@
 
-typelibsdir = $(datadir)/girepository
+typelibsdir = $(libdir)/girepository
 typelibs_DATA = GLib-2.0.typelib GModule-2.0.typelib GObject-2.0.typelib Gio-2.0.typelib
 CLEANFILES += $(typelibs_DATA)
 
index 3e90953..2babec5 100644 (file)
@@ -31,6 +31,8 @@
 #include "girepository.h"
 #include "gtypelib.h"
 
+#include "config.h"
+
 static GStaticMutex globals_lock = G_STATIC_MUTEX_INIT;
 static GIRepository *default_repository = NULL;
 static GSList *search_path = NULL;
@@ -91,8 +93,8 @@ init_globals ()
 
   if (search_path == NULL)
     {
-      const gchar *const *datadirs;
-      const gchar *const *dir;
+      const char *libdir;
+      char *typelib_dir;
       const gchar *type_lib_path_env;
 
       type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
@@ -116,13 +118,11 @@ init_globals ()
           g_free (custom_dirs);
         }
 
-      datadirs = g_get_system_data_dirs ();
+      libdir = GOBJECT_INTROSPECTION_LIBDIR;
 
-      for (dir = datadirs; *dir; dir++)
-        {
-          char *path = g_build_filename (*dir, "girepository", NULL);
-          search_path = g_slist_prepend (search_path, path);
-        }
+      typelib_dir = g_build_filename (libdir, "girepository", NULL);
+
+      search_path = g_slist_prepend (search_path, typelib_dir);
 
       search_path = g_slist_reverse (search_path);
     }