[gobject-introspection/wip/carlosg/girdir-pc-var] build: Make girdir in .pc files relative to ${datadir} by default



commit 250afc2e1d614cd7ab852ba4278194468ced09e1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 10 13:24:09 2018 +0200

    build: Make girdir in .pc files relative to ${datadir} by default
    
    This was the de facto behavior, and is already relied upon. If
    gir-dir-prefix is specified, the gir dir will rely on the more generic
    ${prefix} location.
    
    Also, avoid expanding the path unless necessary in the autotools build.
    
    https://gitlab.gnome.org/GNOME/gobject-introspection/issues/236

 configure.ac                              | 13 +++++++++++--
 gobject-introspection-1.0.pc.in           |  2 +-
 gobject-introspection-no-export-1.0.pc.in |  2 +-
 meson.build                               | 10 +++++++---
 4 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 60506947..2df0e2de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,9 +116,18 @@ AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
 
 AC_ARG_WITH([gir-dir-prefix],
                [AS_HELP_STRING([--with-gir-dir-prefix], [Directory prefix for gir installation])],
-               [GIR_DIR_PREFIX="$withval"], [GIR_DIR_PREFIX="$EXPANDED_DATADIR"])
-GIR_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
+               [GIR_DIR_PREFIX="$withval"], [])
+
+if test -z $GIR_DIR_PREFIX; then
+        GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
+        GIR_PC_DIR="\${datadir}/$GIR_SUFFIX"
+else
+        GIR_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
+        GIR_PC_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
+fi
+
 AC_SUBST(GIR_DIR)
+AC_SUBST(GIR_PC_DIR)
 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Directory prefix for gir installation])
 
 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.58.0])
diff --git a/gobject-introspection-1.0.pc.in b/gobject-introspection-1.0.pc.in
index 3409856c..1036f90c 100644
--- a/gobject-introspection-1.0.pc.in
+++ b/gobject-introspection-1.0.pc.in
@@ -10,7 +10,7 @@ g_ir_scanner=${bindir}/g-ir-scanner
 g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
 g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
 gidatadir=${datadir}/gobject-introspection-1.0
-girdir=@GIR_DIR@
+girdir=@GIR_PC_DIR@
 typelibdir=${libdir}/girepository-1.0
 
 Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
diff --git a/gobject-introspection-no-export-1.0.pc.in b/gobject-introspection-no-export-1.0.pc.in
index 745aaade..bde4faf6 100644
--- a/gobject-introspection-no-export-1.0.pc.in
+++ b/gobject-introspection-no-export-1.0.pc.in
@@ -9,7 +9,7 @@ includedir=@includedir@
 g_ir_scanner=${bindir}/g-ir-scanner
 g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
 g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
-girdir=@GIR_DIR@
+girdir=@GIR_PC_DIR@
 typelibdir=${libdir}/girepository-1.0
 
 Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
diff --git a/meson.build b/meson.build
index 78585a90..4022e319 100644
--- a/meson.build
+++ b/meson.build
@@ -20,9 +20,13 @@ config = configuration_data()
 config.set_quoted('GIR_SUFFIX', 'gir-1.0')
 gir_dir_prefix = get_option('gir-dir-prefix')
 if gir_dir_prefix == ''
-    gir_dir_prefix = get_option('datadir')
+    gir_dir_prefix = join_paths(get_option('prefix'), get_option('datadir'))
+    gir_dir_pc_prefix = '${datadir}'
+else
+    gir_dir_prefix = join_paths(get_option('prefix'), gir_dir_prefix)
+    gir_dir_pc_prefix = join_paths('${prefix}', gir_dir_prefix)
 endif
-girdir = join_paths(get_option('prefix'), gir_dir_prefix, 'gir-1.0')
+girdir = join_paths(gir_dir_prefix, 'gir-1.0')
 config.set_quoted('GIR_DIR', girdir)
 config.set_quoted('GOBJECT_INTROSPECTION_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
 
@@ -98,7 +102,7 @@ pkgconfig_conf.set('libdir', join_paths('${prefix}', get_option('libdir')))
 pkgconfig_conf.set('datarootdir', join_paths('${prefix}', get_option('datadir')))
 pkgconfig_conf.set('datadir', '${datarootdir}')
 pkgconfig_conf.set('includedir', join_paths('${prefix}', get_option('includedir')))
-pkgconfig_conf.set('GIR_DIR', join_paths('${prefix}', gir_dir_prefix, 'gir-1.0'))
+pkgconfig_conf.set('GIR_PC_DIR', join_paths(gir_dir_pc_prefix, 'gir-1.0'))
 if host_system == 'windows' or host_system == 'cygwin'
   pkgconfig_conf.set('EXEEXT', '.exe')
 else


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