Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
build: Misc cleanup of options
Browse files Browse the repository at this point in the history
Cleanup of option names, use features where applicable, and printing
of summary.
  • Loading branch information
TingPing committed Jul 13, 2021
1 parent 25440a0 commit cbb0927
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 47 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ubuntu-build.yml
Expand Up @@ -10,10 +10,11 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y meson libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libnotify-dev libpci-dev libperl-dev libproxy-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils
sudo apt-get install -y python3-setuptools python3-pip libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libnotify-dev libpci-dev libperl-dev libproxy-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils
sudo pip3 install meson
- name: Configure
run: meson build -Dwith-text=true -Dwith-theme-manager=true
run: meson build -Dtext=true -Dtheme-manager=true -Dauto_features=enabled

- name: Build
run: ninja -C build
Expand Down
6 changes: 3 additions & 3 deletions data/meson.build
@@ -1,11 +1,11 @@
if get_option('with-plugin')
if get_option('plugin')
subdir('pkgconfig')
endif

if get_option('with-gtk')
if get_option('gtk-frontend')
subdir('icons')
subdir('misc')
subdir('man')
elif get_option('with-theme-manager')
elif get_option('theme-manager')
subdir('misc')
endif
12 changes: 6 additions & 6 deletions data/misc/meson.build
Expand Up @@ -2,8 +2,8 @@ appdir = join_paths(get_option('datadir'), 'applications')
metainfodir = join_paths(get_option('datadir'), 'metainfo')
desktop_utils = find_program('desktop-file-validate', required: false)

