Files
dbtool/meson.build

117 lines
2.6 KiB
Meson
Raw Normal View History

2025-11-18 21:18:18 +01:00
project(
'dbtool',
'cpp',
license: 'GPL',
2025-11-20 23:46:08 +01:00
version: '1.9.1',
2025-11-18 21:18:18 +01:00
meson_version: '>=1.3',
default_options: [
'warning_level=2',
'werror=true',
],
)
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wno-missing-braces',
'-Wno-format-zero-length',
'-Wvla',
2025-11-20 23:46:08 +01:00
'-Wno-sign-compare',
'-Wno-narrowing'
2025-11-18 21:18:18 +01:00
],
language: 'cpp',
)
2025-11-20 23:46:08 +01:00
2025-11-18 21:18:18 +01:00
cpp = meson.get_compiler('cpp')
2025-11-20 23:46:08 +01:00
conf = configuration_data()
dbtool_inc = include_directories('.')
2025-11-18 21:18:18 +01:00
2025-11-20 23:46:08 +01:00
if host_machine.system().startswith('freebsd')
dbtool_inc = include_directories('.', '/usr/local/include')
add_project_link_arguments('LDFLAGS=/usr/local/lib')
endif
# check for funcs.
foreach func : ['getopt', 'fdopen', 'fgetc', 'getenv', 'getpass']
conf.set('HAVE_'+func.to_upper(), cpp.has_function(func, prefix : '#include <unistd.h>\n#include <stdio.h>\n#include <stdlib.h>'))
endforeach
# check for libraries with CMAKE or pkg-config
2025-11-18 21:18:18 +01:00
pcre2 = dependency('libpcre2-8')
2025-11-20 23:46:08 +01:00
# manually check for libraries
2025-11-18 21:18:18 +01:00
lib_berkeley = cpp.find_library('db_cxx',
2025-11-20 23:46:08 +01:00
dirs : ['/usr', '/usr/local'])
inc_berkeley = include_directories('/usr', '/usr/local')
lib_gdbm = cpp.find_library('gdbm',
dirs : ['/usr', '/usr/local'])
inc_gdbm = include_directories('/usr', '/usr/local')
# check commandline options
prefix = get_option('prefix')
if get_option('buildtype') == 'debug'
conf.set('DEBUG', '1')
endif
2025-11-18 21:18:18 +01:00
2025-11-20 23:46:08 +01:00
# setup conf map
version = '@0@'.format(meson.project_version())
2025-11-18 21:18:18 +01:00
conf.set10('HAVE_LIBPCRE', pcre2.found())
2025-11-20 23:46:08 +01:00
conf.set10('HAVE_BERKELEY', lib_berkeley.found())
conf.set10('HAVE_GDBM', lib_gdbm.found())
2025-11-18 21:18:18 +01:00
conf.set('prefix', prefix)
2025-11-20 23:46:08 +01:00
conf.set('VERSION', version)
2025-11-18 21:18:18 +01:00
2025-11-20 23:46:08 +01:00
# write out the config header
m = configure_file(
input : 'platform.h.in',
output : 'platform.h',
configuration : conf,
2025-11-18 21:18:18 +01:00
)
2025-11-20 23:46:08 +01:00
# code
2025-11-18 21:18:18 +01:00
dbtool_sources = files(
'cipher.cc',
'config.cc',
'dbtool.cc',
'digest.cc',
'engine.cc',
'rijndael.cc'
)
2025-11-20 23:46:08 +01:00
# add dependencies, manual libs are added directly below
2025-11-18 21:18:18 +01:00
dbtool_deps = [
pcre2
]
executable(
'dbtool',
2025-11-20 23:46:08 +01:00
[dbtool_sources],
include_directories: [dbtool_inc, inc_berkeley, inc_gdbm],
dependencies: [dbtool_deps, lib_berkeley, lib_gdbm],
2025-11-18 21:18:18 +01:00
install: true
)
2025-11-20 23:46:08 +01:00
# build manual page
pod2man = find_program('pod2man', native: true)
if pod2man.found()
res = run_command(pod2man.full_path(), 'dbtool.pod', 'dbtool.1', check:true)
if res.returncode() == 0
install_man('dbtool.1')
endif
endif