rofi/meson.build

556 lines
15 KiB
Meson
Raw Normal View History

project('rofi', 'c',
2022-08-19 20:43:47 +00:00
version: '1.7.5-dev',
meson_version: '>=0.47.0',
license: [ 'MIT' ],
default_options: [
'c_std=c99',
2023-06-29 21:59:25 +00:00
'warning_level=3'
],
)
c_compiler = meson.get_compiler('c')
add_project_arguments(
'-I@0@'.format(meson.build_root()),
'-I@0@'.format(join_paths(meson.source_root(), 'include')),
'-D_DEFAULT_SOURCE=1',
language: 'c'
)
flags = [
'-Wparentheses',
'-Winline',
'-Wunreachable-code',
'-Werror=missing-prototypes',
2023-06-29 21:59:25 +00:00
'-Wno-inline' # A bit too noisy with Bison…
]
foreach f : flags
if c_compiler.has_argument(f)
add_project_arguments(f, language: 'c')
endif
endforeach
2022-11-17 11:13:14 +00:00
if get_option('b_lto')
add_project_arguments('-Werror=odr', language: 'c')
add_project_arguments('-Werror=lto-type-mismatch', language: 'c')
add_project_arguments('-Werror=strict-aliasing', language: 'c')
endif
plugindir = join_paths(get_option('libdir'), meson.project_name())
themedir = join_paths(get_option('datadir'), meson.project_name(), 'themes')
desktop_install_dir = join_paths(get_option('datadir'), 'applications')
icondir = join_paths(get_option('datadir'), 'icons','hicolor', 'scalable', 'apps')
glib_min_major=2
glib_min_minor=40
glib_min_version='@0@.@1@'.format(glib_min_major, glib_min_minor)
plugins_deps = [
dependency('glib-2.0', version: '>= @0@'.format(glib_min_version)),
dependency('gmodule-2.0'),
dependency('cairo'),
]
dep_lm = c_compiler.find_library('m', required : false)
2021-02-18 07:04:50 +00:00
deps = [
plugins_deps,
dependency('gio-unix-2.0'),
dependency('pango'),
dependency('pangocairo'),
dependency('xkbcommon'),
dependency('gdk-pixbuf-2.0'),
2021-02-18 07:04:50 +00:00
dep_lm,
]
libgwater = subproject('libgwater')
# XCB stuff
deps += [
libgwater.get_variable('libgwater_xcb'),
dependency('xcb'),
dependency('xcb-aux'),
dependency('xcb-xkb'),
dependency('xkbcommon-x11'),
dependency('xcb-ewmh'),
dependency('xcb-icccm'),
dependency('xcb-randr'),
dependency('xcb-cursor'),
dependency('xcb-xinerama'),
dependency('cairo-xcb'),
dependency('libstartup-notification-1.0'),
]
header_conf = configuration_data()
if get_option('imdkit')
imdkit_new = dependency('xcb-imdkit', version: '>= 1.0.3', required: false)
imdkit_old = dependency('xcb-imdkit', version: '<= 1.0.2', required: false)
if imdkit_new.found()
deps += imdkit_new
header_conf.set('XCB_IMDKIT_1_0_3_LOWER', false)
header_conf.set('XCB_IMDKIT', true)
elif imdkit_old.found()
deps+= imdkit_old
header_conf.set('XCB_IMDKIT_1_0_3_LOWER', true)
header_conf.set('XCB_IMDKIT', true)
else
header_conf.set('XCB_IMDKIT_1_0_3_LOWER', false)
header_conf.set('XCB_IMDKIT', false)
endif
endif
check = dependency('check', version: '>= 0.11.0', required: get_option('check'))
header_conf.set_quoted('PACKAGE_NAME', meson.project_name())
header_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
header_conf.set_quoted('VERSION', meson.project_version())
header_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
header_conf.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/davatorium/rofi/')
header_conf.set_quoted('PACKAGE_URL', 'https://github.com/davatorium/rofi/discussions')
header_conf.set('_GNU_SOURCE', true)
header_conf.set('USE_NK_GIT_VERSION', true)
header_conf.set('GLIB_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(@0@,@1@))'.format(glib_min_major, glib_min_minor))
header_conf.set('GLIB_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(@0@,@1@))'.format(glib_min_major, glib_min_minor))
header_conf.set('ENABLE_DRUN', get_option('drun'))
header_conf.set('WINDOW_MODE', get_option('window'))
header_conf.set_quoted('MANPAGE_PATH', join_paths(get_option('prefix'), get_option('mandir')))
header_conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
header_conf.set_quoted('PLUGIN_PATH', join_paths(get_option('prefix'), plugindir))
header_conf.set_quoted('THEME_DIR', join_paths(get_option('prefix'), themedir))
config_h = configure_file(output: 'config.h', configuration: header_conf)
nk_options = [
'bindings=true',
'git-work-tree=@0@'.format(meson.source_root()),
]
nk = subproject('libnkutils', default_options: nk_options)
nk_subproject_options = nk.get_variable('nk_options')
foreach o : nk_options + nk_subproject_options
if ( o.startswith('git-work-tree=') )
continue
elif not nk_options.contains(o) or not nk_subproject_options.contains(o)
error('You must not change libnkutils options @0@ != @1@'.format('|'.join(nk_options), '|'.join(nk_subproject_options)))
endif
endforeach
deps += nk.get_variable('libnkutils')
deps += nk.get_variable('libnkutils_bindings')
install_headers([
'include/mode.h',
'include/mode-private.h',
'include/helper.h',
2017-10-15 09:13:53 +00:00
'include/rofi-types.h',
'include/rofi-icon-fetcher.h'
],
subdir: meson.project_name(),
)
install_data(
'script/rofi-sensible-terminal',
'script/rofi-theme-selector',
install_dir: join_paths(get_option('prefix'), get_option('bindir'))
)
install_data(
'data/rofi-theme-selector.desktop',
'data/rofi.desktop',
install_dir: desktop_install_dir
)
install_data(
'data/rofi.svg',
install_dir: icondir
)
flex = generator(find_program('flex'),
output: '@BASENAME@.c',
arguments: [ '-o', '@OUTPUT@', '@INPUT@' ]
)
bison = generator(find_program('bison'),
output: [ '@BASENAME@.c', '@BASENAME@.h' ],
arguments: [ '--report=all', '--report-file=bison.log', '-Wall', '--verbose', '-d', '@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@' ]
)
rofi_sources = files(
'source/rofi.c',
'source/view.c',
'source/mode.c',
'source/keyb.c',
'config/config.c',
'source/helper.c',
'source/timings.c',
'source/history.c',
'source/theme.c',
'source/rofi-icon-fetcher.c',
'source/css-colors.c',
'source/widgets/box.c',
'source/widgets/icon.c',
'source/widgets/container.c',
'source/widgets/widget.c',
'source/widgets/textbox.c',
'source/widgets/listview.c',
'source/widgets/scrollbar.c',
'source/xrmoptions.c',
'source/rofi-types.c',
'source/xcb.c',
'source/modes/run.c',
'source/modes/ssh.c',
'source/modes/drun.c',
'source/modes/dmenu.c',
'source/modes/combi.c',
'source/modes/window.c',
'source/modes/script.c',
'source/modes/help-keys.c',
'source/modes/filebrowser.c',
Merging in the Recursive file browser. Squashed commit of the following: commit 92e730076d461622dc81e44e87ec456317514904 Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 18:17:12 2023 +0200 [Doc] Add regex filtering to recursivebrowser. commit ee80c8487f9765b1e6e8ab8219a6baea089cf5af Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 17:49:29 2023 +0200 [recursivebrowser] Update manpage. commit a24b68f52362aaf1461935c2340e3bf5e31da59d Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 17:37:56 2023 +0200 [Mode] Add some extra validating of the mode selected to complete. commit cf497e8685e806521c0f61922827687adce268c9 Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 4 15:12:31 2023 +0200 [Recursive browser] Make completer selectable. commit 722f07a803c28a406d8a610f31a24b3f7247b9ba Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 4 14:36:14 2023 +0200 Add methods for completer to modes. commit 7972420c30275514751802d1ed517a45bbd83da1 Author: Qball Cow <qball@blame.services> Date: Thu Jun 1 21:56:06 2023 +0200 Prepare updates for new APIs. commit dd3035a1a61f8196d394f6867701a0e1b3af30ac Author: Dave Davenport <qball@gmpclient.org> Date: Wed May 10 19:24:48 2023 +0200 [RB] Fix regex and cleanups commit 4d2941caf32dfb946aee54c467c1319c7a89804a Author: Dave Davenport <qball@blame.services> Date: Wed May 10 18:09:54 2023 +0200 [RB] Add (unfinished regex test) commit 848277001fc8cf9afc538067f2afa24a174f8c7f Author: Dave Davenport <qball@blame.services> Date: Wed May 10 17:49:16 2023 +0200 [RB] Pull the scanning into a separate thread. commit f369a7f63f618bbcad10c18e73f7e2b117c515f1 Author: Dave Davenport <qball@gmpclient.org> Date: Wed May 3 18:35:15 2023 +0200 [Recursive File Browser] First test version.
2023-06-12 17:07:00 +00:00
'source/modes/recursivebrowser.c',
'include/display.h',
'include/xcb.h',
'include/xcb-internal.h',
'include/rofi.h',
'include/mode.h',
'include/mode-private.h',
'include/settings.h',
'include/keyb.h',
'include/view.h',
'include/view-internal.h',
'include/rofi-icon-fetcher.h',
'include/helper.h',
'include/helper-theme.h',
'include/timings.h',
'include/history.h',
'include/theme.h',
'include/rofi-types.h',
'include/css-colors.h',
'include/widgets/box.h',
'include/widgets/icon.h',
'include/widgets/container.h',
'include/widgets/widget.h',
'include/widgets/widget-internal.h',
'include/widgets/textbox.h',
'include/widgets/listview.h',
'include/widgets/scrollbar.h',
'include/xrmoptions.h',
'include/modes/ssh.h',
'include/modes/run.h',
'include/modes/drun.h',
'include/modes/dmenu.h',
'include/modes/combi.h',
'include/modes/script.h',
'include/modes/window.h',
'include/modes/modes.h',
'include/modes/help-keys.h',
'include/modes/filebrowser.h',
'include/modes/dmenuscriptshared.h',
)
theme_lexer_sources = files('lexer/theme-lexer.l')
theme_parser_sources = files('lexer/theme-parser.y')
theme_lexer = flex.process(theme_lexer_sources)
theme_parser = bison.process(theme_parser_sources)
gnome = import('gnome')
default_theme = gnome.compile_resources('resources', files('resources/resources.xml'))
rofi = executable('rofi', rofi_sources + [
theme_lexer,
theme_parser,
default_theme,
],
dependencies: deps,
install: true,
)
subdir('doc')
install_man(
'doc/rofi.1',
2017-11-05 14:28:17 +00:00
'doc/rofi-theme-selector.1',
'doc/rofi-sensible-terminal.1',
'doc/rofi-script.5',
'doc/rofi-theme.5',
2022-04-11 09:19:34 +00:00
'doc/rofi-debugging.5',
2021-12-17 10:13:29 +00:00
'doc/rofi-dmenu.5',
'doc/rofi-keys.5',
)
install_data(
'themes/Adapta-Nokto.rasi',
'themes/Arc.rasi',
'themes/Arc-Dark.rasi',
'themes/DarkBlue.rasi',
'themes/Indego.rasi',
'themes/Monokai.rasi',
'themes/Paper.rasi',
'themes/android_notification.rasi',
'themes/arthur.rasi',
'themes/blue.rasi',
'themes/c64.rasi',
2017-06-05 18:31:32 +00:00
'themes/dmenu.rasi',
2021-02-14 12:31:47 +00:00
'themes/docu.rasi',
'themes/glue_pro_blue.rasi',
'themes/gruvbox-common.rasinc',
'themes/gruvbox-dark-hard.rasi',
'themes/gruvbox-dark-soft.rasi',
'themes/gruvbox-dark.rasi',
'themes/gruvbox-light-hard.rasi',
'themes/gruvbox-light-soft.rasi',
'themes/gruvbox-light.rasi',
'themes/lb.rasi',
'themes/paper-float.rasi',
'themes/purple.rasi',
'themes/sidebar.rasi',
'themes/sidebar-v2.rasi',
'themes/solarized.rasi',
'themes/solarized_alternate.rasi',
2019-05-14 09:35:30 +00:00
'themes/fancy.rasi',
2022-12-31 22:54:14 +00:00
'themes/fancy2.rasi',
2021-08-17 10:04:16 +00:00
'themes/iggy.rasi',
2022-12-31 22:21:03 +00:00
'themes/material.rasi',
2021-08-17 10:04:16 +00:00
'themes/iggy.jpg',
'themes/fullscreen-preview.rasi',
install_dir: themedir
)
pkg = import('pkgconfig')
pkg.generate(
filebase: 'rofi',
name: 'rofi',
version: meson.project_version(),
description: 'Header files for rofi plugins',
variables: [
'pluginsdir=@0@'.format(join_paths('${libdir}', meson.project_name())),
],
requires_private: plugins_deps,
)
test('history test', executable('history.test', [
'test/history-test.c',
],
objects: rofi.extract_objects([
'source/history.c',
'config/config.c',
]),
dependencies: deps,
))
test('helper_pidfile test', executable('helper_pidfile.test', [
'test/helper-pidfile.c',
],
objects: rofi.extract_objects([
'config/config.c',
2021-06-01 12:21:21 +00:00
'source/theme.c',
'source/css-colors.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
test('widget test', executable('widget.test', [
'test/widget-test.c',
theme_parser,
theme_lexer,
default_theme,
],
objects: rofi.extract_objects([
'source/widgets/widget.c',
'source/widgets/textbox.c',
'source/theme.c',
'source/css-colors.c',
'source/rofi-types.c',
'source/css-colors.c',
'source/helper.c',
'config/config.c',
]),
dependencies: deps,
))
test('box test', executable('box.test', [
'test/box-test.c',
theme_parser,
theme_lexer,
default_theme,
],
objects: rofi.extract_objects([
'source/widgets/widget.c',
'source/widgets/box.c',
'source/theme.c',
'source/css-colors.c',
'source/rofi-types.c',
'source/css-colors.c',
'config/config.c',
]),
dependencies: deps,
))
test('scrollbar test', executable('scrollbar.test', [
'test/scrollbar-test.c',
theme_parser,
theme_lexer,
default_theme,
],
objects: rofi.extract_objects([
'source/widgets/widget.c',
'source/widgets/scrollbar.c',
'source/theme.c',
'source/css-colors.c',
'source/rofi-types.c',
'source/css-colors.c',
'config/config.c',
]),
dependencies: deps,
))
test('textbox test', executable('textbox.test', [
'test/textbox-test.c',
theme_parser,
theme_lexer,
default_theme,
],
objects: rofi.extract_objects([
'source/widgets/widget.c',
'source/widgets/textbox.c',
'source/theme.c',
'source/css-colors.c',
'source/rofi-types.c',
'source/css-colors.c',
'source/helper.c',
'config/config.c',
]),
dependencies: deps,
))
test('helper test', executable('helper.test', [
'test/helper-test.c',
],
objects: rofi.extract_objects([
'config/config.c',
2021-06-01 12:21:21 +00:00
'source/theme.c',
'source/css-colors.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
test('helper_expand test', executable('helper_expand.test', [
'test/helper-expand.c',
],
objects: rofi.extract_objects([
'config/config.c',
2021-06-01 12:21:21 +00:00
'source/theme.c',
'source/css-colors.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
test('helper_config_cmdline_parser test', executable('helper_config_cmdline_parser.test', [
'test/helper-config-cmdline-parser.c',
],
objects: rofi.extract_objects([
'config/config.c',
2021-06-01 12:21:21 +00:00
'source/theme.c',
'source/css-colors.c',
'source/helper.c',
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
if check.found()
deps+= [ check ]
test('theme_parser test', executable('theme_parser.test', [
'test/theme-parser-test.c',
theme_lexer,
theme_parser,
default_theme,
],
objects: rofi.extract_objects([
'config/config.c',
'source/helper.c',
'source/xrmoptions.c',
'source/theme.c',
'source/css-colors.c',
'source/rofi-types.c',
'source/css-colors.c',
]),
dependencies: deps,
))
test('mode test', executable('mode.test', [
'test/mode-test.c',
],
objects: rofi.extract_objects([
'config/config.c',
'source/modes/help-keys.c',
'source/helper.c',
2021-06-05 10:58:07 +00:00
'source/theme.c',
'source/css-colors.c',
'source/mode.c',
'source/xrmoptions.c',
'source/rofi-types.c',
'source/keyb.c',
]),
dependencies: deps,
))
2017-10-15 09:13:53 +00:00
test('helper_tokenize test', executable('helper_tokenize.test', [
'test/helper-tokenize.c',
],
objects: rofi.extract_objects([
'config/config.c',
'source/helper.c',
2021-06-05 10:58:07 +00:00
'source/theme.c',
'source/css-colors.c',
2017-10-15 09:13:53 +00:00
'source/xrmoptions.c',
'source/rofi-types.c',
]),
dependencies: deps,
))
endif
rofi_sources += theme_lexer_sources
rofi_sources += theme_parser_sources
cppcheck = find_program('cppcheck', required: false)
if cppcheck.found()
run_target('cppcheck',
command: [
cppcheck,
'--std=@0@'.format(get_option('c_std')),
'--platform=unix64',
'--enable=all',
'-Uerror_dialog',
'--inconclusive',
'-I@0@'.format(join_paths(meson.source_root(), 'include')),
rofi_sources
],
)
endif
ohcount = find_program('ohcount', required: false)
if ohcount.found()
run_target('ohcount',
command: [
ohcount,
rofi_sources
],
)
endif