if get_option('with-gtk')
if get_option('with-appdata')
if get_option('gtk-frontend')
if get_option('install-appdata')
hexchat_appdata = i18n.merge_file(
input: 'io.github.Hexchat.appdata.xml.in',
output: 'io.github.Hexchat.appdata.xml',
Expand All @@ -21,7 +21,7 @@ if get_option('with-gtk')
endif

desktop_conf = configuration_data()
if get_option('with-dbus')
if dbus_glib_dep.found()
desktop_conf.set('exec_command', 'hexchat --existing %U')
else
desktop_conf.set('exec_command', 'hexchat %U')
Expand Down Expand Up @@ -49,7 +49,7 @@ if get_option('with-gtk')
endif
endif

if get_option('with-theme-manager')
if get_option('theme-manager')
htm_desktop = i18n.merge_file(
input: 'io.github.Hexchat.ThemeManager.desktop.in',
output: 'io.github.Hexchat.ThemeManager.desktop',
Expand All @@ -70,7 +70,7 @@ if get_option('with-theme-manager')
)
endif

if get_option('with-plugin') and get_option('with-appdata')
if get_option('plugin')
plugin_metainfo = []

# FIXME: These should all get translated somewhere
Expand Down Expand Up @@ -124,4 +124,4 @@ if get_option('with-plugin') and get_option('with-appdata')
install_dir: get_option('install-plugin-metainfo') ? metainfodir : '',
)
endforeach
endif
endif
49 changes: 41 additions & 8 deletions meson.build
@@ -1,6 +1,6 @@
project('hexchat', 'c',
version: '2.14.3',
meson_version: '>= 0.40.0',
meson_version: '>= 0.47.0',
default_options: [
'c_std=gnu89',
'buildtype=debugoptimized',
Expand All @@ -15,12 +15,18 @@ cc = meson.get_compiler('c')

libgio_dep = dependency('gio-2.0', version: '>= 2.34.0')
libgmodule_dep = dependency('gmodule-2.0')

libcanberra_dep = dependency('libcanberra', version: '>= 0.22',
required: get_option('libcanberra'))
dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus'))
libnotify_dep = dependency('libnotify', required: get_option('libnotify'))

global_deps = []
if cc.get_id() == 'msvc'
libssl_dep = cc.find_library('libeay32')
else
libssl_dep = dependency('openssl', version: '>= 0.9.8',
required: get_option('with-ssl'))
required: get_option('tls'))
endif

config_h = configuration_data()
Expand All @@ -32,10 +38,10 @@ config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
config_h.set10('ENABLE_NLS', true)

# Optional features
config_h.set('USE_OPENSSL', get_option('with-ssl'))
config_h.set('USE_LIBCANBERRA', get_option('with-libcanberra'))
config_h.set('USE_DBUS', get_option('with-dbus'))
config_h.set('USE_PLUGIN', get_option('with-plugin'))
config_h.set('USE_OPENSSL', libssl_dep.found())
config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
config_h.set('USE_DBUS', dbus_glib_dep.found())
config_h.set('USE_PLUGIN', get_option('plugin'))

config_h.set('G_DISABLE_SINGLE_INCLUDES', true)
config_h.set('GTK_DISABLE_DEPRECATED', true)
Expand Down Expand Up @@ -152,14 +158,41 @@ endforeach
add_project_link_arguments(global_ldflags, language: 'c')

subdir('src')
if get_option('with-plugin')
if get_option('plugin')
subdir('plugins')
endif
if cc.get_id() != 'msvc'
subdir('data')
subdir('po') # FIXME: build xgettext

meson.add_install_script('meson_post_install.py',
'@0@'.format(get_option('with-theme-manager'))
'@0@'.format(get_option('theme-manager'))
)
endif

if meson.version().version_compare('>= 0.53.0')
summary({
'prefix': get_option('prefix'),
'bindir': get_option('bindir'),
'libdir': get_option('libdir'),
'datadir': get_option('datadir'),
}, section: 'Directories')

summary({
'TLS (openssl)': libssl_dep.found(),
'Plugin Support': get_option('plugin'),
'DBus Support': dbus_glib_dep.found(),
'libnotify': libnotify_dep.found(),
'libcanberra': libcanberra_dep.found(),
}, section: 'Features')

summary({
'Lua': get_option('with-lua'),
'Python': get_option('with-python'),
'Perl': get_option('with-perl'),
'Perl Legacy API': get_option('with-perl-legacy-api'),
'FiSH': get_option('with-fishlim'),
'Sysinfo': get_option('with-sysinfo'),
'DCC Checksum': get_option('with-checksum'),
}, section: 'Plugins')
endif
33 changes: 19 additions & 14 deletions meson_options.txt
@@ -1,33 +1,41 @@
option('with-gtk', type: 'boolean',
# Applications
option('gtk-frontend', type: 'boolean',
description: 'Main graphical interface'
)
option('with-text', type: 'boolean', value: false,
option('text-frontend', type: 'boolean', value: false,
description: 'Text interface (not generally useful)'
)
option('with-ssl', type: 'boolean',
option('theme-manager', type: 'boolean', value: false,
description: 'Utility to help manage themes, requires mono/.net'
)

# Features
option('tls', type: 'feature', value: 'enabled',
description: 'Support for TLS connections, requires openssl'
)
option('with-plugin', type: 'boolean',
option('plugin', type: 'boolean',
description: 'Support for loadable plugins'
)
option('with-dbus', type: 'boolean',
option('dbus', type: 'feature', value: 'auto',
description: 'Support used for single-instance and scripting interface, Unix only'
)
option('with-libnotify', type: 'boolean',
option('libnotify', type: 'feature', value: 'auto',
description: 'Support for freedesktop notifications, Unix only'
)
option('with-libcanberra', type: 'boolean',
option('libcanberra', type: 'feature', value: 'auto',
description: 'Support for sound alerts, Unix only'
)
option('with-theme-manager', type: 'boolean', value: false,
description: 'Utility to help manage themes, requires mono/.net'
)

# Install options
option('dbus-service-use-appid', type: 'boolean', value: false,
description: 'Rename dbus service to match app-id, required for Flatpak'
)
option('with-appdata', type: 'boolean',
option('install-appdata', type: 'boolean',
description: 'Install appdata files for app stores'
)
option('install-plugin-metainfo', type: 'boolean', value: false,
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
)

# Plugins
option('with-checksum', type: 'boolean',
Expand Down Expand Up @@ -57,9 +65,6 @@ option('with-upd', type: 'boolean',
option('with-winamp', type: 'boolean',
description: 'Winamp plugin, Windows only'
)
option('install-plugin-metainfo', type: 'boolean', value: false,
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
)
option('with-perl-legacy-api', type: 'boolean', value: false,
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
)
2 changes: 1 addition & 1 deletion src/common/dbus/meson.build
@@ -1,5 +1,5 @@
dbus_deps = [
dependency('dbus-glib-1')
dbus_glib_dep
]

dbus_sources = [
Expand Down
11 changes: 4 additions & 7 deletions src/common/meson.build
Expand Up @@ -28,6 +28,7 @@ common_sysinfo_deps = []

common_deps = [
libgio_dep,
libcanberra_dep,
] + global_deps

common_includes = [
Expand Down Expand Up @@ -72,22 +73,18 @@ textevents = custom_target('textevents',
# SIGACTION
# HAVE_GTK_MAC

if get_option('with-ssl')
if libssl_dep.found()
common_sources += 'ssl.c'
common_deps += libssl_dep
endif

if get_option('with-libcanberra')
common_deps += dependency('libcanberra', version: '>= 0.22')
endif

if get_option('with-dbus')
if dbus_glib_dep.found()
subdir('dbus')
common_deps += hexchat_dbus_dep
common_includes += include_directories('dbus')
endif

if get_option('with-plugin')
if get_option('plugin')
common_deps += libgmodule_dep
install_headers('hexchat-plugin.h')
endif
Expand Down
6 changes: 3 additions & 3 deletions src/fe-gtk/meson.build
Expand Up @@ -43,9 +43,9 @@ hexchat_gtk_cflags = []

hexchat_gtk_ldflags = []

if get_option('with-libnotify')
if libnotify_dep.found()
hexchat_gtk_sources += 'notifications/notification-libnotify.c'
hexchat_gtk_deps += dependency('libnotify')
hexchat_gtk_deps += libnotify_dep
elif false # TODO HAVE_GTK_MAC
elif host_machine.system() == 'windows'
hexchat_gtk_sources += 'notifications/notification-windows.c'
Expand All @@ -69,7 +69,7 @@ if iso_codes.found()
join_paths(iso_codes_prefix, 'share/locale'))
endif

if get_option('with-plugin')
if get_option('plugin')
hexchat_gtk_sources += 'plugingui.c'
endif

Expand Down
6 changes: 3 additions & 3 deletions src/meson.build
@@ -1,13 +1,13 @@
subdir('common')

if get_option('with-gtk')
if get_option('gtk-frontend')
subdir('fe-gtk')
endif

if get_option('with-text')
if get_option('text-frontend')
subdir('fe-text')
endif

if get_option('with-theme-manager')
if get_option('theme-manager')
subdir('htm')
endif

0 comments on commit cbb0927

Please sign in to comment.