diff options
author | Alex Richardson <arichardson@FreeBSD.org> | 2024-02-05 17:51:11 -0800 |
---|---|---|
committer | Alex Richardson <arichardson@FreeBSD.org> | 2024-02-05 17:51:11 -0800 |
commit | 1112f1c4420727a730c021facadc1589626edcd3 (patch) | |
tree | 3770c34e2076344cb76b8cb04618462839cc95f0 | |
parent | 5fb6c9115501462f464fd27dd694da97968be6ae (diff) |
Allow cross-compiling after moving xgdmime to a meson subproject
It is not currently possible to build a meson subproject for the build
system. Since xdgmime is only used for the tests we can move this logic
into the build-tests conditional and disables building the tests when
cross-compiling. This workaround is not ideal but it's better than not
being able to cross-compile at all.
See https://github.com/mesonbuild/meson/issues/11121
-rw-r--r-- | meson.build | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/meson.build b/meson.build index 1f067a4..06de1f5 100644 --- a/meson.build +++ b/meson.build @@ -26,18 +26,6 @@ xmllint = find_program('xmllint') xmlto = find_program('xmlto', required: false) ############################################################################### -# Find xdgmime. It needs to be a native dependency (i.e. compiled for the build -# system rather than the host system) so we can run its programs as part of the -# shared-mime-info build. - -subproject('xdgmime') -xdgmime_dep = dependency('xdgmime', native: true) - -xdgmime_print_mime_data = find_program('print-mime-data') -xdgmime_test_mime_data = find_program('test-mime-data') -xdgmime_test_mime = find_program('test-mime') - -############################################################################### # Check if GCC needs -lstdc++fs (before 9.1) if not cxx.links(''' @@ -67,7 +55,24 @@ if get_option('build-tools') gio = dependency('gio-2.0', required: false) subdir('src') endif -if get_option('build-tests') + +build_tests = get_option('build-tests') +if meson.is_cross_build() + # It's currently impossible to use a native subproject when cross-compiling. + warning('Cannot cross-compile tests due to https://github.com/mesonbuild/meson/issues/11121') + build_tests = false +endif + +if build_tests + # Find xdgmime. It needs to be a native dependency (i.e. compiled for the + # build system rather than the host system) so we can run its programs as + # part of the shared-mime-info build. + subproject('xdgmime') + xdgmime_dep = dependency('xdgmime', native: true) + + xdgmime_print_mime_data = find_program('print-mime-data') + xdgmime_test_mime_data = find_program('test-mime-data') + xdgmime_test_mime = find_program('test-mime') subdir('tests') endif |