mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 16:06:22 +00:00
build: simplify build configuration and remove redundancy
Use disabler() for optional dependencies. Extract repeated build type checks into is_debug/is_release variables. Consolidate compiler flags into single add_project_arguments() calls. Simplify dependency list building (Meson auto-ignores disabled deps). Streamline platform checks using 'in' operator. Remove redundant variables (xscrnsaver_found, gtk_version, config_h_inc). Simplify ncurses and header detection with clearer fallback chains. Consolidate install_data() calls for files in same directory.
This commit is contained in:
352
meson.build
352
meson.build
@@ -26,13 +26,13 @@ conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
|
|||||||
conf_data.set_quoted('PACKAGE_BUGREPORT', 'jubalh@iodoru.org')
|
conf_data.set_quoted('PACKAGE_BUGREPORT', 'jubalh@iodoru.org')
|
||||||
conf_data.set_quoted('PACKAGE_URL', 'https://profanity-im.github.io/')
|
conf_data.set_quoted('PACKAGE_URL', 'https://profanity-im.github.io/')
|
||||||
|
|
||||||
# possible options from meson:
|
# Possible options from meson:
|
||||||
# debug, debugoptimized, release, plain
|
# debug, debugoptimized, release, plain
|
||||||
if get_option('buildtype') == 'release'
|
# Build type configuration
|
||||||
conf_data.set_quoted('PACKAGE_STATUS', 'release')
|
is_release = get_option('buildtype') == 'release'
|
||||||
else
|
is_debug = get_option('buildtype') in ['debug', 'debugoptimized']
|
||||||
conf_data.set_quoted('PACKAGE_STATUS', 'development')
|
|
||||||
endif
|
conf_data.set_quoted('PACKAGE_STATUS', is_release ? 'release' : 'development')
|
||||||
|
|
||||||
if platform == 'cygwin'
|
if platform == 'cygwin'
|
||||||
conf_data.set('PLATFORM_CYGWIN', 1)
|
conf_data.set('PLATFORM_CYGWIN', 1)
|
||||||
@@ -43,7 +43,7 @@ if platform == 'osx'
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Get git version if in development
|
# Get git version if in development
|
||||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
if is_debug
|
||||||
git = find_program('git', required: false)
|
git = find_program('git', required: false)
|
||||||
if git.found()
|
if git.found()
|
||||||
conf_data.set('HAVE_GIT_VERSION', 1)
|
conf_data.set('HAVE_GIT_VERSION', 1)
|
||||||
@@ -54,14 +54,16 @@ endif
|
|||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
# Common compiler flags
|
# Common compiler flags
|
||||||
add_project_arguments('-Wno-deprecated-declarations', language: 'c')
|
add_project_arguments([
|
||||||
add_project_arguments('-Wno-unused-parameter', language: 'c')
|
'-Wno-deprecated-declarations',
|
||||||
|
'-Wno-unused-parameter',
|
||||||
|
], language: 'c')
|
||||||
|
|
||||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
if is_debug
|
||||||
add_project_arguments('-ggdb3', language: 'c')
|
add_project_arguments([
|
||||||
add_project_arguments('-Wunused', language: 'c')
|
'-ggdb3',
|
||||||
#Disabled for now due so we can build
|
'-Wunused',
|
||||||
#add_project_arguments('-Werror', language: 'c')
|
], language: 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if platform == 'osx'
|
if platform == 'osx'
|
||||||
@@ -80,7 +82,7 @@ gio_dep = dependency('gio-2.0')
|
|||||||
curl_dep = dependency('libcurl', version: '>= 7.62.0')
|
curl_dep = dependency('libcurl', version: '>= 7.62.0')
|
||||||
sqlite_dep = dependency('sqlite3', version: '>= 3.22.0')
|
sqlite_dep = dependency('sqlite3', version: '>= 3.22.0')
|
||||||
thread_dep = dependency('threads')
|
thread_dep = dependency('threads')
|
||||||
math_dep = cc.find_library('m', required: true)
|
math_dep = cc.find_library('m')
|
||||||
libstrophe_dep = dependency('libstrophe', version: '>= 0.12.3')
|
libstrophe_dep = dependency('libstrophe', version: '>= 0.12.3')
|
||||||
|
|
||||||
# Check for XMPP_CERT_PUBKEY_FINGERPRINT_SHA256 support
|
# Check for XMPP_CERT_PUBKEY_FINGERPRINT_SHA256 support
|
||||||
@@ -95,66 +97,72 @@ if cc.links('''
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# ncurses
|
# ncurses
|
||||||
curses_dep = disabler()
|
curses_dep = dependency('ncursesw', required: false)
|
||||||
foreach lib : ['ncursesw', 'ncurses']
|
|
||||||
d = dependency(lib, required: false)
|
|
||||||
if not d.found()
|
|
||||||
d = cc.find_library(lib, required: false)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if d.found()
|
|
||||||
curses_dep = d
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
if not curses_dep.found()
|
if not curses_dep.found()
|
||||||
error('ncursesw/ncurses library not found')
|
curses_dep = dependency('ncurses', required: false)
|
||||||
|
endif
|
||||||
|
if not curses_dep.found()
|
||||||
|
curses_dep = cc.find_library('ncursesw', required: false)
|
||||||
|
endif
|
||||||
|
if not curses_dep.found()
|
||||||
|
curses_dep = cc.find_library('ncurses', required: true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Check for ncursesw/ncurses.h, Arch linux uses ncurses.h for ncursesw
|
# Check for ncursesw/ncurses.h, Arch Linux uses ncurses.h for ncursesw
|
||||||
foreach h : ['ncursesw/ncurses.h', 'ncurses.h']
|
if cc.has_header('ncursesw/ncurses.h')
|
||||||
if cc.has_header(h)
|
conf_data.set('HAVE_NCURSESW_NCURSES_H', 1)
|
||||||
conf_data.set('HAVE_@0@'.format(h.underscorify().to_upper()), 1)
|
elif cc.has_header('ncurses.h')
|
||||||
endif
|
conf_data.set('HAVE_NCURSES_H', 1)
|
||||||
endforeach
|
endif
|
||||||
|
|
||||||
# Readline:
|
# Readline
|
||||||
# we need to declare the variable before
|
|
||||||
# using it in the conditional branch.
|
|
||||||
# Later the required is set correctly.
|
|
||||||
readline_dep = dependency('readline', required: false)
|
readline_dep = dependency('readline', required: false)
|
||||||
|
|
||||||
if not readline_dep.found()
|
if not readline_dep.found() and platform == 'osx'
|
||||||
if platform == 'osx'
|
brew = find_program('brew', required: false)
|
||||||
# brew prefix
|
if brew.found()
|
||||||
brew = find_program('brew', required: false)
|
prefix = run_command(brew, '--prefix', 'readline', check: false).stdout().strip()
|
||||||
if brew.found()
|
readline_dep = cc.find_library('readline', dirs: [prefix / 'lib'], required: true)
|
||||||
prefix = run_command(brew, '--prefix', 'readline', check: false).stdout().strip()
|
add_project_arguments('-I' + prefix / 'include', language: 'c')
|
||||||
readline_dep = cc.find_library('readline', dirs: [prefix / 'lib'], required: true)
|
|
||||||
add_project_arguments('-I' + prefix / 'include', language: 'c')
|
|
||||||
endif
|
|
||||||
elif platform == 'openbsd'
|
|
||||||
# ereadline alias
|
|
||||||
readline_dep = cc.find_library('ereadline', dirs: ['/usr/local/lib'], required: false)
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# regular
|
if not readline_dep.found() and platform == 'openbsd'
|
||||||
|
readline_dep = cc.find_library('ereadline', dirs: ['/usr/local/lib'], required: false)
|
||||||
|
endif
|
||||||
|
|
||||||
if not readline_dep.found()
|
if not readline_dep.found()
|
||||||
readline_dep = cc.find_library('readline', required: true)
|
readline_dep = cc.find_library('readline', required: true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Optional dependencies:
|
# Optional dependencies
|
||||||
# Notifications
|
|
||||||
libnotify_dep = dependency('', required: false)
|
|
||||||
have_osxnotify = false
|
have_osxnotify = false
|
||||||
|
libnotify_dep = disabler()
|
||||||
|
gtk_dep = disabler()
|
||||||
|
xscrnsaver_dep = []
|
||||||
|
python_dep = disabler()
|
||||||
|
dl_dep = disabler()
|
||||||
|
gpgme_dep = disabler()
|
||||||
|
libotr_dep = disabler()
|
||||||
|
gdk_pixbuf_dep = disabler()
|
||||||
|
libsignal_dep = disabler()
|
||||||
|
gcrypt_dep = disabler()
|
||||||
|
qrencode_dep = disabler()
|
||||||
|
|
||||||
|
# Build flags
|
||||||
|
build_python_api = false
|
||||||
|
build_c_api = false
|
||||||
|
build_pgp = false
|
||||||
|
build_otr = false
|
||||||
|
build_omemo = false
|
||||||
|
|
||||||
|
# Notifications
|
||||||
if get_option('notifications').enabled()
|
if get_option('notifications').enabled()
|
||||||
if platform == 'osx'
|
if platform == 'osx'
|
||||||
terminal_notifier = find_program('terminal-notifier', required: true)
|
terminal_notifier = find_program('terminal-notifier', required: true)
|
||||||
have_osxnotify = true
|
have_osxnotify = true
|
||||||
conf_data.set('HAVE_OSXNOTIFY', 1)
|
conf_data.set('HAVE_OSXNOTIFY', 1)
|
||||||
elif platform == 'nix' or platform == 'freebsd'
|
elif platform in ['nix', 'freebsd']
|
||||||
libnotify_dep = dependency('libnotify', required: true)
|
libnotify_dep = dependency('libnotify', required: true)
|
||||||
conf_data.set('HAVE_LIBNOTIFY', 1)
|
conf_data.set('HAVE_LIBNOTIFY', 1)
|
||||||
else
|
else
|
||||||
@@ -163,44 +171,26 @@ if get_option('notifications').enabled()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# GTK (for icons and clipboard)
|
# GTK (for icons and clipboard)
|
||||||
gtk_dep = dependency('', required: false)
|
|
||||||
|
|
||||||
if get_option('icons-and-clipboard').enabled()
|
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: true)
|
||||||
if gtk_dep.found()
|
conf_data.set('HAVE_GTK', 1)
|
||||||
conf_data.set('HAVE_GTK', 1)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# XScreenSaver
|
# XScreenSaver
|
||||||
# We use this variable because .found() will later not work on a list
|
|
||||||
xscrnsaver_found = false
|
|
||||||
xscrnsaver_dep = []
|
|
||||||
|
|
||||||
if get_option('xscreensaver').enabled()
|
if get_option('xscreensaver').enabled()
|
||||||
xss_dep = dependency('xscrnsaver', required: true)
|
xscrnsaver_dep = [
|
||||||
x11_dep = dependency('x11', required: true)
|
dependency('xscrnsaver', required: true),
|
||||||
xscrnsaver_dep = [xss_dep, x11_dep]
|
dependency('x11', required: true)
|
||||||
xscrnsaver_found = true
|
]
|
||||||
conf_data.set('HAVE_LIBXSS', 1)
|
conf_data.set('HAVE_LIBXSS', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Python plugins
|
# Python plugins
|
||||||
python_dep = dependency('', required: false)
|
|
||||||
build_python_api = false
|
|
||||||
|
|
||||||
if get_option('python-plugins').enabled()
|
if get_option('python-plugins').enabled()
|
||||||
if platform == 'osx'
|
python_dep = dependency('python3-embed', required: false)
|
||||||
# Handle Python framework on macOS
|
|
||||||
python_framework = get_option('python_framework')
|
|
||||||
if python_framework == ''
|
|
||||||
python_framework = '/Library/Frameworks/Python.framework'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
python_dep = dependency('python-embed', required: false)
|
|
||||||
if not python_dep.found()
|
if not python_dep.found()
|
||||||
python_dep = dependency('python3-embed', required: true)
|
python_dep = dependency('python-embed', required: true)
|
||||||
|
else
|
||||||
conf_data.set('PY_IS_PYTHON3', 1)
|
conf_data.set('PY_IS_PYTHON3', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -209,34 +199,24 @@ if get_option('python-plugins').enabled()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# C plugins
|
# C plugins
|
||||||
dl_dep = dependency('', required: false)
|
|
||||||
build_c_api = false
|
|
||||||
|
|
||||||
if get_option('c-plugins').enabled()
|
if get_option('c-plugins').enabled()
|
||||||
if platform == 'cygwin'
|
if platform == 'cygwin'
|
||||||
error('C plugins are not supported on Cygwin')
|
error('C plugins are not supported on Cygwin')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if platform == 'openbsd' or platform == 'freebsd' or platform == 'netbsd'
|
if platform not in ['openbsd', 'freebsd', 'netbsd']
|
||||||
build_c_api = true
|
|
||||||
conf_data.set('HAVE_C', 1)
|
|
||||||
else
|
|
||||||
dl_dep = cc.find_library('dl', required: true)
|
dl_dep = cc.find_library('dl', required: true)
|
||||||
build_c_api = true
|
|
||||||
conf_data.set('HAVE_C', 1)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
build_c_api = true
|
||||||
|
conf_data.set('HAVE_C', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# PGP support
|
# PGP support
|
||||||
gpgme_dep = dependency('', required: false)
|
|
||||||
build_pgp = false
|
|
||||||
|
|
||||||
if get_option('pgp').enabled()
|
if get_option('pgp').enabled()
|
||||||
gpgme_dep = cc.find_library('gpgme', required: true)
|
gpgme_dep = cc.find_library('gpgme', required: true)
|
||||||
|
|
||||||
gpgme_config = find_program('gpgme-config', required: true)
|
gpgme_config = find_program('gpgme-config', required: true)
|
||||||
gpgme_cflags = run_command(gpgme_config, '--cflags', check: true).stdout().strip()
|
gpgme_cflags = run_command(gpgme_config, '--cflags', check: true).stdout().strip()
|
||||||
gpgme_libs = run_command(gpgme_config, '--libs', check: true).stdout().strip()
|
|
||||||
add_project_arguments(gpgme_cflags.split(), language: 'c')
|
add_project_arguments(gpgme_cflags.split(), language: 'c')
|
||||||
|
|
||||||
build_pgp = true
|
build_pgp = true
|
||||||
@@ -244,9 +224,6 @@ if get_option('pgp').enabled()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# OTR support
|
# OTR support
|
||||||
libotr_dep = dependency('', required: false)
|
|
||||||
build_otr = false
|
|
||||||
|
|
||||||
if get_option('otr').enabled()
|
if get_option('otr').enabled()
|
||||||
libotr_dep = dependency('libotr', version: '>= 4.0', required: true)
|
libotr_dep = dependency('libotr', version: '>= 4.0', required: true)
|
||||||
build_otr = true
|
build_otr = true
|
||||||
@@ -254,18 +231,12 @@ if get_option('otr').enabled()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# GDK Pixbuf (for avatar scaling)
|
# GDK Pixbuf (for avatar scaling)
|
||||||
gdk_pixbuf_dep = dependency('', required: false)
|
|
||||||
|
|
||||||
if get_option('gdk-pixbuf').enabled()
|
if get_option('gdk-pixbuf').enabled()
|
||||||
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.4', required: true)
|
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.4', required: true)
|
||||||
conf_data.set('HAVE_PIXBUF', 1)
|
conf_data.set('HAVE_PIXBUF', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# OMEMO support
|
# OMEMO support
|
||||||
libsignal_dep = dependency('', required: false)
|
|
||||||
gcrypt_dep = dependency('', required: false)
|
|
||||||
build_omemo = false
|
|
||||||
|
|
||||||
if get_option('omemo').enabled()
|
if get_option('omemo').enabled()
|
||||||
libsignal_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: true)
|
libsignal_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: true)
|
||||||
gcrypt_dep = dependency('libgcrypt', version: '>= 1.7.0', required: true)
|
gcrypt_dep = dependency('libgcrypt', version: '>= 1.7.0', required: true)
|
||||||
@@ -274,8 +245,6 @@ if get_option('omemo').enabled()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# QR code support (for OMEMO)
|
# QR code support (for OMEMO)
|
||||||
qrencode_dep = dependency('', required: false)
|
|
||||||
|
|
||||||
if get_option('omemo-qrcode').enabled()
|
if get_option('omemo-qrcode').enabled()
|
||||||
qrencode_dep = dependency('libqrencode', required: true)
|
qrencode_dep = dependency('libqrencode', required: true)
|
||||||
conf_data.set('HAVE_QRENCODE', 1)
|
conf_data.set('HAVE_QRENCODE', 1)
|
||||||
@@ -307,12 +276,8 @@ endforeach
|
|||||||
config_h = configure_file(
|
config_h = configure_file(
|
||||||
output: 'config.h',
|
output: 'config.h',
|
||||||
configuration: conf_data,
|
configuration: conf_data,
|
||||||
install: false,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make config.h available by adding build directory to include path
|
|
||||||
config_h_inc = include_directories('.')
|
|
||||||
|
|
||||||
# Build dependencies list
|
# Build dependencies list
|
||||||
profanity_deps = [
|
profanity_deps = [
|
||||||
glib_dep,
|
glib_dep,
|
||||||
@@ -324,19 +289,53 @@ profanity_deps = [
|
|||||||
libstrophe_dep,
|
libstrophe_dep,
|
||||||
curses_dep,
|
curses_dep,
|
||||||
readline_dep,
|
readline_dep,
|
||||||
libnotify_dep,
|
|
||||||
gtk_dep,
|
|
||||||
xscrnsaver_dep,
|
|
||||||
python_dep,
|
|
||||||
dl_dep,
|
|
||||||
gpgme_dep,
|
|
||||||
libotr_dep,
|
|
||||||
gdk_pixbuf_dep,
|
|
||||||
libsignal_dep,
|
|
||||||
gcrypt_dep,
|
|
||||||
qrencode_dep
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Add optional dependencies only if found
|
||||||
|
if libnotify_dep.found()
|
||||||
|
profanity_deps += libnotify_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if gtk_dep.found()
|
||||||
|
profanity_deps += gtk_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if xscrnsaver_dep.length() > 0
|
||||||
|
profanity_deps += xscrnsaver_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if python_dep.found()
|
||||||
|
profanity_deps += python_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if dl_dep.found()
|
||||||
|
profanity_deps += dl_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if gpgme_dep.found()
|
||||||
|
profanity_deps += gpgme_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if libotr_dep.found()
|
||||||
|
profanity_deps += libotr_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if gdk_pixbuf_dep.found()
|
||||||
|
profanity_deps += gdk_pixbuf_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if libsignal_dep.found()
|
||||||
|
profanity_deps += libsignal_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if gcrypt_dep.found()
|
||||||
|
profanity_deps += gcrypt_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
if qrencode_dep.found()
|
||||||
|
profanity_deps += qrencode_dep
|
||||||
|
endif
|
||||||
|
|
||||||
# Include directories
|
# Include directories
|
||||||
inc = include_directories('.', 'src')
|
inc = include_directories('.', 'src')
|
||||||
|
|
||||||
@@ -420,73 +419,54 @@ core_sources = files(
|
|||||||
'src/plugins/disco.c',
|
'src/plugins/disco.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Python plugin sources
|
|
||||||
python_sources = files(
|
|
||||||
'src/plugins/python_plugins.c',
|
|
||||||
'src/plugins/python_api.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
# C plugin sources
|
|
||||||
c_sources = files(
|
|
||||||
'src/plugins/c_plugins.c',
|
|
||||||
'src/plugins/c_api.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
# PGP sources
|
|
||||||
pgp_sources = files(
|
|
||||||
'src/pgp/gpg.c',
|
|
||||||
'src/pgp/ox.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
# OTR sources
|
|
||||||
otr_sources = files(
|
|
||||||
'src/otr/otrlibv4.c',
|
|
||||||
'src/otr/otr.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
# OMEMO sources
|
|
||||||
omemo_sources = files(
|
|
||||||
'src/omemo/omemo.c',
|
|
||||||
'src/omemo/crypto.c',
|
|
||||||
'src/omemo/store.c',
|
|
||||||
'src/xmpp/omemo.c',
|
|
||||||
'src/tools/aesgcm_download.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build the final source list
|
# Build the final source list
|
||||||
profanity_sources = core_sources
|
profanity_sources = core_sources
|
||||||
|
|
||||||
# Add tray support only when GTK is available
|
# Add conditional sources
|
||||||
# The calls to tray functions in profanity.c are already conditional on HAVE_GTK
|
|
||||||
if gtk_dep.found()
|
if gtk_dep.found()
|
||||||
profanity_sources += files('src/ui/tray.c')
|
profanity_sources += files('src/ui/tray.c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_python_api
|
if build_python_api
|
||||||
profanity_sources += python_sources
|
profanity_sources += files(
|
||||||
|
'src/plugins/python_plugins.c',
|
||||||
|
'src/plugins/python_api.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_c_api
|
if build_c_api
|
||||||
profanity_sources += c_sources
|
profanity_sources += files(
|
||||||
|
'src/plugins/c_plugins.c',
|
||||||
|
'src/plugins/c_api.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_pgp
|
if build_pgp
|
||||||
profanity_sources += pgp_sources
|
profanity_sources += files(
|
||||||
|
'src/pgp/gpg.c',
|
||||||
|
'src/pgp/ox.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_otr
|
if build_otr
|
||||||
profanity_sources += otr_sources
|
profanity_sources += files(
|
||||||
|
'src/otr/otrlibv4.c',
|
||||||
|
'src/otr/otr.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_omemo
|
if build_omemo
|
||||||
profanity_sources += omemo_sources
|
profanity_sources += files(
|
||||||
|
'src/omemo/omemo.c',
|
||||||
|
'src/omemo/crypto.c',
|
||||||
|
'src/omemo/store.c',
|
||||||
|
'src/xmpp/omemo.c',
|
||||||
|
'src/tools/aesgcm_download.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Main source file
|
|
||||||
main_source = files('src/main.c')
|
|
||||||
|
|
||||||
# Generate git version header if in development
|
# Generate git version header if in development
|
||||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
if is_debug
|
||||||
git_branch = run_command('git', 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD',
|
git_branch = run_command('git', 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD',
|
||||||
check: false).stdout().strip()
|
check: false).stdout().strip()
|
||||||
git_revision = run_command('git', 'log', '--pretty=format:%h', '-n', '1',
|
git_revision = run_command('git', 'log', '--pretty=format:%h', '-n', '1',
|
||||||
@@ -500,14 +480,15 @@ if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimi
|
|||||||
input: 'src/gitversion.h.in',
|
input: 'src/gitversion.h.in',
|
||||||
output: 'gitversion.h',
|
output: 'gitversion.h',
|
||||||
configuration: git_version_conf,
|
configuration: git_version_conf,
|
||||||
install: false,
|
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build the executable
|
# Build the executable
|
||||||
profanity_exe = executable(
|
profanity_exe = executable(
|
||||||
'profanity',
|
'profanity',
|
||||||
profanity_sources + main_source + [config_h],
|
profanity_sources,
|
||||||
|
files('src/main.c'),
|
||||||
|
config_h,
|
||||||
dependencies: profanity_deps,
|
dependencies: profanity_deps,
|
||||||
include_directories: inc,
|
include_directories: inc,
|
||||||
install: true,
|
install: true,
|
||||||
@@ -525,7 +506,6 @@ if build_c_api
|
|||||||
version: '0.0.0',
|
version: '0.0.0',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install profapi.h header
|
|
||||||
install_headers('src/plugins/profapi.h')
|
install_headers('src/plugins/profapi.h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -544,19 +524,17 @@ install_subdir('icons',
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Install man pages
|
# Install man pages
|
||||||
man_pages = run_command('find', 'docs', '-name', 'profanity*.1', '-type', 'f',
|
man_pages = run_command('find', 'docs', '-name', 'profanity*.1', '-type', 'f',
|
||||||
check: true).stdout().strip().split('\n')
|
check: true).stdout().strip().split('\n')
|
||||||
|
|
||||||
if man_pages.length() > 0 and man_pages[0] != ''
|
if man_pages.length() > 0 and man_pages[0] != ''
|
||||||
install_man(man_pages)
|
install_man(man_pages)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Install example config
|
# Install example config and theme template
|
||||||
install_data('profrc.example',
|
install_data(
|
||||||
install_dir: get_option('datadir') / 'doc' / meson.project_name(),
|
'profrc.example',
|
||||||
)
|
'theme_template',
|
||||||
|
|
||||||
install_data('theme_template',
|
|
||||||
install_dir: get_option('datadir') / 'doc' / meson.project_name(),
|
install_dir: get_option('datadir') / 'doc' / meson.project_name(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -564,7 +542,6 @@ install_data('theme_template',
|
|||||||
if get_option('tests')
|
if get_option('tests')
|
||||||
cmocka_dep = dependency('cmocka', required: false)
|
cmocka_dep = dependency('cmocka', required: false)
|
||||||
if cmocka_dep.found()
|
if cmocka_dep.found()
|
||||||
# Unit test sources
|
|
||||||
unittest_sources = files(
|
unittest_sources = files(
|
||||||
'src/xmpp/contact.c',
|
'src/xmpp/contact.c',
|
||||||
'src/common.c',
|
'src/common.c',
|
||||||
@@ -650,11 +627,17 @@ if get_option('tests')
|
|||||||
)
|
)
|
||||||
|
|
||||||
if build_python_api
|
if build_python_api
|
||||||
unittest_sources += python_sources
|
unittest_sources += files(
|
||||||
|
'src/plugins/python_plugins.c',
|
||||||
|
'src/plugins/python_api.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_c_api
|
if build_c_api
|
||||||
unittest_sources += c_sources
|
unittest_sources += files(
|
||||||
|
'src/plugins/c_plugins.c',
|
||||||
|
'src/plugins/c_api.c',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_pgp
|
if build_pgp
|
||||||
@@ -665,18 +648,13 @@ if get_option('tests')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if build_otr
|
if build_otr
|
||||||
unittest_sources += files(
|
unittest_sources += files('tests/unittests/otr/stub_otr.c')
|
||||||
'tests/unittests/otr/stub_otr.c',
|
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_omemo
|
if build_omemo
|
||||||
unittest_sources += files(
|
unittest_sources += files('tests/unittests/omemo/stub_omemo.c')
|
||||||
'tests/unittests/omemo/stub_omemo.c',
|
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build unit tests
|
|
||||||
unittests = executable(
|
unittests = executable(
|
||||||
'unittests',
|
'unittests',
|
||||||
unittest_sources,
|
unittest_sources,
|
||||||
@@ -708,7 +686,7 @@ summary({
|
|||||||
'OTR': build_otr,
|
'OTR': build_otr,
|
||||||
'PGP': build_pgp,
|
'PGP': build_pgp,
|
||||||
'OMEMO': build_omemo,
|
'OMEMO': build_omemo,
|
||||||
'XScreenSaver': xscrnsaver_found,
|
'XScreenSaver': xscrnsaver_dep.length() > 0,
|
||||||
'GTK': gtk_dep.found(),
|
'GTK': gtk_dep.found(),
|
||||||
'GDK Pixbuf': gdk_pixbuf_dep.found(),
|
'GDK Pixbuf': gdk_pixbuf_dep.found(),
|
||||||
'QR Code': qrencode_dep.found(),
|
'QR Code': qrencode_dep.found(),
|
||||||
|
|||||||
Reference in New Issue
Block a user