completed meson/ninja build

This commit is contained in:
2025-11-20 23:46:08 +01:00
parent c5953d152b
commit cc147e7cae
2 changed files with 76 additions and 104 deletions

View File

@@ -1,8 +1,8 @@
project(
'dbtool',
'cpp',
version: '1.9.1',
license: 'GPL',
version: '1.9.1',
meson_version: '>=1.3',
default_options: [
'warning_level=2',
@@ -16,36 +16,73 @@ add_project_arguments(
'-Wno-unused-result',
'-Wno-missing-braces',
'-Wno-format-zero-length',
'-Wundef',
'-Wvla',
'-Wno-sign-compare',
'-Wno-narrowing'
],
language: 'cpp',
)
cpp = meson.get_compiler('cpp')
conf = configuration_data()
dbtool_inc = include_directories('.')
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
pcre2 = dependency('libpcre2-8')
# manually check for libraries
lib_berkeley = cpp.find_library('db_cxx',
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')
pcre2 = dependency('libpcre2-8')
#gdbm = dependency('libgdbm6t64')
#gdbm = dependency('libdb_cxx')
if get_option('buildtype') == 'debug'
conf.set('DEBUG', '1')
endif
lib_berkeley = cpp.find_library('db_cxx',
dirs : ['/usr'])
inc_berkeley = include_directories('/usr')
conf = configuration_data()
#conf.set10('HAVE_LIBGDBM', gdbm.found())
# setup conf map
version = '@0@'.format(meson.project_version())
conf.set10('HAVE_LIBPCRE', pcre2.found())
conf.set10('DB_CXX_HEADER', lib_berkeley.found())
conf.set10('HAVE_BERKELEY', lib_berkeley.found())
conf.set10('HAVE_GDBM', lib_gdbm.found())
conf.set('prefix', prefix)
conf.set('VERSION', version)
platform_h = custom_target(
'platform_h',
output : 'platform.h',
command : ['./platform.sh', conf.get('HAVE_LIBPCRE'), '@OUTPUT@'],
# write out the config header
m = configure_file(
input : 'platform.h.in',
output : 'platform.h',
configuration : conf,
)
# code
dbtool_sources = files(
'cipher.cc',
'config.cc',
@@ -55,17 +92,25 @@ dbtool_sources = files(
'rijndael.cc'
)
# add dependencies, manual libs are added directly below
dbtool_deps = [
pcre2
]
dbtool_inc = include_directories('.')
executable(
'dbtool',
[dbtool_sources, platform_h],
include_directories: [dbtool_inc],
dependencies: [dbtool_deps, lib_berkeley],
include_directories : inc_berkeley,
[dbtool_sources],
include_directories: [dbtool_inc, inc_berkeley, inc_gdbm],
dependencies: [dbtool_deps, lib_berkeley, lib_gdbm],
install: true
)
# 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

View File

@@ -1,92 +1,19 @@
/* platform.h.in. Generated from configure.ac by autoheader. */
/* "Berkeley DB C++ Header File" */
#undef DB_CXX_HEADER
#mesondefine HAVE_BERKELEY
#mesondefine HAVE_GDBM
#mesondefine HAVE_LIBPCRE
#mesondefine HAVE_GETPASS
#mesondefine HAVE_GETOPT
#mesondefine HAVE_FDOPEN
#mesondefine HAVE_FGETC
#mesondefine HAVE_GETENV
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `fdopen' function. */
#undef HAVE_FDOPEN
#define PCRE2_CODE_UNIT_WIDTH 8
#define PACKAGE "dbtool"
/* Define to 1 if you have the `fgetc' function. */
#undef HAVE_FGETC
/* Define to 1 if you have the `getenv' function. */
#undef HAVE_GETENV
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
/* Define to 1 if you have the `getpass' function. */
#undef HAVE_GETPASS
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `gdbm' library (-lgdbm). */
#undef HAVE_LIBGDBM
/* Define to 1 if you have the `pcre' library (-lpcre). */
#undef HAVE_LIBPCRE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
#define VERSION "@VERSION@"
/* Define to empty if `const' does not conform to ANSI C. */
#undef const