[gobject-introspection] meson: install everything.c/h like with autotools



commit 00a9916668b57b7ace1ddba49be73a9356afdb1c
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Mon Dec 17 19:30:11 2018 +0100

    meson: install everything.c/h like with autotools
    
    This requires a code change in codegen.py to support the case whre output files
    are not installed in the working directory. Instead of using the output
    path for the header include use the relative path to the output source file.

 giscanner/codegen.py | 5 ++++-
 tests/meson.build    | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/codegen.py b/giscanner/codegen.py
index ce07aaa1..138acf72 100644
--- a/giscanner/codegen.py
+++ b/giscanner/codegen.py
@@ -18,6 +18,7 @@
 # Boston, MA 02111-1307, USA.
 #
 
+import os
 from contextlib import contextmanager
 
 from . import ast
@@ -142,7 +143,9 @@ class CCodeGenerator(object):
         for header in self.include_first_src:
             self.out_c.write("""#include "%s"\n""" % header)
 
-        self.out_c.write("""#include "%s"\n\n""" % (self.out_h_filename, ))
+        src_dir = os.path.dirname(os.path.realpath(self.out_c.name))
+        header = os.path.relpath(self.out_h_filename, src_dir)
+        self.out_c.write("""#include "%s"\n\n""" % (header, ))
 
         for header in self.include_last_src:
             self.out_c.write("""#include "%s"\n""" % header)
diff --git a/tests/meson.build b/tests/meson.build
index 9ddf5ef1..7e633f29 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -23,7 +23,9 @@ installed_sources = [
   'gitestmacros.h',
 ]
 
-install_data(installed_sources, install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0', 
'tests'))
+test_install_dir = join_paths(get_option('datadir'), 'gobject-introspection-1.0', 'tests')
+
+install_data(installed_sources, install_dir: test_install_dir)
 
 # Generate everything.h and everything.c:
 test_everything_files = custom_target('everything',
@@ -36,7 +38,9 @@ test_everything_files = custom_target('everything',
     '--function-decoration=_GI_TEST_EXTERN',
     '--include-first-in-src=config.h',
     '--include-last-in-header=gitestmacros.h',
-  ]
+  ],
+  install: true,
+  install_dir: test_install_dir,
 )
 
 test_everything_headers = [test_everything_files[0]]


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