Commit 832ec6cc authored by hanetzer's avatar hanetzer

build: port to meson

Signed-off-by: hanetzer's avatarMarty E. Plummer <>
parent dd1ab531
......@@ -84,3 +84,4 @@ core
  • I think it's better not to include this. The builddir is custom-named so it's technically a user-supplied file.

  • Also fair, I just like being able to git status and not have a buncha junk files show up.

Please register or sign in to reply
install_data('40-libinput.conf', install_dir: sysconfigdir)
inc = include_directories('.')
install_headers('libinput-properties.h', subdir: 'xorg')
man_data = configuration_data()
man_data.set('__appmansuffix__', 1)
man_data.set('__drivermansufix__', 4)
man_data.set('__filemansuffix__', 5)
man_data.set('__libmansuffix__', 3)
man_data.set('__miscmansuffix__', 7)
man_data.set('__xconfigfile__', 'xorg.conf')
man_data.set('__xservername__', 'Xorg')
libinput_man = configure_file(
input: '',
output: 'libinput.4',
configuration: man_data
'xf86-input-libinput', 'c',
version: '0.28.0',
license: 'MIT',
# compilers
cc = meson.get_compiler('c')
# meson modules
pkg = import('pkgconfig')
# version variables
xf86_libinput_version = meson.project_version()
version_array = xf86_libinput_version.split('.')
xf86_libinput_major_version = version_array[0].to_int()
xf86_libinput_minor_version = version_array[1].to_int()
xf86_libinput_patch_version = version_array[2].to_int()
# dependencies
xorg_server_dep = dependency('xorg-server', version: '>= 1.10')
  • nipick: xserver_dep would be enough, there are no credible alternatives anyway

    also, I prefer dep_foo over foo_dep but that's really personal style, so whatever you end up using is fine.

  • Fair. That being the case we can prolly hardcode X.Org/xorg into the manpage as well since there isn't any credible alternatives. I'm fine with changing to dep_foo; I've no hard preference on either and this is probably going to be a 'drive-by' contribution anyways.

Please register or sign in to reply
libinput_dep = dependency('libinput', version: '>= 1.4.901')
m_dep = cc.find_library('m', required: false)
# install paths
moduledir = xorg_server_dep.get_pkgconfig_variable('moduledir')
sysconfigdir = xorg_server_dep.get_pkgconfig_variable('sysconfigdir')
sdkdir = xorg_server_dep.get_pkgconfig_variable('sdkdir')
# config.h
conf_data = configuration_data()
conf_data.set('PACKAGE_VERSION_MAJOR', xf86_libinput_major_version)
conf_data.set('PACKAGE_VERSION_MINOR', xf86_libinput_minor_version)
conf_data.set('PACKAGE_VERSION_PATCHLEVEL', xf86_libinput_patch_version)
# libinput check
libinput_device_touch_get_touch_count_code = '''#include <libinput.h>
int main() {
return 0;
if cc.compiles(libinput_device_touch_get_touch_count_code, name: 'if libinput_device_touch_get_touch_count is available')
conf_data.set('HAVE_LIBINPUT_TOUCH_COUNT', 1)
output: 'config.h',
configuration: conf_data
conf_inc = include_directories('.')
# subdirs
  • given how little there is in most of the subdirs, I think you could just include the few lines here

  • Could grow, and I think overorganization at the start of a project is better than having to go back and redo it once it does get complex.

Please register or sign in to reply
src_inc = include_directories('.')
draglock_lib = static_library(
include_directories: [ conf_inc, src_inc ],
draglock_dep = declare_dependency(
link_with: draglock_lib,
include_directories: src_inc
bezier_lib = static_library(
include_directories: [ conf_inc, src_inc ],
bezier_dep = declare_dependency(
link_with: bezier_lib,
include_directories: src_inc
name_prefix: '',
c_args: [ '-DHAVE_CONFIG_H=1' ],
  • huh, I wonder if there's a case with automake where we don't have that define set. And still build correctly. I suspect we could just wipe this and move on with unconditional config.h includes.

  • Good point, my aim was more or less a 1:1 port so I just rolled with it.

Please register or sign in to reply
dependencies: [ xorg_server_dep, libinput_dep, draglock_dep, bezier_dep, m_dep ],
include_directories: [ inc, src_inc, conf_inc ],
install: true,
install_dir: join_paths(moduledir, 'input'),
name: 'xorg-libinput',
description: 'X.Org libinput input driver',
variables: [ 'sdkdir=@0@'.format(sdkdir) ],
subdirs: [ 'xorg' ],
filebase: 'xorg-libinput',
draglock = executable(
dependencies: draglock_dep,
test('draglock', draglock)
bezier = executable(
dependencies: [ bezier_dep, m_dep ],
test('bezier', bezier)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment