2017-06-20 00:11:42 +00:00
|
|
|
project('pkgconf', 'c',
|
2023-12-11 05:58:17 +00:00
|
|
|
version : '2.1.1',
|
2017-06-20 00:11:42 +00:00
|
|
|
license : 'ISC',
|
2022-08-17 18:05:55 +00:00
|
|
|
meson_version : '>=0.49',
|
2022-07-28 23:01:52 +00:00
|
|
|
default_options : ['c_std=c99'],
|
|
|
|
)
|
2017-06-20 06:11:36 +00:00
|
|
|
|
2017-06-20 00:03:00 +00:00
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2022-07-29 17:18:59 +00:00
|
|
|
add_project_arguments(
|
|
|
|
'-D_BSD_SOURCE',
|
|
|
|
'-D_DEFAULT_SOURCE',
|
2022-07-29 17:20:29 +00:00
|
|
|
cc.get_supported_arguments(
|
|
|
|
'-Wimplicit-function-declaration',
|
2022-08-03 19:01:47 +00:00
|
|
|
'-Wmisleading-indentation',
|
2022-07-29 17:20:29 +00:00
|
|
|
),
|
2022-07-29 17:18:59 +00:00
|
|
|
language : 'c',
|
|
|
|
)
|
2017-06-20 06:11:36 +00:00
|
|
|
|
2017-06-20 00:03:00 +00:00
|
|
|
cdata = configuration_data()
|
|
|
|
|
|
|
|
check_functions = [
|
2022-07-29 17:38:35 +00:00
|
|
|
['strlcat', 'string.h'],
|
|
|
|
['strlcpy', 'string.h'],
|
|
|
|
['strndup', 'string.h'],
|
|
|
|
['strdup', 'string.h'],
|
|
|
|
['strncasecmp', 'strings.h'],
|
|
|
|
['strcasecmp', 'strings.h'],
|
|
|
|
['reallocarray', 'stdlib.h'],
|
2017-06-20 00:03:00 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
foreach f : check_functions
|
2023-04-24 13:50:00 +00:00
|
|
|
name = f[0].to_upper().underscorify()
|
2022-07-29 17:38:35 +00:00
|
|
|
if cc.has_function(f[0], prefix : '#define _BSD_SOURCE\n#include <@0@>'.format(f[1])) and cc.has_header_symbol(f[1], f[0], prefix : '#define _BSD_SOURCE')
|
2023-04-24 13:50:00 +00:00
|
|
|
cdata.set('HAVE_@0@'.format(name), 1)
|
|
|
|
cdata.set('HAVE_DECL_@0@'.format(name), 1)
|
|
|
|
else
|
|
|
|
cdata.set('HAVE_DECL_@0@'.format(name), 0)
|
2017-06-20 00:03:00 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2017-06-20 06:23:55 +00:00
|
|
|
default_path = []
|
|
|
|
foreach f : ['libdir', 'datadir']
|
|
|
|
default_path += [join_paths(get_option('prefix'), get_option(f), 'pkgconfig')]
|
|
|
|
endforeach
|
|
|
|
|
2018-06-14 19:43:01 +00:00
|
|
|
personality_path = []
|
|
|
|
foreach f : ['libdir', 'datadir']
|
|
|
|
personality_path += [join_paths(get_option('prefix'), get_option(f), 'pkgconfig', 'personality.d')]
|
|
|
|
endforeach
|
|
|
|
|
2023-09-13 17:49:11 +00:00
|
|
|
SYSTEM_LIBDIR = get_option('with-system-libdir')
|
|
|
|
if SYSTEM_LIBDIR != ''
|
|
|
|
cdata.set_quoted('SYSTEM_LIBDIR', SYSTEM_LIBDIR)
|
|
|
|
else
|
|
|
|
cdata.set_quoted('SYSTEM_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
|
|
|
|
endif
|
|
|
|
SYSTEM_INCLUDEDIR = get_option('with-system-includedir')
|
|
|
|
if SYSTEM_INCLUDEDIR != ''
|
|
|
|
cdata.set_quoted('SYSTEM_INCLUDEDIR', SYSTEM_INCLUDEDIR)
|
|
|
|
else
|
|
|
|
cdata.set_quoted('SYSTEM_INCLUDEDIR', join_paths(get_option('prefix'), get_option('includedir')))
|
|
|
|
endif
|
2017-06-20 06:23:55 +00:00
|
|
|
cdata.set_quoted('PKG_DEFAULT_PATH', ':'.join(default_path))
|
2018-06-14 19:43:01 +00:00
|
|
|
cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
|
2017-06-20 06:11:36 +00:00
|
|
|
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
|
2017-06-20 00:03:00 +00:00
|
|
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
2019-07-12 11:53:37 +00:00
|
|
|
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
|
2022-07-29 17:40:54 +00:00
|
|
|
cdata.set('abs_top_srcdir', meson.current_source_dir())
|
|
|
|
cdata.set('abs_top_builddir', meson.current_build_dir())
|
2017-06-20 00:03:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
subdir('libpkgconf')
|
|
|
|
|
2021-07-25 01:45:07 +00:00
|
|
|
libtype = get_option('default_library')
|
|
|
|
if libtype == 'static'
|
|
|
|
build_static = '-DPKGCONFIG_IS_STATIC'
|
|
|
|
else
|
2021-07-25 01:56:46 +00:00
|
|
|
build_static = '-DPKGCONFIG_IS_NOT_STATIC'
|
2021-07-25 01:45:07 +00:00
|
|
|
endif
|
|
|
|
|
2020-11-28 14:21:02 +00:00
|
|
|
libpkgconf = library('pkgconf',
|
2017-06-20 00:03:00 +00:00
|
|
|
'libpkgconf/argvsplit.c',
|
|
|
|
'libpkgconf/audit.c',
|
|
|
|
'libpkgconf/bsdstubs.c',
|
|
|
|
'libpkgconf/cache.c',
|
|
|
|
'libpkgconf/client.c',
|
|
|
|
'libpkgconf/dependency.c',
|
|
|
|
'libpkgconf/fileio.c',
|
|
|
|
'libpkgconf/fragment.c',
|
2018-05-10 02:21:39 +00:00
|
|
|
'libpkgconf/parser.c',
|
2017-06-20 00:03:00 +00:00
|
|
|
'libpkgconf/path.c',
|
2018-05-09 21:54:21 +00:00
|
|
|
'libpkgconf/personality.c',
|
2017-06-20 00:03:00 +00:00
|
|
|
'libpkgconf/pkg.c',
|
|
|
|
'libpkgconf/queue.c',
|
|
|
|
'libpkgconf/tuple.c',
|
2021-07-25 01:45:07 +00:00
|
|
|
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
|
2017-06-20 00:03:00 +00:00
|
|
|
install : true,
|
2024-03-27 18:31:48 +00:00
|
|
|
version : '5.0.0',
|
|
|
|
soversion : '5',
|
2017-06-20 00:03:00 +00:00
|
|
|
)
|
|
|
|
|
2021-11-12 02:35:54 +00:00
|
|
|
# For other projects using libpkgconfig as a subproject
|
|
|
|
dep_libpkgconf = declare_dependency(
|
|
|
|
link_with : libpkgconf,
|
|
|
|
include_directories : include_directories('.'),
|
|
|
|
)
|
|
|
|
|
2021-11-12 02:39:56 +00:00
|
|
|
# If we have a new enough meson override the dependency so that only
|
|
|
|
# `dependency('libpkgconf')` is required from the consumer
|
|
|
|
if meson.version().version_compare('>= 0.54.0')
|
|
|
|
meson.override_dependency('libpkgconf', dep_libpkgconf)
|
|
|
|
endif
|
|
|
|
|
2020-11-28 14:20:25 +00:00
|
|
|
pkg = import('pkgconfig')
|
|
|
|
pkg.generate(libpkgconf,
|
|
|
|
name : 'libpkgconf',
|
|
|
|
description : 'a library for accessing and manipulating development framework configuration',
|
|
|
|
url: 'http://github.com/pkgconf/pkgconf',
|
|
|
|
filebase : 'libpkgconf',
|
|
|
|
subdirs: ['pkgconf'],
|
2021-07-25 01:45:07 +00:00
|
|
|
extra_cflags : build_static
|
2020-11-28 14:20:25 +00:00
|
|
|
)
|
2017-06-20 06:11:36 +00:00
|
|
|
|
2021-07-25 01:45:07 +00:00
|
|
|
|
2017-06-20 06:11:36 +00:00
|
|
|
pkgconf_exe = executable('pkgconf',
|
2018-02-12 06:45:55 +00:00
|
|
|
'cli/main.c',
|
|
|
|
'cli/getopt_long.c',
|
|
|
|
'cli/renderer-msvc.c',
|
2017-06-20 00:11:42 +00:00
|
|
|
link_with : libpkgconf,
|
2021-07-25 01:45:07 +00:00
|
|
|
c_args: build_static,
|
2017-06-20 00:03:00 +00:00
|
|
|
install : true)
|
|
|
|
|
2022-08-17 18:05:55 +00:00
|
|
|
with_tests = get_option('tests')
|
|
|
|
kyua_exe = find_program('kyua', required : with_tests, disabler : true)
|
|
|
|
atf_sh_exe = find_program('atf-sh', required : with_tests, disabler : true)
|
|
|
|
kyuafile = configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
|
|
|
|
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile', kyuafile, '--build-root', meson.current_build_dir()])
|
|
|
|
subdir('tests')
|
2017-06-20 06:11:36 +00:00
|
|
|
|
2017-12-06 00:45:06 +00:00
|
|
|
install_man('man/pkgconf.1')
|
2017-12-06 01:47:11 +00:00
|
|
|
install_man('man/pkg.m4.7')
|
2018-07-19 22:27:02 +00:00
|
|
|
install_man('man/pc.5')
|
|
|
|
install_man('man/pkgconf-personality.5')
|
2017-09-09 01:52:02 +00:00
|
|
|
install_data('pkg.m4', install_dir: 'share/aclocal')
|
2020-11-28 14:22:28 +00:00
|
|
|
install_data('AUTHORS', install_dir: 'share/doc/pkgconf')
|
2021-11-12 02:39:56 +00:00
|
|
|
install_data('README.md', install_dir: 'share/doc/pkgconf')
|