Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 1 | meson: add option introspection |
| 2 | |
| 3 | Add an option 'introspection' for meson which could control whether |
| 4 | build GIR files or not. |
| 5 | |
| 6 | Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/libsecret/-/merge_requests/53] |
| 7 | |
| 8 | Signed-off-by: Kai Kang <kai.kang@windriver.com> |
| 9 | --- |
| 10 | libsecret/meson.build | 86 ++++++++++++++++++++++--------------------- |
| 11 | meson.build | 1 + |
| 12 | meson_options.txt | 1 + |
| 13 | 3 files changed, 46 insertions(+), 42 deletions(-) |
| 14 | |
| 15 | diff --git a/libsecret/meson.build b/libsecret/meson.build |
| 16 | index 759b5ef..2ee8850 100644 |
| 17 | --- a/libsecret/meson.build |
| 18 | +++ b/libsecret/meson.build |
| 19 | @@ -104,50 +104,52 @@ libsecret_dep = declare_dependency( |
| 20 | ) |
| 21 | |
| 22 | # GObject Introspection |
| 23 | -libsecret_gir_sources = [ |
| 24 | - 'secret-attributes.c', |
| 25 | - 'secret-attributes.h', |
| 26 | - 'secret-backend.c', |
| 27 | - 'secret-backend.h', |
| 28 | - 'secret-collection.c', |
| 29 | - 'secret-collection.h', |
| 30 | - 'secret-item.c', |
| 31 | - 'secret-item.h', |
| 32 | - 'secret-methods.c', |
| 33 | - 'secret-password.c', |
| 34 | - 'secret-password.h', |
| 35 | - 'secret-paths.c', |
| 36 | - 'secret-paths.h', |
| 37 | - 'secret-prompt.c', |
| 38 | - 'secret-prompt.h', |
| 39 | - 'secret-retrievable.c', |
| 40 | - 'secret-retrievable.h', |
| 41 | - 'secret-schema.c', |
| 42 | - 'secret-schema.h', |
| 43 | - 'secret-schemas.c', |
| 44 | - 'secret-schemas.h', |
| 45 | - 'secret-service.c', |
| 46 | - 'secret-service.h', |
| 47 | - 'secret-types.h', |
| 48 | - 'secret-value.c', |
| 49 | - 'secret-value.h', |
| 50 | -] |
| 51 | -libsecret_gir_sources += version_h |
| 52 | -libsecret_gir_sources += _enums_generated |
| 53 | - |
| 54 | -libsecret_gir = gnome.generate_gir(libsecret, |
| 55 | - sources: libsecret_gir_sources, |
| 56 | - namespace: 'Secret', |
| 57 | - nsversion: api_version_major, |
| 58 | - export_packages: 'libsecret-@0@'.format(api_version_major), |
| 59 | - includes: [ 'GObject-2.0', 'Gio-2.0' ], |
| 60 | - header: 'libsecret/secret.h', |
| 61 | - extra_args: [ '-D SECRET_COMPILATION'], |
| 62 | - install: true, |
| 63 | -) |
| 64 | +if with_gir |
| 65 | + libsecret_gir_sources = [ |
| 66 | + 'secret-attributes.c', |
| 67 | + 'secret-attributes.h', |
| 68 | + 'secret-backend.c', |
| 69 | + 'secret-backend.h', |
| 70 | + 'secret-collection.c', |
| 71 | + 'secret-collection.h', |
| 72 | + 'secret-item.c', |
| 73 | + 'secret-item.h', |
| 74 | + 'secret-methods.c', |
| 75 | + 'secret-password.c', |
| 76 | + 'secret-password.h', |
| 77 | + 'secret-paths.c', |
| 78 | + 'secret-paths.h', |
| 79 | + 'secret-prompt.c', |
| 80 | + 'secret-prompt.h', |
| 81 | + 'secret-retrievable.c', |
| 82 | + 'secret-retrievable.h', |
| 83 | + 'secret-schema.c', |
| 84 | + 'secret-schema.h', |
| 85 | + 'secret-schemas.c', |
| 86 | + 'secret-schemas.h', |
| 87 | + 'secret-service.c', |
| 88 | + 'secret-service.h', |
| 89 | + 'secret-types.h', |
| 90 | + 'secret-value.c', |
| 91 | + 'secret-value.h', |
| 92 | + ] |
| 93 | + libsecret_gir_sources += version_h |
| 94 | + libsecret_gir_sources += _enums_generated |
| 95 | + |
| 96 | + libsecret_gir = gnome.generate_gir(libsecret, |
| 97 | + sources: libsecret_gir_sources, |
| 98 | + namespace: 'Secret', |
| 99 | + nsversion: api_version_major, |
| 100 | + export_packages: 'libsecret-@0@'.format(api_version_major), |
| 101 | + includes: [ 'GObject-2.0', 'Gio-2.0' ], |
| 102 | + header: 'libsecret/secret.h', |
| 103 | + extra_args: [ '-D SECRET_COMPILATION'], |
| 104 | + install: true, |
| 105 | + ) |
| 106 | +endif |
| 107 | |
| 108 | # Vapi |
| 109 | -if with_vapi |
| 110 | +if with_vapi and with_gir |
| 111 | libsecret_vapi = gnome.generate_vapi('libsecret-@0@'.format(api_version_major), |
| 112 | sources: libsecret_gir[0], |
| 113 | metadata_dirs: meson.source_root() / 'libsecret', |
| 114 | diff --git a/meson.build b/meson.build |
| 115 | index a26d046..d22e008 100644 |
| 116 | --- a/meson.build |
| 117 | +++ b/meson.build |
| 118 | @@ -22,6 +22,7 @@ with_gcrypt = get_option('gcrypt') |
| 119 | enable_debug = get_option('debugging') |
| 120 | with_vapi = get_option('vapi') |
| 121 | with_gtkdoc = get_option('gtk_doc') |
| 122 | +with_gir = get_option('introspection') |
| 123 | |
| 124 | # Some variables |
| 125 | config_h_dir = include_directories('.') |
| 126 | diff --git a/meson_options.txt b/meson_options.txt |
| 127 | index c1fda5d..445aeb0 100644 |
| 128 | --- a/meson_options.txt |
| 129 | +++ b/meson_options.txt |
| 130 | @@ -3,3 +3,4 @@ option('gcrypt', type: 'boolean', value: true, description: 'With gcrypt and tra |
| 131 | option('debugging', type: 'boolean', value: false, description: 'Turn debugging on/off') |
| 132 | option('vapi', type: 'boolean', value: true, description: 'Create VAPI file.') |
| 133 | option('gtk_doc', type: 'boolean', value: true, description: 'Build reference documentation using gtk-doc') |
| 134 | +option('introspection', type: 'boolean', value: true, description: 'Create GIR file.') |
| 135 | -- |
| 136 | 2.17.1 |
| 137 | |