Merge pull request #22 from swaywm/meson-options

Add Meson feature options
This commit is contained in:
Drew DeVault 2019-01-22 09:11:36 -05:00 committed by GitHub
commit f0353900ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View File

@ -2,6 +2,7 @@ project(
'swaylock', 'swaylock',
'c', 'c',
license: 'MIT', license: 'MIT',
meson_version: '>=0.48.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=2', 'warning_level=2',
@ -39,9 +40,9 @@ xkbcommon = dependency('xkbcommon')
cairo = dependency('cairo') 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: get_option('gdk-pixbuf'))
libpam = cc.find_library('pam', required: get_option('pam') == 'enabled') libpam = cc.find_library('pam', required: get_option('pam'))
crypt = cc.find_library('crypt', required: false) crypt = cc.find_library('crypt', required: not libpam.found())
math = cc.find_library('m') math = cc.find_library('m')
git = find_program('git', required: false) git = find_program('git', required: false)
@ -139,16 +140,14 @@ sources = [
'unicode.c', 'unicode.c',
] ]
if libpam.found() and get_option('pam') != 'disabled' if libpam.found()
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() dependencies += [crypt]
dependencies += [crypt]
endif
endif endif
swaylock_inc = include_directories('include') swaylock_inc = include_directories('include')

View File

@ -1,11 +1,6 @@
option('swaylock-version', type : 'string', description: 'The version string reported in `swaylock --version`.') option('swaylock-version', type : 'string', description: 'The version string reported in `swaylock --version`')
option( option('pam', type: 'feature', value: 'auto', description: 'Use PAM instead of shadow')
'pam', option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats')
type: 'combo', option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions')
choices: ['auto', 'enabled', 'disabled'], option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions')
value: 'auto', option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions')
description: 'Use PAM instead of shadow.',
)
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('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')