build: set pkgconfig/dependency variables for features

This allows libseat users to e.g. advise people to chmod a+s the
executable if libseat is built with the builtin backend.

While bumping the Meson version, adjust the scdoc logic to avoid
the following warnings:

    WARNING: Project targeting '>=0.56.0' but tried to use feature deprecated since '0.56.0': Dependency.get_pkgconfig_variable. use Dependency.get_variable(pkgconfig : ...) instead
    WARNING: Project targeting '>=0.56.0' but tried to use feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead
This commit is contained in:
Simon Ser 2021-04-10 09:15:47 +02:00 committed by Kenny Levinsen
parent 5884a6003a
commit 81ff0a09a9

View file

@ -3,7 +3,7 @@ project(
'c', 'c',
version: '0.5.0', version: '0.5.0',
license: 'MIT', license: 'MIT',
meson_version: '>=0.53.0', meson_version: '>=0.56.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=3', 'warning_level=3',
@ -167,18 +167,26 @@ lib = library(
install_headers('include/libseat.h') install_headers('include/libseat.h')
libseat_vars = {
'have_seatd': with_seatd.to_string(),
'have_logind': logind.found().to_string(),
'have_builtin': with_builtin.to_string(),
}
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
pkgconfig.generate(lib, pkgconfig.generate(lib,
version: meson.project_version(), version: meson.project_version(),
filebase: 'libseat', filebase: 'libseat',
name: 'libseat', name: 'libseat',
description: 'Seat management library', description: 'Seat management library',
variables: libseat_vars,
) )
libseat = declare_dependency( libseat = declare_dependency(
link_with: lib, link_with: lib,
dependencies: private_deps, dependencies: private_deps,
include_directories: include_directories('include', is_system: true), include_directories: include_directories('include', is_system: true),
variables: libseat_vars,
) )
if with_server if with_server
@ -220,7 +228,7 @@ else
endif endif
if scdoc.found() if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true)
mandir = get_option('mandir') mandir = get_option('mandir')
foreach src : ['seatd.1.scd'] foreach src : ['seatd.1.scd']
@ -233,7 +241,7 @@ if scdoc.found()
input: 'man/' + src, input: 'man/' + src,
output: output, output: output,
command: [ command: [
'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) 'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.full_path(), output)
], ],
install: true, install: true,
install_dir: '@0@/man@1@'.format(mandir, section) install_dir: '@0@/man@1@'.format(mandir, section)