Merge pull request #17 from swaywm/pam-option

Add a pam Meson option
This commit is contained in:
Drew DeVault 2019-01-16 19:05:25 -05:00 committed by GitHub
commit b44d7a0e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 23 deletions

View File

@ -18,4 +18,7 @@ tasks:
- build: | - build: |
cd swaylock cd swaylock
ninja -C build ninja -C build
- build-no-pam: |
cd swaylock
meson configure build -Dpam=disabled
ninja -C build

View File

@ -39,7 +39,7 @@ cairo = dependency('cairo')
pango = dependency('pango') pango = dependency('pango')
pangocairo = dependency('pangocairo') pangocairo = dependency('pangocairo')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false)
libpam = cc.find_library('pam', required: false) libpam = cc.find_library('pam', required: get_option('pam') == 'enabled')
crypt = cc.find_library('crypt', required: false) crypt = cc.find_library('crypt', required: false)
math = cc.find_library('m') math = cc.find_library('m')
@ -114,14 +114,14 @@ conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
subdir('include') subdir('include')
dependencies = [ dependencies = [
cairo, cairo,
client_protos, client_protos,
gdk_pixbuf, gdk_pixbuf,
math, math,
pango, pango,
pangocairo, pangocairo,
xkbcommon, xkbcommon,
wayland_client, wayland_client,
] ]
sources = [ sources = [
@ -138,22 +138,22 @@ sources = [
'unicode.c', 'unicode.c',
] ]
if libpam.found() if libpam.found() and get_option('pam') != 'disabled'
sources += ['pam.c'] sources += ['pam.c']
dependencies += [libpam] dependencies += [libpam]
else else
warning('The swaylock binary must be setuid when compiled without libpam') 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') warning('You must do this manually post-install: chmod a+s /path/to/swaylock')
sources += ['shadow.c'] sources += ['shadow.c']
if crypt.found() if crypt.found()
dependencies += [crypt] dependencies += [crypt]
endif endif
endif endif
swaylock_inc = include_directories('include') swaylock_inc = include_directories('include')
executable('swaylock', executable('swaylock',
sources, sources,
include_directories: [swaylock_inc], include_directories: [swaylock_inc],
dependencies: dependencies, dependencies: dependencies,
install: true install: true
@ -199,7 +199,7 @@ endif
datadir = get_option('datadir') datadir = get_option('datadir')
if (get_option('zsh-completions')) if get_option('zsh-completions')
zsh_files = files( zsh_files = files(
'completions/zsh/_swaylock', 'completions/zsh/_swaylock',
) )
@ -208,7 +208,7 @@ if (get_option('zsh-completions'))
install_data(zsh_files, install_dir: zsh_install_dir) install_data(zsh_files, install_dir: zsh_install_dir)
endif endif
if (get_option('bash-completions')) if get_option('bash-completions')
bash_files = files( bash_files = files(
'completions/bash/swaylock', 'completions/bash/swaylock',
) )
@ -217,7 +217,7 @@ if (get_option('bash-completions'))
install_data(bash_files, install_dir: bash_install_dir) install_data(bash_files, install_dir: bash_install_dir)
endif endif
if (get_option('fish-completions')) if get_option('fish-completions')
fish_files = files( fish_files = files(
'completions/fish/swaylock.fish', 'completions/fish/swaylock.fish',
) )

View File

@ -1,4 +1,11 @@
option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.') option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.')
option(
'pam',
type: 'combo',
choices: ['auto', 'enabled', 'disabled'],
value: 'auto',
description: 'Use PAM instead of shadow.',
)
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')