libgnt/libgnt

Add an option to disable python2 support
release-2.x.y
2021-09-23, Gary Kramlich
ec210e0a9332
Parents 757982d6c981
Children 2374624f79fe
Add an option to disable python2 support

Testing Done:
Compiled with no arguments, `-Dpython2=true`, and `-Dpython2=false` and verified the build was successful and was only linked to libpython2 when it should have been via ldd.

Bugs closed: LIBGNT-16

Reviewed at https://reviews.imfreedom.org/r/930/
--- a/meson.build Tue Aug 03 00:37:31 2021 -0500
+++ b/meson.build Thu Sep 23 23:13:30 2021 -0500
@@ -27,7 +27,7 @@
project('libgnt', 'c',
version : '2.14.3-dev',
- meson_version : '>=0.41.0')
+ meson_version : '>=0.44.0')
gnt_soversion = 0
parts = meson.project_version().split('-')
@@ -191,11 +191,18 @@
]
# Check for Python headers
-python_dep = dependency('python2', required : false)
-if not python_dep.found()
- python_dep = dependency('python-2.7', required : false)
+python_dep = disabler()
+if get_option('python2')
+ python_dep = dependency('python2', required : false)
+ if not python_dep.found()
+ python_dep = dependency('python-2.7', required : false)
+ endif
+
+ if not python_dep.found()
+ error('failed to find python')
+ endif
endif
-gnt_config.set('USE_PYTHON', python_dep.found())
+gnt_config.set('USE_PYTHON', get_option('python2'))
configure_file(output : 'gntconfig.h',
configuration : gnt_config)
@@ -213,13 +220,17 @@
install_dir : join_paths(get_option('includedir'), 'gnt'))
libgnt_inc = include_directories('.')
+libgnt_dependencies= [ncurses, libxml, glib, gobject, gmodule]
+if get_option('python2')
+ libgnt_dependencies += python_dep
+endif
libgnt = library('gnt',
libgnt_SOURCES + gntmarshal,
install : true,
version : '@0@.@1@.@2@'.format(gnt_soversion,
gnt_minor_version,
gnt_micro_version),
- dependencies : [ncurses, libxml, glib, gobject, gmodule, python_dep])
+ dependencies : libgnt_dependencies)
libgnt_dep = declare_dependency(
include_directories : libgnt_inc,
link_with : libgnt,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson_options.txt Thu Sep 23 23:13:30 2021 -0500
@@ -0,0 +1,6 @@
+option(
+ 'python2',
+ type: 'boolean', value: true,
+ description: 'Whether or not to include python support.',
+)
+