diff options
| author | Simeon Simeonov | 2023-03-14 23:30:32 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2023-03-18 13:37:27 +0100 |
| commit | 66bd7af3e59e509000b8a55a9429e7a8e133fd81 (patch) | |
| tree | 9eca5fe6eb76bb639fde682131c654eef17212df /meson.build | |
| parent | ffc15cad8238b101203147d4c9da64ee8e5a05b8 (diff) | |
Sync with upstream 2.14.1 and update the documentation2.2.14
Diffstat (limited to 'meson.build')
| -rw-r--r-- | meson.build | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c3b4dc8 --- /dev/null +++ b/meson.build | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | # -*- mode: meson -*- | ||
| 2 | |||
| 3 | # Style objective: be consistent with what mesonbuild.com documents/uses, and/or | ||
| 4 | # the meson book: https://meson-manual.com/ | ||
| 5 | |||
| 6 | project( | ||
| 7 | 'i3lock-extended', | ||
| 8 | 'c', | ||
| 9 | version: '2.2.14', | ||
| 10 | default_options: [ | ||
| 11 | 'c_std=c11', | ||
| 12 | 'warning_level=1', # enable all warnings (-Wall) | ||
| 13 | ], | ||
| 14 | # Ubuntu 18.04 (supported until 2023) has meson 0.45. | ||
| 15 | # We can revisit our minimum supported meson version | ||
| 16 | # if it turns out to be too hard to maintain. | ||
| 17 | meson_version: '>=0.45.0', | ||
| 18 | ) | ||
| 19 | |||
| 20 | cc = meson.get_compiler('c') | ||
| 21 | add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c') | ||
| 22 | |||
| 23 | if meson.version().version_compare('>=0.48.0') | ||
| 24 | # https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911 | ||
| 25 | meson.add_dist_script('meson/meson-dist-script') | ||
| 26 | else | ||
| 27 | message('meson <0.48.0 detected, dist tarballs will not be filtered') | ||
| 28 | endif | ||
| 29 | |||
| 30 | ################################################################################ | ||
| 31 | # Version handling | ||
| 32 | ################################################################################ | ||
| 33 | |||
| 34 | cdata = configuration_data() | ||
| 35 | |||
| 36 | version_array = meson.project_version().split('.') | ||
| 37 | cdata.set_quoted('I3LOCK_VERSION', meson.project_version()) | ||
| 38 | cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) | ||
| 39 | |||
| 40 | if get_option('b_sanitize').split(',').contains('address') | ||
| 41 | cdata.set('I3LOCK_ASAN_ENABLED', 1) | ||
| 42 | endif | ||
| 43 | |||
| 44 | cdata.set('HAVE_STRNDUP', cc.has_function('strndup')) | ||
| 45 | cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp')) | ||
| 46 | |||
| 47 | config_h = configure_file( | ||
| 48 | output: 'config.h', | ||
| 49 | configuration: cdata, | ||
| 50 | ) | ||
| 51 | |||
| 52 | config_h = declare_dependency(sources: config_h) | ||
| 53 | |||
| 54 | ################################################################################ | ||
| 55 | # manpages | ||
| 56 | ################################################################################ | ||
| 57 | |||
| 58 | install_man('i3lock-extended.1') | ||
| 59 | |||
| 60 | # Required for e.g. struct ucred to be defined as per unix(7). | ||
| 61 | add_project_arguments('-D_GNU_SOURCE', language: 'c') | ||
| 62 | add_project_arguments('-DEXTRAS', language: 'c') | ||
| 63 | |||
| 64 | # https://mesonbuild.com/howtox.html#add-math-library-lm-portably | ||
| 65 | m_dep = cc.find_library('m', required: false) | ||
| 66 | rt_dep = cc.find_library('rt', required: false) | ||
| 67 | |||
| 68 | xcb_dep = dependency('xcb', method: 'pkg-config') | ||
| 69 | xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config') | ||
| 70 | xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config') | ||
| 71 | xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config') | ||
| 72 | xcb_image_dep = dependency('xcb-image', method: 'pkg-config') | ||
| 73 | xcb_util_dep = dependency('xcb-util', method: 'pkg-config') | ||
| 74 | xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config') | ||
| 75 | xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config') | ||
| 76 | xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config') | ||
| 77 | cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config') | ||
| 78 | |||
| 79 | i3lock_srcs = [ | ||
| 80 | 'dpi.c', | ||
| 81 | 'extras.c', | ||
| 82 | 'i3lock.c', | ||
| 83 | 'randr.c', | ||
| 84 | 'unlock_indicator.c', | ||
| 85 | 'xcb.c', | ||
| 86 | ] | ||
| 87 | |||
| 88 | ev_dep = cc.find_library('ev') | ||
| 89 | |||
| 90 | thread_dep = dependency('threads') | ||
| 91 | |||
| 92 | i3lock_deps = [ | ||
| 93 | thread_dep, | ||
| 94 | m_dep, | ||
| 95 | rt_dep, | ||
| 96 | ev_dep, | ||
| 97 | config_h, | ||
| 98 | cairo_dep, | ||
| 99 | xcb_dep, | ||
| 100 | xcb_xkb_dep, | ||
| 101 | xcb_xinerama_dep, | ||
| 102 | xcb_randr_dep, | ||
| 103 | xcb_image_dep, | ||
| 104 | xcb_util_dep, | ||
| 105 | xcb_util_xrm_dep, | ||
| 106 | xkbcommon_dep, | ||
| 107 | xkbcommon_x11_dep, | ||
| 108 | ] | ||
| 109 | |||
| 110 | host_os = host_machine.system() | ||
| 111 | if host_os != 'openbsd' | ||
| 112 | pam_dep = cc.find_library('pam', required: true) | ||
| 113 | i3lock_deps += [pam_dep] | ||
| 114 | endif | ||
| 115 | |||
| 116 | inc = include_directories('include') | ||
| 117 | |||
| 118 | executable( | ||
| 119 | 'i3lock-extended', | ||
| 120 | i3lock_srcs, | ||
| 121 | install: true, | ||
| 122 | include_directories: inc, | ||
| 123 | dependencies: i3lock_deps, | ||
| 124 | ) | ||
| 125 | |||
| 126 | install_subdir( | ||
| 127 | 'pam', | ||
| 128 | strip_directory: true, | ||
| 129 | install_dir: join_paths(get_option('sysconfdir'), 'pam.d'), | ||
| 130 | ) | ||
