From 66bd7af3e59e509000b8a55a9429e7a8e133fd81 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 14 Mar 2023 23:30:32 +0100 Subject: Sync with upstream 2.14.1 and update the documentation --- meson.build | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c3b4dc8 --- /dev/null +++ b/meson.build @@ -0,0 +1,130 @@ +# -*- mode: meson -*- + +# Style objective: be consistent with what mesonbuild.com documents/uses, and/or +# the meson book: https://meson-manual.com/ + +project( + 'i3lock-extended', + 'c', + version: '2.2.14', + default_options: [ + 'c_std=c11', + 'warning_level=1', # enable all warnings (-Wall) + ], + # Ubuntu 18.04 (supported until 2023) has meson 0.45. + # We can revisit our minimum supported meson version + # if it turns out to be too hard to maintain. + meson_version: '>=0.45.0', +) + +cc = meson.get_compiler('c') +add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c') + +if meson.version().version_compare('>=0.48.0') + # https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911 + meson.add_dist_script('meson/meson-dist-script') +else + message('meson <0.48.0 detected, dist tarballs will not be filtered') +endif + +################################################################################ +# Version handling +################################################################################ + +cdata = configuration_data() + +version_array = meson.project_version().split('.') +cdata.set_quoted('I3LOCK_VERSION', meson.project_version()) +cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) + +if get_option('b_sanitize').split(',').contains('address') + cdata.set('I3LOCK_ASAN_ENABLED', 1) +endif + +cdata.set('HAVE_STRNDUP', cc.has_function('strndup')) +cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp')) + +config_h = configure_file( + output: 'config.h', + configuration: cdata, +) + +config_h = declare_dependency(sources: config_h) + +################################################################################ +# manpages +################################################################################ + +install_man('i3lock-extended.1') + +# Required for e.g. struct ucred to be defined as per unix(7). +add_project_arguments('-D_GNU_SOURCE', language: 'c') +add_project_arguments('-DEXTRAS', language: 'c') + +# https://mesonbuild.com/howtox.html#add-math-library-lm-portably +m_dep = cc.find_library('m', required: false) +rt_dep = cc.find_library('rt', required: false) + +xcb_dep = dependency('xcb', method: 'pkg-config') +xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config') +xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config') +xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config') +xcb_image_dep = dependency('xcb-image', method: 'pkg-config') +xcb_util_dep = dependency('xcb-util', method: 'pkg-config') +xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config') +xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config') +xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config') +cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config') + +i3lock_srcs = [ + 'dpi.c', + 'extras.c', + 'i3lock.c', + 'randr.c', + 'unlock_indicator.c', + 'xcb.c', +] + +ev_dep = cc.find_library('ev') + +thread_dep = dependency('threads') + +i3lock_deps = [ + thread_dep, + m_dep, + rt_dep, + ev_dep, + config_h, + cairo_dep, + xcb_dep, + xcb_xkb_dep, + xcb_xinerama_dep, + xcb_randr_dep, + xcb_image_dep, + xcb_util_dep, + xcb_util_xrm_dep, + xkbcommon_dep, + xkbcommon_x11_dep, +] + +host_os = host_machine.system() +if host_os != 'openbsd' + pam_dep = cc.find_library('pam', required: true) + i3lock_deps += [pam_dep] +endif + +inc = include_directories('include') + +executable( + 'i3lock-extended', + i3lock_srcs, + install: true, + include_directories: inc, + dependencies: i3lock_deps, +) + +install_subdir( + 'pam', + strip_directory: true, + install_dir: join_paths(get_option('sysconfdir'), 'pam.d'), +) -- cgit v1.3