build: features need to be enabled
For meson we dont just check for the presence of a dependency and then auto enable it. Users must enable features explicit. This helps with having deterministic results. Also remove the general `plugins` switch which was used to enable/disable both python and c plugins. Users can just use those switches.
This commit is contained in:
157
meson.build
157
meson.build
@@ -149,18 +149,16 @@ endif
|
|||||||
libnotify_dep = dependency('', required: false)
|
libnotify_dep = dependency('', required: false)
|
||||||
have_osxnotify = false
|
have_osxnotify = false
|
||||||
|
|
||||||
if get_option('notifications').enabled() or get_option('notifications').auto()
|
if get_option('notifications').enabled()
|
||||||
if platform == 'osx'
|
if platform == 'osx'
|
||||||
terminal_notifier = find_program('terminal-notifier', required: get_option('notifications'))
|
terminal_notifier = find_program('terminal-notifier', required: true)
|
||||||
if terminal_notifier.found()
|
have_osxnotify = true
|
||||||
have_osxnotify = true
|
conf_data.set('HAVE_OSXNOTIFY', 1)
|
||||||
conf_data.set('HAVE_OSXNOTIFY', 1)
|
|
||||||
endif
|
|
||||||
elif platform == 'nix' or platform == 'freebsd'
|
elif platform == 'nix' or platform == 'freebsd'
|
||||||
libnotify_dep = dependency('libnotify', required: get_option('notifications'))
|
libnotify_dep = dependency('libnotify', required: true)
|
||||||
if libnotify_dep.found()
|
conf_data.set('HAVE_LIBNOTIFY', 1)
|
||||||
conf_data.set('HAVE_LIBNOTIFY', 1)
|
else
|
||||||
endif
|
error('Notifications not supported on this platform')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -168,18 +166,15 @@ endif
|
|||||||
gtk_dep = dependency('', required: false)
|
gtk_dep = dependency('', required: false)
|
||||||
gtk_version = 'none'
|
gtk_version = 'none'
|
||||||
|
|
||||||
if get_option('icons-and-clipboard').enabled() or get_option('icons-and-clipboard').auto()
|
if get_option('icons-and-clipboard').enabled()
|
||||||
gtk_dep = dependency('gtk+-3.0', version: '>= 3.24.0', required: false)
|
gtk_dep = dependency('gtk+-3.0', version: '>= 3.24.0', required: false)
|
||||||
if gtk_dep.found()
|
if gtk_dep.found()
|
||||||
conf_data.set('HAVE_GTK', 1)
|
conf_data.set('HAVE_GTK', 1)
|
||||||
gtk_version = gtk_dep.version()
|
gtk_version = gtk_dep.version()
|
||||||
else
|
else
|
||||||
gtk_dep = dependency('gtk+-2.0', version: '>= 2.24.10',
|
gtk_dep = dependency('gtk+-2.0', version: '>= 2.24.10', required: true)
|
||||||
required: get_option('icons-and-clipboard'))
|
conf_data.set('HAVE_GTK', 1)
|
||||||
if gtk_dep.found()
|
gtk_version = gtk_dep.version()
|
||||||
conf_data.set('HAVE_GTK', 1)
|
|
||||||
gtk_version = gtk_dep.version()
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -188,24 +183,19 @@ endif
|
|||||||
xscrnsaver_found = false
|
xscrnsaver_found = false
|
||||||
xscrnsaver_dep = []
|
xscrnsaver_dep = []
|
||||||
|
|
||||||
if get_option('xscreensaver').enabled() or get_option('xscreensaver').auto()
|
if get_option('xscreensaver').enabled()
|
||||||
xss_dep = dependency('xscrnsaver', required: false)
|
xss_dep = dependency('xscrnsaver', required: true)
|
||||||
x11_dep = dependency('x11', required: false)
|
x11_dep = dependency('x11', required: true)
|
||||||
|
xscrnsaver_dep = [xss_dep, x11_dep]
|
||||||
if xss_dep.found() and x11_dep.found()
|
xscrnsaver_found = true
|
||||||
xscrnsaver_dep = [xss_dep, x11_dep]
|
conf_data.set('HAVE_LIBXSS', 1)
|
||||||
xscrnsaver_found = true # Set our tracker to true
|
|
||||||
conf_data.set('HAVE_LIBXSS', 1)
|
|
||||||
elif get_option('xscreensaver').enabled()
|
|
||||||
error('xscreensaver support requested but xscrnsaver or x11 not found')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Python plugins
|
# Python plugins
|
||||||
python_dep = dependency('', required: false)
|
python_dep = dependency('', required: false)
|
||||||
build_python_api = false
|
build_python_api = false
|
||||||
|
|
||||||
if not get_option('plugins').disabled() and not get_option('python-plugins').disabled()
|
if get_option('python-plugins').enabled()
|
||||||
if platform == 'osx'
|
if platform == 'osx'
|
||||||
# Handle Python framework on macOS
|
# Handle Python framework on macOS
|
||||||
python_framework = get_option('python_framework')
|
python_framework = get_option('python_framework')
|
||||||
@@ -216,36 +206,30 @@ if not get_option('plugins').disabled() and not get_option('python-plugins').dis
|
|||||||
|
|
||||||
python_dep = dependency('python-embed', required: false)
|
python_dep = dependency('python-embed', required: false)
|
||||||
if not python_dep.found()
|
if not python_dep.found()
|
||||||
python_dep = dependency('python3-embed', required: false)
|
python_dep = dependency('python3-embed', required: true)
|
||||||
if python_dep.found()
|
conf_data.set('PY_IS_PYTHON3', 1)
|
||||||
conf_data.set('PY_IS_PYTHON3', 1)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if python_dep.found()
|
build_python_api = true
|
||||||
build_python_api = true
|
conf_data.set('HAVE_PYTHON', 1)
|
||||||
conf_data.set('HAVE_PYTHON', 1)
|
|
||||||
elif get_option('python-plugins').enabled()
|
|
||||||
error('Python plugins enabled but Python not found')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# C plugins
|
# C plugins
|
||||||
dl_dep = dependency('', required: false)
|
dl_dep = dependency('', required: false)
|
||||||
build_c_api = false
|
build_c_api = false
|
||||||
|
|
||||||
if platform != 'cygwin'
|
if get_option('c-plugins').enabled()
|
||||||
if not get_option('plugins').disabled() and not get_option('c-plugins').disabled()
|
if platform == 'cygwin'
|
||||||
if platform == 'openbsd' or platform == 'freebsd' or platform == 'netbsd'
|
error('C plugins are not supported on Cygwin')
|
||||||
build_c_api = true
|
endif
|
||||||
conf_data.set('HAVE_C', 1)
|
|
||||||
else
|
if platform == 'openbsd' or platform == 'freebsd' or platform == 'netbsd'
|
||||||
dl_dep = cc.find_library('dl', required: get_option('c-plugins'))
|
build_c_api = true
|
||||||
if dl_dep.found()
|
conf_data.set('HAVE_C', 1)
|
||||||
build_c_api = true
|
else
|
||||||
conf_data.set('HAVE_C', 1)
|
dl_dep = cc.find_library('dl', required: true)
|
||||||
endif
|
build_c_api = true
|
||||||
endif
|
conf_data.set('HAVE_C', 1)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -253,45 +237,34 @@ endif
|
|||||||
gpgme_dep = dependency('', required: false)
|
gpgme_dep = dependency('', required: false)
|
||||||
build_pgp = false
|
build_pgp = false
|
||||||
|
|
||||||
if not get_option('pgp').disabled()
|
if get_option('pgp').enabled()
|
||||||
gpgme_dep = cc.find_library('gpgme', required: false)
|
gpgme_dep = cc.find_library('gpgme', required: true)
|
||||||
|
|
||||||
if gpgme_dep.found()
|
gpgme_config = find_program('gpgme-config', required: true)
|
||||||
gpgme_config = find_program('gpgme-config', required: false)
|
gpgme_cflags = run_command(gpgme_config, '--cflags', check: true).stdout().strip()
|
||||||
if gpgme_config.found()
|
gpgme_libs = run_command(gpgme_config, '--libs', check: true).stdout().strip()
|
||||||
gpgme_cflags = run_command(gpgme_config, '--cflags', check: true).stdout().strip()
|
add_project_arguments(gpgme_cflags.split(), language: 'c')
|
||||||
gpgme_libs = run_command(gpgme_config, '--libs', check: true).stdout().strip()
|
|
||||||
add_project_arguments(gpgme_cflags.split(), language: 'c')
|
build_pgp = true
|
||||||
endif
|
conf_data.set('HAVE_LIBGPGME', 1)
|
||||||
|
|
||||||
build_pgp = true
|
|
||||||
conf_data.set('HAVE_LIBGPGME', 1)
|
|
||||||
elif get_option('pgp').enabled()
|
|
||||||
error('PGP support enabled but libgpgme not found')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# OTR support
|
# OTR support
|
||||||
libotr_dep = dependency('', required: false)
|
libotr_dep = dependency('', required: false)
|
||||||
build_otr = false
|
build_otr = false
|
||||||
|
|
||||||
if not get_option('otr').disabled()
|
if get_option('otr').enabled()
|
||||||
libotr_dep = dependency('libotr', version: '>= 4.0', required: get_option('otr'))
|
libotr_dep = dependency('libotr', version: '>= 4.0', required: true)
|
||||||
if libotr_dep.found()
|
build_otr = true
|
||||||
build_otr = true
|
conf_data.set('HAVE_LIBOTR', 1)
|
||||||
conf_data.set('HAVE_LIBOTR', 1)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# GDK Pixbuf (for avatar scaling)
|
# GDK Pixbuf (for avatar scaling)
|
||||||
gdk_pixbuf_dep = dependency('', required: false)
|
gdk_pixbuf_dep = dependency('', required: false)
|
||||||
|
|
||||||
if not get_option('gdk-pixbuf').disabled()
|
if get_option('gdk-pixbuf').enabled()
|
||||||
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.4',
|
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.4', required: true)
|
||||||
required: get_option('gdk-pixbuf'))
|
conf_data.set('HAVE_PIXBUF', 1)
|
||||||
if gdk_pixbuf_dep.found()
|
|
||||||
conf_data.set('HAVE_PIXBUF', 1)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# OMEMO support
|
# OMEMO support
|
||||||
@@ -299,31 +272,19 @@ libsignal_dep = dependency('', required: false)
|
|||||||
gcrypt_dep = dependency('', required: false)
|
gcrypt_dep = dependency('', required: false)
|
||||||
build_omemo = false
|
build_omemo = false
|
||||||
|
|
||||||
if not get_option('omemo').disabled()
|
if get_option('omemo').enabled()
|
||||||
libsignal_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: false)
|
libsignal_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: true)
|
||||||
|
gcrypt_dep = dependency('libgcrypt', version: '>= 1.7.0', required: true)
|
||||||
if libsignal_dep.found()
|
build_omemo = true
|
||||||
gcrypt_dep = dependency('libgcrypt', version: '>= 1.7.0', required: false)
|
conf_data.set('HAVE_OMEMO', 1)
|
||||||
|
|
||||||
if gcrypt_dep.found()
|
|
||||||
build_omemo = true
|
|
||||||
conf_data.set('HAVE_OMEMO', 1)
|
|
||||||
elif get_option('omemo').enabled()
|
|
||||||
error('OMEMO support enabled but libgcrypt >= 1.7.0 not found')
|
|
||||||
endif
|
|
||||||
elif get_option('omemo').enabled()
|
|
||||||
error('OMEMO support enabled but libsignal-protocol-c >= 2.3.2 not found')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# QR code support (for OMEMO)
|
# QR code support (for OMEMO)
|
||||||
qrencode_dep = dependency('', required: false)
|
qrencode_dep = dependency('', required: false)
|
||||||
|
|
||||||
if not get_option('omemo-qrcode').disabled()
|
if get_option('omemo-qrcode').enabled()
|
||||||
qrencode_dep = dependency('libqrencode', required: get_option('omemo-qrcode'))
|
qrencode_dep = dependency('libqrencode', required: true)
|
||||||
if qrencode_dep.found()
|
conf_data.set('HAVE_QRENCODE', 1)
|
||||||
conf_data.set('HAVE_QRENCODE', 1)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Set installation paths
|
# Set installation paths
|
||||||
|
|||||||
@@ -1,51 +1,77 @@
|
|||||||
|
# Features:
|
||||||
option('notifications',
|
option('notifications',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable desktop notifications'
|
description: 'Enable desktop notifications'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('python-plugins',
|
option('python-plugins',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable Python plugins'
|
description: 'Enable Python plugins'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('c-plugins',
|
option('c-plugins',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable C plugins'
|
description: 'Enable C plugins'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('plugins',
|
|
||||||
type: 'feature',
|
|
||||||
value: 'auto',
|
|
||||||
description: 'Enable plugins (both Python and C)'
|
|
||||||
)
|
|
||||||
|
|
||||||
option('otr',
|
option('otr',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable OTR encryption'
|
description: 'Enable OTR encryption'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('pgp',
|
option('pgp',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable PGP'
|
description: 'Enable PGP'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('omemo',
|
option('omemo',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Enable OMEMO encryption'
|
description: 'Enable OMEMO encryption'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('xscreensaver',
|
option('xscreensaver',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'disabled',
|
||||||
description: 'Use libXScrnSaver to determine idle time'
|
description: 'Use libXScrnSaver to determine idle time'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option('icons-and-clipboard',
|
||||||
|
type: 'feature',
|
||||||
|
value: 'disabled',
|
||||||
|
description: 'Enable GTK tray icons and clipboard paste support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('gdk-pixbuf',
|
||||||
|
type: 'feature',
|
||||||
|
value: 'disabled',
|
||||||
|
description: 'Enable GDK Pixbuf support to scale avatars before uploading'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('omemo-qrcode',
|
||||||
|
type: 'feature',
|
||||||
|
value: 'disabled',
|
||||||
|
description: 'Enable ability to display OMEMO QR code'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Other:
|
||||||
|
option('python_framework',
|
||||||
|
type: 'string',
|
||||||
|
value: '',
|
||||||
|
description: 'Set base directory for Python Framework (macOS only)'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('tests',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Build tests'
|
||||||
|
)
|
||||||
|
|
||||||
option('install_themes',
|
option('install_themes',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
value: true,
|
value: true,
|
||||||
@@ -57,33 +83,3 @@ option('themes_path',
|
|||||||
value: '',
|
value: '',
|
||||||
description: 'Custom path for themes installation (empty for default)'
|
description: 'Custom path for themes installation (empty for default)'
|
||||||
)
|
)
|
||||||
|
|
||||||
option('icons-and-clipboard',
|
|
||||||
type: 'feature',
|
|
||||||
value: 'auto',
|
|
||||||
description: 'Enable GTK tray icons and clipboard paste support'
|
|
||||||
)
|
|
||||||
|
|
||||||
option('gdk-pixbuf',
|
|
||||||
type: 'feature',
|
|
||||||
value: 'auto',
|
|
||||||
description: 'Enable GDK Pixbuf support to scale avatars before uploading'
|
|
||||||
)
|
|
||||||
|
|
||||||
option('omemo-qrcode',
|
|
||||||
type: 'feature',
|
|
||||||
value: 'auto',
|
|
||||||
description: 'Enable ability to display OMEMO QR code'
|
|
||||||
)
|
|
||||||
|
|
||||||
option('python_framework',
|
|
||||||
type: 'string',
|
|
||||||
value: '',
|
|
||||||
description: 'Set base directory for Python Framework (macOS only)'
|
|
||||||
)
|
|
||||||
|
|
||||||
option('tests',
|
|
||||||
type: 'boolean',
|
|
||||||
value: false,
|
|
||||||
description: 'Build tests'
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user