2019-01-13 20:15:32 -06:00
|
|
|
project(
|
|
|
|
'swaylock',
|
|
|
|
'c',
|
2023-01-28 15:54:27 -06:00
|
|
|
version: '1.7.2',
|
2019-01-13 20:15:32 -06:00
|
|
|
license: 'MIT',
|
2022-02-02 08:44:41 -06:00
|
|
|
meson_version: '>=0.59.0',
|
2019-01-13 20:15:32 -06:00
|
|
|
default_options: [
|
|
|
|
'c_std=c11',
|
|
|
|
'warning_level=2',
|
|
|
|
'werror=true',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
add_project_arguments(
|
|
|
|
[
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-unused-result',
|
|
|
|
'-Wundef',
|
2019-01-18 06:27:42 -06:00
|
|
|
'-Wvla',
|
2019-01-13 20:15:32 -06:00
|
|
|
],
|
|
|
|
language: 'c',
|
|
|
|
)
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
|
|
|
is_freebsd = host_machine.system().startswith('freebsd')
|
|
|
|
|
|
|
|
if is_freebsd
|
|
|
|
add_project_arguments('-D_C11_SOURCE', language: 'c')
|
|
|
|
endif
|
|
|
|
|
2022-02-02 09:43:58 -06:00
|
|
|
wayland_client = dependency('wayland-client', version: '>=1.20.0')
|
2021-12-20 10:25:44 -06:00
|
|
|
wayland_protos = dependency('wayland-protocols', version: '>=1.25', fallback: 'wayland-protocols')
|
2022-04-25 14:28:34 -05:00
|
|
|
wayland_scanner = dependency('wayland-scanner', version: '>=1.15.0', native: true)
|
2022-02-02 08:35:52 -06:00
|
|
|
xkbcommon = dependency('xkbcommon')
|
|
|
|
cairo = dependency('cairo')
|
|
|
|
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
|
|
|
libpam = cc.find_library('pam', required: get_option('pam'))
|
|
|
|
crypt = cc.find_library('crypt', required: not libpam.found())
|
|
|
|
math = cc.find_library('m')
|
2022-11-27 17:46:05 -06:00
|
|
|
rt = cc.find_library('rt')
|
2019-01-13 20:15:32 -06:00
|
|
|
|
|
|
|
git = find_program('git', required: false)
|
2019-01-24 15:14:13 -06:00
|
|
|
scdoc = find_program('scdoc', required: get_option('man-pages'))
|
2022-11-27 07:13:37 -06:00
|
|
|
wayland_scanner_prog = find_program(wayland_scanner.get_variable('wayland_scanner'), native: true)
|
2019-01-13 20:15:32 -06:00
|
|
|
|
2022-12-05 04:02:09 -06:00
|
|
|
version = meson.project_version()
|
2019-02-05 07:09:32 -06:00
|
|
|
if git.found()
|
2022-02-02 08:34:13 -06:00
|
|
|
git_commit_hash = run_command([git, 'describe', '--always', '--tags'], check: false)
|
|
|
|
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
2019-02-12 16:25:56 -06:00
|
|
|
if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0
|
2022-12-05 04:02:09 -06:00
|
|
|
version = '@0@ (" __DATE__ ", branch \'@1@\')'.format(git_commit_hash.stdout().strip(), git_branch.stdout().strip())
|
2019-02-12 16:25:56 -06:00
|
|
|
endif
|
2019-01-13 20:15:32 -06:00
|
|
|
endif
|
|
|
|
|
2021-12-20 09:41:10 -06:00
|
|
|
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
2019-01-13 20:15:32 -06:00
|
|
|
|
|
|
|
wayland_scanner_code = generator(
|
2022-02-02 08:42:29 -06:00
|
|
|
wayland_scanner_prog,
|
2019-01-13 20:15:32 -06:00
|
|
|
output: '@BASENAME@-protocol.c',
|
2022-02-02 08:42:29 -06:00
|
|
|
arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
|
2019-01-13 20:15:32 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
wayland_scanner_client = generator(
|
2022-02-02 08:42:29 -06:00
|
|
|
wayland_scanner_prog,
|
2019-01-13 20:15:32 -06:00
|
|
|
output: '@BASENAME@-client-protocol.h',
|
|
|
|
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
|
|
|
|
)
|
|
|
|
|
|
|
|
client_protocols = [
|
2022-09-24 05:51:19 -05:00
|
|
|
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
|
|
|
wl_protocol_dir / 'staging/ext-session-lock/ext-session-lock-v1.xml',
|
|
|
|
'wlr-layer-shell-unstable-v1.xml',
|
|
|
|
'wlr-input-inhibitor-unstable-v1.xml',
|
2019-01-13 20:15:32 -06:00
|
|
|
]
|
|
|
|
|
2022-12-05 03:59:22 -06:00
|
|
|
protos_src = []
|
2022-09-24 05:51:19 -05:00
|
|
|
foreach xml : client_protocols
|
2022-12-05 03:59:22 -06:00
|
|
|
protos_src += wayland_scanner_code.process(xml)
|
|
|
|
protos_src += wayland_scanner_client.process(xml)
|
2019-01-13 20:15:32 -06:00
|
|
|
endforeach
|
|
|
|
|
|
|
|
conf_data = configuration_data()
|
2022-12-05 04:02:09 -06:00
|
|
|
conf_data.set_quoted('SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
|
|
|
|
conf_data.set_quoted('SWAYLOCK_VERSION', version)
|
2019-01-13 20:15:32 -06:00
|
|
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
|
|
|
|
|
|
|
subdir('include')
|
2018-04-19 19:25:51 -05:00
|
|
|
|
2018-09-28 05:18:54 -05:00
|
|
|
dependencies = [
|
2019-01-16 15:45:38 -06:00
|
|
|
cairo,
|
|
|
|
gdk_pixbuf,
|
|
|
|
math,
|
2022-11-27 17:46:05 -06:00
|
|
|
rt,
|
2019-01-16 15:45:38 -06:00
|
|
|
xkbcommon,
|
|
|
|
wayland_client,
|
2018-09-28 05:18:54 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
sources = [
|
2019-01-13 20:15:32 -06:00
|
|
|
'background-image.c',
|
|
|
|
'cairo.c',
|
2019-01-16 16:35:14 -06:00
|
|
|
'comm.c',
|
2019-01-14 22:30:54 -06:00
|
|
|
'log.c',
|
2019-01-13 20:15:32 -06:00
|
|
|
'loop.c',
|
|
|
|
'main.c',
|
|
|
|
'password.c',
|
2022-05-30 04:50:30 -05:00
|
|
|
'password-buffer.c',
|
2019-01-13 20:15:32 -06:00
|
|
|
'pool-buffer.c',
|
|
|
|
'render.c',
|
|
|
|
'seat.c',
|
|
|
|
'unicode.c',
|
2018-09-28 05:18:54 -05:00
|
|
|
]
|
|
|
|
|
2019-01-18 01:58:57 -06:00
|
|
|
if libpam.found()
|
2019-01-16 15:45:38 -06:00
|
|
|
sources += ['pam.c']
|
|
|
|
dependencies += [libpam]
|
2018-09-28 05:18:54 -05:00
|
|
|
else
|
2019-01-16 15:45:38 -06:00
|
|
|
warning('The swaylock binary must be setuid when compiled without libpam')
|
|
|
|
warning('You must do this manually post-install: chmod a+s /path/to/swaylock')
|
|
|
|
sources += ['shadow.c']
|
2019-01-18 01:58:57 -06:00
|
|
|
dependencies += [crypt]
|
2018-09-28 05:18:54 -05:00
|
|
|
endif
|
|
|
|
|
2019-01-13 20:15:32 -06:00
|
|
|
swaylock_inc = include_directories('include')
|
|
|
|
|
2018-09-28 05:18:54 -05:00
|
|
|
executable('swaylock',
|
2022-12-05 03:59:22 -06:00
|
|
|
sources + protos_src,
|
2019-01-13 20:15:32 -06:00
|
|
|
include_directories: [swaylock_inc],
|
2018-09-28 05:18:54 -05:00
|
|
|
dependencies: dependencies,
|
2018-04-02 21:48:13 -05:00
|
|
|
install: true
|
|
|
|
)
|
2018-04-19 19:25:51 -05:00
|
|
|
|
2020-01-06 11:17:15 -06:00
|
|
|
install_data(
|
|
|
|
'pam/swaylock',
|
2022-12-05 04:02:09 -06:00
|
|
|
install_dir: get_option('sysconfdir') / 'pam.d'
|
2020-01-06 11:17:15 -06:00
|
|
|
)
|
2019-01-13 20:24:33 -06:00
|
|
|
|
|
|
|
if scdoc.found()
|
|
|
|
mandir = get_option('mandir')
|
|
|
|
man_files = [
|
|
|
|
'swaylock.1.scd',
|
|
|
|
]
|
|
|
|
foreach filename : man_files
|
|
|
|
topic = filename.split('.')[-3].split('/')[-1]
|
|
|
|
section = filename.split('.')[-2]
|
|
|
|
output = '@0@.@1@'.format(topic, section)
|
|
|
|
|
|
|
|
custom_target(
|
|
|
|
output,
|
|
|
|
input: filename,
|
|
|
|
output: output,
|
2022-02-02 08:44:41 -06:00
|
|
|
command: scdoc,
|
|
|
|
feed: true,
|
|
|
|
capture: true,
|
2019-01-13 20:24:33 -06:00
|
|
|
install: true,
|
|
|
|
install_dir: '@0@/man@1@'.format(mandir, section)
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endif
|
2019-01-14 18:38:03 -06:00
|
|
|
|
2022-12-05 03:57:52 -06:00
|
|
|
subdir('completions')
|