Cleanup the build a bit

Makes the Meson build a little bit better and cleans up some of the
formatting.
This commit is contained in:
Tristan Partin
2022-05-25 14:07:02 -05:00
parent 37e9ca2e5f
commit 757d36ae8e
14 changed files with 136 additions and 177 deletions

View File

@ -1,24 +0,0 @@
#!/bin/sh
if [ -z $MESON_INSTALL_PREFIX ]; then
echo 'This is meant to be ran from Meson only!'
exit 1
fi
if [ -z $DESTDIR ]; then
echo 'Compiling GSchema'
glib-compile-schemas "$MESON_INSTALL_PREFIX/share/glib-2.0/schemas"
echo 'Updating mime database'
update-mime-database "$MESON_INSTALL_PREFIX/share/mime"
if [ -e "$MESON_INSTALL_PREFIX/bin/sysprof" ]; then
echo 'Updating icon cache'
gtk-update-icon-cache -qtf "$MESON_INSTALL_PREFIX/share/icons/hicolor"
echo 'Updating desktop database'
update-desktop-database -q "$MESON_INSTALL_PREFIX/share/applications"
fi
fi

View File

@ -1,5 +1,4 @@
if get_option('enable_gtk') and get_option('libsysprof')
if get_option('gtk') and get_option('libsysprof')
install_data('sysprof-mime.xml',
install_dir: join_paths(datadir, 'mime/packages')
)

View File

@ -1,7 +1,3 @@
if get_option('enable_examples')
app = executable('example-app', 'app.c',
dependencies: [dependency('glib-2.0'), libsysprof_capture_dep],
)
endif

View File

@ -1,7 +1,5 @@
if get_option('help')
find_program('itstool', required: true)
find_program('itstool')
gnome.yelp('sysprof',
sources: ['index.page', 'introduction.page', 'profiling.page', 'faq.page', 'legal.xml'],
)
endif
gnome.yelp('sysprof',
sources: ['index.page', 'introduction.page', 'profiling.page', 'faq.page', 'legal.xml'],
)

View File

@ -10,7 +10,7 @@ project('sysprof', 'c',
symbolic_version = '43.alpha0'
gnome = import('gnome')
gnome = import('gnome', required: get_option('gtk'))
pkgconfig = import('pkgconfig')
i18n = import('i18n')
@ -46,7 +46,6 @@ config_h.set('PACKAGE_TARNAME', 'PACKAGE_STRING')
config_h.set('PACKAGE', 'PACKAGE_NAME')
config_h.set('VERSION', 'PACKAGE_VERSION')
# Detect and set symbol visibility
if get_option('default_library') != 'static'
if host_machine.system() == 'windows'
@ -200,16 +199,26 @@ endif
subdir('src')
subdir('data')
subdir('examples')
subdir('help')
subdir('po')
if get_option('help')
subdir('help')
endif
if get_option('examples')
subdir('examples')
endif
configure_file(
input: 'config.h.meson',
output: 'config.h',
configuration: config_h
)
if get_option('enable_gtk')
meson.add_install_script('build-aux/meson/post_install.sh')
if get_option('gtk') and gnome.found()
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true
)
endif

View File

