Skip to content
Snippets Groups Projects
Commit 09925ab2 authored by Simon McVittie's avatar Simon McVittie
Browse files

build: Split into subdirectories


Unlike Autotools, in Meson this doesn't have the problems caused by
recursive make: ninja always has an overview of the whole source tree.

With this change, test-locale-gen.sh needs minor adjustments, because
G_TEST_SRCDIR, G_TEST_BUILDDIR now point into tests/ instead of the
root directory of the source tree.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent b9df74dd
No related branches found
No related tags found
No related merge requests found
# Copyright © 2019-2020 Collabora Ltd.
#
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pandoc = find_program('pandoc', required : true)
if run_command(pandoc, [
'-f', 'markdown-smart',
'-t', 'man',
'/dev/null',
]).returncode() == 0
pandoc_markdown_nosmart = 'markdown-smart'
else
pandoc_markdown_nosmart = 'markdown'
endif
foreach tool : ['locale-gen', 'try-setlocale']
custom_target(
tool + '.1',
build_by_default : true,
command : [
pandoc,
'-s',
'-o', '@OUTPUT@',
'-f', pandoc_markdown_nosmart,
'-t', 'man',
'@INPUT@',
],
input : tool + '.1.md',
output : 'pressure-vessel-' + tool + '.1',
install : true,
install_dir : join_paths(
get_option('prefix'),
get_option('mandir'),
'man1',
),
)
endforeach
# vim:set sw=2 sts=2 et:
......@@ -153,36 +153,6 @@ scripts = [
'pressure-vessel-unruntime-test-ui',
]
tests = [
'cheap-copy.py',
'mypy.sh',
'pycodestyle.sh',
'pyflakes.sh',
'shellcheck.sh',
'test-locale-gen.sh',
]
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('PRESSURE_VESSEL_UNINSTALLED', 'yes')
foreach test_name : tests
test_args = ['-v', files('tests/' + test_name)]
if test_name.endswith('.py')
test_args += ['-e', python.path()]
endif
if prove.found()
test(
test_name, prove,
args : test_args,
env : test_env,
)
endif
endforeach
foreach script : scripts
install_data(
script,
......@@ -205,149 +175,10 @@ add_project_arguments(
language : 'c',
)
# Headers to scan for enum/flags types.
headers = [
'src/runtime.h',
]
enums = gnome.mkenums_simple(
'enumtypes',
sources : headers,
)
pressure_vessel_utils = static_library(
'pressure-vessel-utils',
sources : [
'src/bwrap-lock.c',
'src/bwrap-lock.h',
'src/flatpak-utils-base.c',
'src/flatpak-utils-base-private.h',
'src/flatpak-utils.c',
'src/flatpak-utils-private.h',
'src/glib-backports.c',
'src/glib-backports.h',
'src/utils.c',
'src/utils.h',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
include_directories : project_include_dirs,
install: false,
)
executable(
'pressure-vessel-with-lock',
sources : [
'src/with-lock.c',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
build_rpath : '${ORIGIN}/../' + get_option('libdir'),
install_rpath : '${ORIGIN}/../' + get_option('libdir'),
)
executable(
'pressure-vessel-wrap',
sources : [
'src/bwrap.c',
'src/bwrap.h',
'src/flatpak-bwrap.c',
'src/flatpak-bwrap-private.h',
'src/flatpak-run.c',
'src/flatpak-run-private.h',
'src/runtime.c',
'src/runtime.h',
'src/wrap.c',
'src/wrap-interactive.c',
'src/wrap-interactive.h',
] + enums,
dependencies : [
steam_runtime_tools,
gio_unix,
xau,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
build_rpath : '${ORIGIN}/../' + get_option('libdir'),
install_rpath : '${ORIGIN}/../' + get_option('libdir'),
)
executable(
'pressure-vessel-try-setlocale',
sources : [
'src/try-setlocale.c',
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
)
executable(
'test-cheap-copy',
sources : [
'tests/cheap-copy.c',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : false,
)
subdir('src')
if get_option('man')
pandoc = find_program('pandoc', required : true)
if run_command(pandoc, [
'-f', 'markdown-smart',
'-t', 'man',
'/dev/null',
]).returncode() == 0
pandoc_markdown_nosmart = 'markdown-smart'
else
pandoc_markdown_nosmart = 'markdown'
endif
foreach tool : ['locale-gen', 'try-setlocale']
custom_target(
tool + '.1',
build_by_default : true,
command : [
pandoc,
'-s',
'-o', '@OUTPUT@',
'-f', pandoc_markdown_nosmart,
'-t', 'man',
'@INPUT@',
],
input : join_paths('man', tool + '.1.md'),
output : 'pressure-vessel-' + tool + '.1',
install : true,
install_dir : join_paths(
get_option('prefix'),
get_option('mandir'),
'man1',
),
)
endforeach
subdir('man')
endif
if get_option('srcdir') != ''
......@@ -376,4 +207,6 @@ if get_option('srcdir') != ''
)
endif
subdir('tests')
# vim:set sw=2 sts=2 et:
# Copyright © 2019-2020 Collabora Ltd.
#
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Headers to scan for enum/flags types.
headers = [
'runtime.h',
]
enums = gnome.mkenums_simple(
'enumtypes',
sources : headers,
)
pressure_vessel_utils = static_library(
'pressure-vessel-utils',
sources : [
'bwrap-lock.c',
'bwrap-lock.h',
'flatpak-utils-base.c',
'flatpak-utils-base-private.h',
'flatpak-utils.c',
'flatpak-utils-private.h',
'glib-backports.c',
'glib-backports.h',
'utils.c',
'utils.h',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
include_directories : project_include_dirs,
install: false,
)
executable(
'pressure-vessel-with-lock',
sources : [
'with-lock.c',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
build_rpath : '${ORIGIN}/../' + get_option('libdir'),
install_rpath : '${ORIGIN}/../' + get_option('libdir'),
)
executable(
'pressure-vessel-wrap',
sources : [
'bwrap.c',
'bwrap.h',
'flatpak-bwrap.c',
'flatpak-bwrap-private.h',
'flatpak-run.c',
'flatpak-run-private.h',
'runtime.c',
'runtime.h',
'wrap.c',
'wrap-interactive.c',
'wrap-interactive.h',
] + enums,
dependencies : [
steam_runtime_tools,
gio_unix,
xau,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
build_rpath : '${ORIGIN}/../' + get_option('libdir'),
install_rpath : '${ORIGIN}/../' + get_option('libdir'),
)
executable(
'pressure-vessel-try-setlocale',
sources : [
'try-setlocale.c',
],
include_directories : project_include_dirs,
install : true,
install_dir : get_option('bindir'),
)
# vim:set sw=2 sts=2 et:
# Copyright © 2019-2020 Collabora Ltd.
#
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('PRESSURE_VESSEL_UNINSTALLED', 'yes')
tests = [
'cheap-copy.py',
'mypy.sh',
'pycodestyle.sh',
'pyflakes.sh',
'shellcheck.sh',
'test-locale-gen.sh',
]
foreach test_name : tests
test_args = ['-v', files(test_name)]
if test_name.endswith('.py')
test_args += ['-e', python.path()]
endif
if prove.found()
test(
test_name, prove,
args : test_args,
env : test_env,
)
endif
endforeach
executable(
'test-cheap-copy',
sources : [
'cheap-copy.c',
],
dependencies : [
gio_unix,
libglnx.get_variable('libglnx_dep'),
],
link_with : [
pressure_vessel_utils,
],
include_directories : project_include_dirs,
install : false,
)
# vim:set sw=2 sts=2 et:
......@@ -74,15 +74,15 @@ if ! tmpdir="$(mktemp -d)"; then
fi
if [ -z "${G_TEST_SRCDIR-}" ]; then
G_TEST_SRCDIR="${here%/*}"
G_TEST_SRCDIR="${here}"
fi
if [ -z "${G_TEST_BUILDDIR-}" ]; then
G_TEST_BUILDDIR="${here%/*}"
G_TEST_BUILDDIR="${here}"
fi
if [ -n "${PRESSURE_VESSEL_UNINSTALLED-}" ]; then
PATH="${G_TEST_BUILDDIR}:${G_TEST_SRCDIR}:${PATH}"
PATH="${G_TEST_BUILDDIR}/..:${G_TEST_SRCDIR}/..:${PATH}"
fi
locale_gen="pressure-vessel-locale-gen"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment