diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 00000000..48312c97 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,8 @@ +mans = ['compton.1', 'compton-trans.1'] +a2x = find_program('a2x') +foreach m : mans + custom_target(m, output: [m], input: [m+'.asciidoc'], + command: [a2x, '--format', 'manpage', '@INPUT@', + '-D', meson.current_build_dir()], + install: true, install_dir: 'share/man/man1/') +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..2f901b21 --- /dev/null +++ b/meson.build @@ -0,0 +1,36 @@ +project('compton', 'c') + +cc = meson.get_compiler('c') + +add_global_arguments('-std=c11', language: 'c') + +if get_option('sanitize') + sanitizers = ['address', 'undefined'] + if cc.has_argument('-fsanitize=integer') + sanitizers += ['integer'] + endif + if cc.has_argument('-fsanitize=nullability') + sanitizers += ['nullability'] + endif + add_global_arguments('-fsanitize='+','.join(sanitizers), language: 'c') + add_global_link_arguments('-fsanitize='+','.join(sanitizers), language: 'c') +endif + +add_global_arguments('-D_GNU_SOURCE', language: 'c') + +warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow' ] +foreach w : warns + if cc.has_argument('-W'+w) + add_global_arguments('-W'+w, language: 'c') + endif +endforeach + +subdir('src') +subdir('man') + +install_subdir('bin', install_dir: '') +install_data('compton.desktop', install_dir: 'share/applications') +install_data('media/icons/48x48/compton.png', + install_dir: 'share/icons/hicolor/48x48/apps') +install_data('media/compton.svg', + install_dir: 'share/icons/hicolor/scalable/apps') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..8855fb81 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,11 @@ +option('sanitize', type: 'boolean', value: false, description: 'Compile compton with sanitizers') +option('xinerama', type: 'boolean', value: true, description: 'Enable XINERAMA support') +option('config_file', type: 'boolean', value: true, description: 'Enable config file support') +option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions') + +option('vsync_drm', type: 'boolean', value: false, description: 'Enable support for using drm for vsync') + +option('opengl', type: 'boolean', value: true, description: 'Enable features that require opengl (opengl backend, and opengl vsync methods)') +option('dbus', type: 'boolean', value: true, description: 'Enable suport for D-Bus remote control') + +option('xrescheck', type: 'boolean', value: false, description: 'Enable X resource leak checker (for debug only)') diff --git a/src/common.h b/src/common.h index 1414cebb..55fff919 100644 --- a/src/common.h +++ b/src/common.h @@ -1709,7 +1709,7 @@ cxfree(void *data) { XFree(data); } -static inline void _Noreturn +_Noreturn static inline void die(const char *msg) { puts(msg); exit(1); diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..79b55fbd --- /dev/null +++ b/src/meson.build @@ -0,0 +1,58 @@ +deps = [ cc.find_library('m'), cc.find_library('ev') ] + +cflags = [ '-DCONFIG_XSYNC' ] + +srcs = ['compton.c', 'win.c', 'c2.c', 'x.c', 'config.c'] + +required_package =[ + 'x11', 'x11-xcb', 'xcb-renderutil', + 'xcb-render', 'xcb-damage', 'xcb-randr', + 'xcb-composite', 'xcb-shape', 'xcb-image', + 'xcb-xfixes', 'xext', 'pixman-1'] + +foreach i : required_package + deps += [dependency(i, required: true)] +endforeach + +if get_option('xinerama') + deps += [dependency('xcb-xinerama', required: true)] + cflags += ['-DCONFIG_XINERAMA'] +endif + +if get_option('config_file') + deps += [dependency('libconfig', version: '>=1.4', required: true)] + cflags += ['-DCONFIG_LIBCONFIG'] + srcs += [ 'config_libconfig.c' ] +endif +if get_option('regex') + pcre = dependency('libpcre', required: true) + cflags += ['-DCONFIG_REGEX_PCRE'] + if pcre.version().version_compare('>=8.20') + cflags += ['-DCONFIG_REGEX_PCRE_JIT'] + endif + deps += [pcre] +endif + +if get_option('vsync_drm') + cflags += ['-DCONFIG_VSYNC_DRM'] + deps += [dependency('libdrm', required: true)] +endif + +if get_option('opengl') + cflags += ['-DCONFIG_OPENGL'] + deps += [dependency('gl', required: true)] + srcs += [ 'opengl.c' ] +endif + +if get_option('dbus') + cflags += ['-DCONFIG_DBUS'] + deps += [dependency('dbus-1', required: true)] + srcs += [ 'dbus.c' ] +endif + +if get_option('xrescheck') + cflags += ['-DDEBUG_XRC'] + srcs += [ 'xrescheck.c' ] +endif + +executable('compton', srcs, c_args: cflags, dependencies: deps, install: true)