]> git.sesse.net Git - plocate/blob - meson.build
Bump version number.
[plocate] / meson.build
1 project('plocate', 'cpp', default_options: ['buildtype=debugoptimized','cpp_std=c++17'], version: '1.0.6-pre')
2
3 # Make the version available as a #define.
4 add_project_arguments('-DPLOCATE_VERSION="' + meson.project_version() + '"', language: 'cpp')
5
6 cxx = meson.get_compiler('cpp')
7 uringdep = dependency('liburing', required: false)
8 zstddep = dependency('libzstd')
9 threaddep = dependency('threads')
10 atomicdep = cxx.find_library('atomic', required: false)
11
12 if not uringdep.found()
13         add_project_arguments('-DWITHOUT_URING', language: 'cpp')
14 endif
15
16 # Function multiversioning is x86-only _and_ not available on certain targets
17 # (they need “ifunc”, indirect functions, a GNU extension).
18 code = '__attribute__((target("default"))) void func();'
19 if cxx.compiles(code, name: 'function multiversioning')
20         add_project_arguments('-DHAS_FUNCTION_MULTIVERSIONING', language: 'cpp')
21 endif
22
23 executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp'],
24         dependencies: [uringdep, zstddep, threaddep, atomicdep],
25         install: true,
26         install_mode: ['rwxr-sr-x', 'root', 'mlocate'])
27 executable('plocate-build', 'plocate-build.cpp',
28         dependencies: [zstddep],
29         install: true,
30         install_dir: get_option('sbindir'))
31
32 conf_data = configuration_data()
33 conf_data.set('PROCESSED_BY_MESON', '1')
34 conf_data.set('sbindir', get_option('prefix') + '/' + get_option('sbindir'))
35 conf_data.set('locategroup', get_option('locategroup'))
36 update_script = configure_file(input: 'update-plocate.sh',
37                output: 'update-plocate.sh',
38                configuration: conf_data)
39
40 if get_option('install_cron')
41         install_data(update_script,
42                 install_dir: '/etc/cron.daily',
43                 rename: 'plocate')
44 endif
45 install_man('plocate.1')
46 install_man('plocate-build.8')
47
48 # Requires having TurboPFor checked out, so not built by default.
49 # Unless you have a recent Meson, there's no apparently good way
50 # of calling into that directory to run make, and we're not
51 # replicating their build system, so it has to be manual.
52 pfordir = meson.source_root() + '/TurboPFor-Integer-Compression'
53 if run_command('[', '-r', pfordir + '/libic.a', ']').returncode() == 0
54         turbopfordep = declare_dependency(
55                 include_directories: include_directories('TurboPFor-Integer-Compression'),
56                 dependencies: meson.get_compiler('cpp').find_library('ic', dirs: pfordir))
57         executable('bench', ['bench.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp'],
58                 dependencies: [uringdep, turbopfordep],
59                 build_by_default: false,
60                 install: false)
61 endif