diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2018-10-09 07:02:33 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2018-10-09 07:02:33 +0000 |
commit | 65f7051bda63ec2ad50a42334b95ea22790f7eec (patch) | |
tree | 3d9b6f3cd2fe0aca639f2429012a5b5dbc7bfdef | |
parent | 54e12c0182cfce6bf90b35b2781d18f53c8263cb (diff) | |
parent | 3fe995a0d38158e0ffde9772ed52fa87608ac084 (diff) | |
download | gobject-introspection-65f7051bda63ec2ad50a42334b95ea22790f7eec.tar.gz |
Merge branch 'master' into 'master'
Add option to make .gir files installation paths configurable
See merge request GNOME/gobject-introspection!63
-rw-r--r-- | .flake8 | 2 | ||||
-rw-r--r-- | Makefile-tools.am | 2 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | gir/meson.build | 1 | ||||
-rw-r--r-- | giscanner/transformer.py | 1 | ||||
-rw-r--r-- | gobject-introspection-1.0.pc.in | 2 | ||||
-rw-r--r-- | gobject-introspection-no-export-1.0.pc.in | 2 | ||||
-rw-r--r-- | meson.build | 8 | ||||
-rw-r--r-- | meson_options.txt | 4 | ||||
-rw-r--r-- | tests/warn/warningtester.py | 1 | ||||
-rwxr-xr-x | tools/g-ir-tool-template.in | 10 | ||||
-rw-r--r-- | tools/meson.build | 1 |
12 files changed, 33 insertions, 8 deletions
@@ -1,4 +1,4 @@ [flake8] ignore=E127,E402,E501,E731,E128,W503,E741 exclude=misc,subprojects -builtins=DATADIR +builtins=DATADIR,GIRDIR diff --git a/Makefile-tools.am b/Makefile-tools.am index c70d9850..fcaf1e01 100644 --- a/Makefile-tools.am +++ b/Makefile-tools.am @@ -9,7 +9,7 @@ EXTRA_DIST += \ tools/g-ir-tool-template.in \ tools/meson.build -TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON), +TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON), -e s,@GIR_DIR\@,$(GIR_DIR),g g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile $(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@ diff --git a/configure.ac b/configure.ac index b4294c57..60506947 100644 --- a/configure.ac +++ b/configure.ac @@ -114,9 +114,12 @@ GIR_SUFFIX="gir-1.0" AC_SUBST(GIR_SUFFIX) AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory]) -GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX" +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" AC_SUBST(GIR_DIR) -AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation]) +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/gir/meson.build b/gir/meson.build index 607bbc45..1cb514a1 100644 --- a/gir/meson.build +++ b/gir/meson.build @@ -34,7 +34,6 @@ gir_files = [ ] typelibdir = join_paths(get_option('libdir'), 'girepository-1.0') -girdir = join_paths(get_option('datadir'), 'gir-1.0') install_data(gir_files, install_dir: girdir) scanner_command = [ diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 335e229f..2c412339 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -184,6 +184,7 @@ None.""" def _get_gi_data_dirs(self): data_dirs = utils.get_system_data_dirs() data_dirs.append(DATADIR) + data_dirs.append(GIRDIR) if os.name != 'nt': # For backwards compatibility, was always unconditionally added to the list. data_dirs.append('/usr/share') diff --git a/gobject-introspection-1.0.pc.in b/gobject-introspection-1.0.pc.in index a08b5d27..3409856c 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=${datadir}/gir-1.0 +girdir=@GIR_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 d214d22d..745aaade 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=${datadir}/gir-1.0 +girdir=@GIR_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 3f5d970d..78585a90 100644 --- a/meson.build +++ b/meson.build @@ -18,7 +18,12 @@ python = pymod.find_installation(get_option('python')) cc = meson.get_compiler('c') config = configuration_data() config.set_quoted('GIR_SUFFIX', 'gir-1.0') -config.set_quoted('GIR_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'gir-1.0')) +gir_dir_prefix = get_option('gir-dir-prefix') +if gir_dir_prefix == '' + gir_dir_prefix = get_option('datadir') +endif +girdir = join_paths(get_option('prefix'), 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'))) foreach type : ['char', 'short', 'int', 'long'] @@ -93,6 +98,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')) if host_system == 'windows' or host_system == 'cygwin' pkgconfig_conf.set('EXEEXT', '.exe') else diff --git a/meson_options.txt b/meson_options.txt index 49726be6..ee6958dd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -21,3 +21,7 @@ option('cairo-libname', type: 'string', option('python', type: 'string', value: 'python3', description: 'Path or name of the Python interpreter to build for' ) + +option('gir-dir-prefix', type: 'string', + description: 'Intermediate prefix for gir installation under ${prefix}' +) diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index f17c8889..be5aec13 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -18,6 +18,7 @@ sys.path.insert(0, path) # Not correct, but enough to get the tests going uninstalled builtins.__dict__['DATADIR'] = path +builtins.__dict__['GIRDIR'] = '' from giscanner.annotationparser import GtkDocCommentBlockParser from giscanner.ast import Include, Namespace diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in index ed33d16b..b9cf0911 100755 --- a/tools/g-ir-tool-template.in +++ b/tools/g-ir-tool-template.in @@ -60,6 +60,16 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')): builtins.__dict__['DATADIR'] = datadir +# Respect gir_dir_prefix for meson and autotools +girdir = '' +# for meson +if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'): + girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@')) +# for autotools +elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'): + girdir = os.path.dirname(os.path.abspath('@GIR_DIR@')) +builtins.__dict__['GIRDIR'] = girdir + # Again, relative paths first so that the installation prefix is relocatable pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection')) diff --git a/tools/meson.build b/tools/meson.build index 912eb6ba..b45ce668 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -20,6 +20,7 @@ foreach tool : tools tools_conf = configuration_data() tools_conf.set('libdir', libdir_abs) tools_conf.set('datarootdir', datadir_abs) + tools_conf.set('gir_dir_prefix', gir_dir_prefix) tools_conf.set('PYTHON_CMD', python_cmd) tools_conf.set('TOOL_MODULE', tool[1]) |