Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson fixes and cleanups #256

Closed
wants to merge 10 commits into from
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Build
run: |
meson _build
meson _build -Dwerror=true
meson compile -C _build

- name: Run tests
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:

- name: Build
run: |
meson _build
meson _build -Dwerror=true
meson compile -C _build

- name: Run tests
Expand Down
4 changes: 2 additions & 2 deletions .woodpecker.yml
Expand Up @@ -4,7 +4,7 @@ pipeline:
commands:
- apt-get update
- apt-get install -y kyua atf-sh build-essential meson
- meson _build
- meson _build -Dwerror=true
- meson compile -C _build
- meson test -v -C _build
when:
Expand All @@ -30,7 +30,7 @@ pipeline:
image: alpine
commands:
- apk add -U --no-cache kyua atf build-base meson
- meson _build
- meson _build -Dwerror=true
- meson compile -C _build
- meson test -v -C _build
when:
Expand Down
41 changes: 24 additions & 17 deletions meson.build
@@ -1,27 +1,36 @@
project('pkgconf', 'c',
version : '1.8.0',
license : 'ISC',
meson_version : '>=0.47')

meson_version : '>=0.47',
default_options : ['c_std=c99'],
)

cc = meson.get_compiler('c')

add_project_arguments(
'-D_BSD_SOURCE',
'-D_DEFAULT_SOURCE',
cc.get_supported_arguments(
'-Wimplicit-function-declaration',
),
language : 'c',
)

cdata = configuration_data()

check_functions = [
['HAVE_STRLCAT', 'strlcat', 'string.h'],
['HAVE_STRLCPY', 'strlcpy', 'string.h'],
['HAVE_STRNDUP', 'strndup', 'string.h'],
['HAVE_STRDUP', 'strdup', 'string.h'],
['HAVE_STRNCASECMP', 'strncasecmp', 'strings.h'],
['HAVE_STRCASECMP', 'strcasecmp', 'strings.h'],
['HAVE_REALLOCARRAY', 'reallocarray', 'stdlib.h'],
['strlcat', 'string.h'],
['strlcpy', 'string.h'],
['strndup', 'string.h'],
['strdup', 'string.h'],
['strncasecmp', 'strings.h'],
['strcasecmp', 'strings.h'],
['reallocarray', 'stdlib.h'],
]

foreach f : check_functions
if cc.has_function(f.get(1), prefix : '#define _BSD_SOURCE\n#include <' + f.get(2) + '>') and cc.has_header_symbol(f.get(2), f.get(1), prefix : '#define _BSD_SOURCE')
cdata.set(f.get(0), 1)
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')
cdata.set('HAVE_@0@'.format(f[0].to_upper().underscorify()), 1)
endif
endforeach

Expand All @@ -42,8 +51,8 @@ cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
cdata.set('abs_top_srcdir', meson.source_root())
cdata.set('abs_top_builddir', meson.build_root())
cdata.set('abs_top_srcdir', meson.current_source_dir())
cdata.set('abs_top_builddir', meson.current_build_dir())


subdir('libpkgconf')
Expand Down Expand Up @@ -110,10 +119,8 @@ pkgconf_exe = executable('pkgconf',
if get_option('tests')
kyua_exe = find_program('kyua')
atf_sh_exe = find_program('atf-sh')
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile=' + join_paths(meson.build_root(), 'Kyuafile'), '--build-root=' + meson.build_root()])


configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
kyuafile = configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to match the : style with the rest of the files. Seem to be attached to the key elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style is all over the place here, and I'm inclined to leave it alone since all I did was assigned the output.

test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile', kyuafile, '--build-root', meson.current_build_dir()])
subdir('tests')
endif

Expand Down
4 changes: 2 additions & 2 deletions tests/meson.build
Expand Up @@ -18,6 +18,6 @@ tests = [

# yuck
foreach test : tests
configure_file(input: test + '.sh', output: test, copy: true)
run_command('chmod', '755', join_paths(meson.build_root(), 'tests', test))
test_file = configure_file(input: test + '.sh', output: test, copy: true)
run_command('chmod', '755', test_file, check : true)
endforeach