@ -1,7 +1,7 @@
# Optionally disable the GTK application in case you're building the
# sysprof-cli only for your platform. Might be useful in IoT or various
# server scenarios.
option('enable_gtk', type: 'boolean')
option('gtk', type: 'boolean')
# Disable libsysprof/ui (in situations you only want sysprof-capture)
option('libsysprof', type: 'boolean')
@ -10,7 +10,7 @@ option('libsysprof', type: 'boolean')
# You only really want to ignore this if you are running from a container
# and are talking to a host daemon. Also, if you're compiling for something
# other than Linux to allow viewing syscap files.
option('with_sysprofd', type: 'combo',
option('sysprofd', type: 'combo',
choices: ['host', 'bundled', 'none'],
value: 'bundled',
)
@ -35,12 +35,12 @@ option('libunwind', type: 'boolean')
# Optionally disable the tools (this is mostly only useful for building only
# libsysprof-capture as a subproject)
option('enable_tools', type: 'boolean')
option('tools', type: 'boolean')
# Optionally disable the tests (this is mostly only useful for building only
# libsysprof-capture as a subproject)
option('enable_tests', type: 'boolean')
option('tests', type: 'boolean')
# Optionally disable the examples (this is mostly only useful for building only
# libsysprof-capture as a subproject)
option('enable_examples', type: 'boolean')
option('examples', type: 'boolean')

View File

@ -2,5 +2,5 @@
i18n.gettext('sysprof-workaround', preset: 'glib', install: false)
if get_option('libsysprof')
i18n.gettext('sysprof', preset: 'glib')
i18n.gettext('sysprof', preset: 'glib')
endif

View File

@ -1,5 +1,3 @@
if get_option('enable_gtk') and get_option('libsysprof')
libsysprof_ui_public_sources = [
'sysprof-check.c',
'sysprof-display.c',
@ -135,5 +133,3 @@ pkgconfig.generate(
)
install_headers(libsysprof_ui_public_headers, subdir: sysprof_ui_header_subdir)
endif

View File

@ -1,5 +1,3 @@
if get_option('libsysprof')
libsysprof_c_args = [ '-DSYSPROF_COMPILATION' ]
libsysprof_public_sources = [
@ -195,5 +193,3 @@ pkgconfig.generate(
install_headers(libsysprof_public_headers, subdir: sysprof_header_subdir)
subdir('preload')
endif

View File

@ -8,7 +8,7 @@ sysprof_version_conf.set('MINOR_VERSION', sysprof_version[1])
sysprof_version_conf.set('MICRO_VERSION', sysprof_version[2])
sysprof_version_conf.set('VERSION', meson.project_version())
if get_option('with_sysprofd') == 'bundled' or get_option('libsysprof')
if get_option('sysprofd') == 'bundled' or get_option('libsysprof')
ipc_profiler_src = gnome.gdbus_codegen('ipc-profiler',
sources: 'org.gnome.Sysprof3.Profiler.xml',
interface_prefix: 'org.gnome.Sysprof3.',
@ -43,18 +43,26 @@ endif
ipc_include_dirs = include_directories('.')
stackstash_sources = files([
'stackstash.c',
])
stackstash_sources = files('stackstash.c')
helpers_sources = files([
'helpers.c',
])
helpers_sources = files('helpers.c')
subdir('libsysprof-capture')
subdir('sysprofd')
subdir('libsysprof')
subdir('libsysprof-ui')
subdir('sysprof')
subdir('tools')
subdir('tests')
if get_option('sysprofd') == 'bundled'
subdir('sysprofd')
endif
if get_option('libsysprof')
subdir('libsysprof')
endif
if get_option('gtk') and get_option('libsysprof')
subdir('libsysprof-ui')
endif
if get_option('gtk') and get_option('libsysprof')
subdir('sysprof')
endif
if get_option('tools')
subdir('tools')
endif
if get_option('tests')
subdir('tests')
endif

View File

@ -1,5 +1,3 @@
if get_option('enable_gtk') and get_option('libsysprof')
sysprof_sources = [
'egg-binding-group.c',
'sysprof.c',
@ -26,5 +24,3 @@ sysprof = executable('sysprof', sysprof_resources + sysprof_sources,
install_dir: get_option('bindir'),
install: true,
)
endif

View File

@ -1,5 +1,3 @@
if get_option('with_sysprofd') == 'bundled'
sysprofd_sources = [
'../libsysprof/sysprof-kallsyms.c',
'sysprofd.c',
@ -96,5 +94,3 @@ configure_file(
configuration: sysprofdconf,
install_dir: systemdunitdir,
)
endif

View File

@ -1,5 +1,3 @@
if get_option('enable_tests')
test_env = [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
@ -39,117 +37,112 @@ find_temp_allocs = executable('find-temp-allocs', 'find-temp-allocs.c',
dependencies: test_capture_deps,
)
test('test-capture', test_capture, env: test_env)
test('test-capture-cursor', test_capture_cursor, env: test_env)
test('test-mapped-ring-buffer', test_mapped_ring_buffer, env: test_env)
if get_option('libsysprof')
test_deps = [
libsysprof_static_dep,
]
test_addr_map = executable('test-addr-map', 'test-addr-map.c',
c_args: test_cflags,
dependencies: test_deps,
)
test_addr_decode = executable('test-addr-decode', 'test-addr-decode.c',
c_args: test_cflags,
dependencies: test_deps,
)
test_mountinfo = executable('test-mountinfo', 'test-mountinfo.c',
c_args: test_cflags,
dependencies: test_deps,
)
test_flatpak = executable('test-flatpak', 'test-flatpak.c',
c_args: test_cflags,
dependencies: test_deps,
)
test_resolvers = executable('test-resolvers', 'test-resolvers.c',
c_args: test_cflags,
dependencies: test_deps,
)
allocs_by_size = executable('allocs-by-size', 'allocs-by-size.c',
c_args: test_cflags,
dependencies: test_deps,
)
allocs_within_mark = executable('allocs-within-mark', 'allocs-within-mark.c',
c_args: test_cflags,
dependencies: test_deps,
)
cross_thread_frees = executable('cross-thread-frees', 'cross-thread-frees.c',
c_args: test_cflags,
dependencies: test_deps,
)
memory_stack_stash = executable('memory-stack-stash', 'memory-stack-stash.c',
c_args: test_cflags,
dependencies: test_deps,
)
read_build_id = executable('read-build-id', 'read-build-id.c',
c_args: test_cflags,
dependencies: test_deps,
)
show_page_usage = executable('show-page-usage', 'show-page-usage.c',
c_args: test_cflags,
dependencies: test_deps + [dependency('cairo')],
)
list_pid_maps = executable('list-all-maps', 'list-all-maps.c',
c_args: test_cflags,
dependencies: [libsysprof_static_dep],
include_directories: include_directories('..'),
)
list_maps = executable('list-maps', 'list-maps.c',
c_args: test_cflags,
dependencies: [libsysprof_static_dep],
include_directories: include_directories('..'),
)
if get_option('enable_gtk')
test_ui_deps = [
libsysprof_dep,
libsysprof_ui_dep,
dependency('gtk4', version: gtk_req_version),
dependency('pangoft2', required: false),
test_deps = [
libsysprof_static_dep,
]
test_model_filter = executable('test-model-filter', 'test-model-filter.c',
test_addr_map = executable('test-addr-map', 'test-addr-map.c',
c_args: test_cflags,
dependencies: test_ui_deps,
dependencies: test_deps,
)
test_process_model = executable('test-process-model', 'test-process-model.c',
test_addr_decode = executable('test-addr-decode', 'test-addr-decode.c',
c_args: test_cflags,
dependencies: test_ui_deps,
dependencies: test_deps,
)
test_zoom = executable('test-zoom',
['test-zoom.c', '../libsysprof-ui/sysprof-zoom-manager.c'],
test_mountinfo = executable('test-mountinfo', 'test-mountinfo.c',
c_args: test_cflags,
dependencies: test_ui_deps,
dependencies: test_deps,
)
test_capture_view = executable('test-capture-view', 'test-capture-view.c',
test_flatpak = executable('test-flatpak', 'test-flatpak.c',
c_args: test_cflags,
dependencies: test_ui_deps,
dependencies: test_deps,
)
test('test-model-filter', test_model_filter, env: test_env)
test('test-zoom', test_zoom, env: test_env)
test_resolvers = executable('test-resolvers', 'test-resolvers.c',
c_args: test_cflags,
dependencies: test_deps,
)
endif
endif
allocs_by_size = executable('allocs-by-size', 'allocs-by-size.c',
c_args: test_cflags,
dependencies: test_deps,
)
allocs_within_mark = executable('allocs-within-mark', 'allocs-within-mark.c',
c_args: test_cflags,
dependencies: test_deps,
)
cross_thread_frees = executable('cross-thread-frees', 'cross-thread-frees.c',
c_args: test_cflags,
dependencies: test_deps,
)
memory_stack_stash = executable('memory-stack-stash', 'memory-stack-stash.c',
c_args: test_cflags,
dependencies: test_deps,
)
read_build_id = executable('read-build-id', 'read-build-id.c',
c_args: test_cflags,
dependencies: test_deps,
)
show_page_usage = executable('show-page-usage', 'show-page-usage.c',
c_args: test_cflags,
dependencies: test_deps + [dependency('cairo')],
)
list_pid_maps = executable('list-all-maps', 'list-all-maps.c',
c_args: test_cflags,
dependencies: [libsysprof_static_dep],
include_directories: include_directories('..'),
)
list_maps = executable('list-maps', 'list-maps.c',
c_args: test_cflags,
dependencies: [libsysprof_static_dep],
include_directories: include_directories('..'),
)
if get_option('gtk')
test_ui_deps = [
libsysprof_dep,
libsysprof_ui_dep,
dependency('gtk4', version: gtk_req_version),
dependency('pangoft2', required: false),
]
test_model_filter = executable('test-model-filter', 'test-model-filter.c',
c_args: test_cflags,
dependencies: test_ui_deps,
)
test_process_model = executable('test-process-model', 'test-process-model.c',
c_args: test_cflags,
dependencies: test_ui_deps,
)
test_zoom = executable('test-zoom',
['test-zoom.c', '../libsysprof-ui/sysprof-zoom-manager.c'],
c_args: test_cflags,
dependencies: test_ui_deps,
)
test_capture_view = executable('test-capture-view', 'test-capture-view.c',
c_args: test_cflags,
dependencies: test_ui_deps,
)
test('test-model-filter', test_model_filter, env: test_env)
test('test-zoom', test_zoom, env: test_env)
endif
endif

View File

@ -1,5 +1,3 @@
if get_option('enable_tools')
tools_deps = [
dependency('glib-2.0'),
libsysprof_capture_dep,
@ -28,7 +26,7 @@ sysprof_dump = executable('sysprof-dump', 'sysprof-dump.c',
install: false,
)
if get_option('with_sysprofd') == 'bundled' or get_option('libsysprof')
if get_option('sysprofd') == 'bundled' or get_option('libsysprof')
sysprof_profiler_ctl = executable('sysprof-profiler-ctl',
[ 'sysprof-profiler-ctl.c', ipc_profiler_src ],
dependencies: [ tools_deps, dependency('gio-unix-2.0', version: glib_req_version) ],
@ -42,5 +40,3 @@ list_threads = executable('list-threads', ['list-threads.c'],
c_args: tools_cflags,
install: false,
)
endif