From d1c4c4628196801348e3ce6dcaf24ea169e8af09 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 6 Nov 2018 17:50:24 -0200 Subject: [PATCH] build: Prefer dependencies instead of link_with Meson uses the 'dependencies' field to determine and parallelize build steps, but that isn't entirely true with 'link_with'; this might cause a race condition when generating header files while trying to build them. Fix that by only using 'dependencies' instead of 'link_with'. --- cogl/cogl-gles2/meson.build | 6 ++++-- cogl/cogl-pango/meson.build | 15 +++++++++++---- cogl/cogl-path/meson.build | 3 +-- cogl/tests/conform/meson.build | 4 ++-- cogl/tests/micro-perf/meson.build | 6 ++++-- cogl/tests/unit/meson.build | 8 ++++++-- src/meson.build | 6 ++++-- src/tests/meson.build | 4 +--- 8 files changed, 33 insertions(+), 19 deletions(-) diff --git a/cogl/cogl-gles2/meson.build b/cogl/cogl-gles2/meson.build index 60a745acf..de1733119 100644 --- a/cogl/cogl-gles2/meson.build +++ b/cogl/cogl-gles2/meson.build @@ -13,8 +13,10 @@ libmutter_cogl_gles2 = shared_library('mutter-cogl-gles2-' + libmutter_api_versi c_args: cogl_c_args, include_directories: [cogl_includepath, cogl_path_includepath], link_depends: 'libmutter-cogl-gles2.map', - dependencies: [cogl_deps], - link_with: libmutter_cogl, + dependencies: [ + cogl_deps, + libmutter_cogl_dep + ], install_rpath: pkglibdir, install_dir: pkglibdir, install: true, diff --git a/cogl/cogl-pango/meson.build b/cogl/cogl-pango/meson.build index 0019624d4..cf54d5e0e 100644 --- a/cogl/cogl-pango/meson.build +++ b/cogl/cogl-pango/meson.build @@ -18,6 +18,7 @@ cogl_pango_deps = [ cogl_deps, pango_dep, pangocairo_dep, + libmutter_cogl_dep, ] libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_version, @@ -25,13 +26,16 @@ libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_versi c_args: cogl_c_args, include_directories: [cogl_includepath, cogl_path_includepath], link_depends: 'libmutter-cogl-pango.map', - dependencies: cogl_pango_deps, - link_with: libmutter_cogl, + dependencies: [cogl_pango_deps], install_rpath: pkglibdir, install_dir: pkglibdir, install: true, ) +libmutter_cogl_pango_dep = declare_dependency( + link_with: libmutter_cogl_pango, +) + if have_introspection libmutter_cogl_pango_gir = gnome.generate_gir(libmutter_cogl_pango, sources: cogl_pango_public_headers, @@ -44,8 +48,11 @@ if have_introspection 'Pango-1.0', 'PangoCairo-1.0' ], - dependencies: [cogl_deps, pango_dep], - link_with: [libmutter_cogl, libmutter_cogl_pango], + dependencies: [ + cogl_deps, + pango_dep, + libmutter_cogl_pango_dep, + ], extra_args: [ '-UCOGL_COMPILATION', '-DG_LOG_DOMAIN=\"CoglPango\"', diff --git a/cogl/cogl-path/meson.build b/cogl/cogl-path/meson.build index f843d244f..7f8961418 100644 --- a/cogl/cogl-path/meson.build +++ b/cogl/cogl-path/meson.build @@ -54,8 +54,7 @@ libmutter_cogl_path = shared_library('mutter-cogl-path-' + libmutter_api_version c_args: cogl_c_args, include_directories: [cogl_includepath, cogl_path_includepath], link_depends: 'libmutter-cogl-path.map', - dependencies: [cogl_deps], - link_with: libmutter_cogl, + dependencies: [libmutter_cogl_dep, cogl_deps], install_rpath: pkglibdir, install_dir: pkglibdir, install: true, diff --git a/cogl/tests/conform/meson.build b/cogl/tests/conform/meson.build index 5e152c45e..efea698e7 100644 --- a/cogl/tests/conform/meson.build +++ b/cogl/tests/conform/meson.build @@ -80,10 +80,10 @@ libmutter_cogl_test_conformance = executable('test-conformance', include_directories: cogl_test_conformance_includes, dependencies: [ cogl_deps, + libmutter_cogl_dep, libmutter_cogl_path_dep, - libmutter_cogl_test_fixtures_dep + libmutter_cogl_test_fixtures_dep, ], - link_with: [libmutter_cogl], install: false, ) diff --git a/cogl/tests/micro-perf/meson.build b/cogl/tests/micro-perf/meson.build index d5fc356e7..0c94bf77f 100644 --- a/cogl/tests/micro-perf/meson.build +++ b/cogl/tests/micro-perf/meson.build @@ -9,7 +9,9 @@ cogl_test_journal = executable('test-journal', '-DTESTS_DATADIR="@0@"'.format(join_paths(cogl_srcdir, 'tests/data')), ], include_directories: cogl_includepath, - dependencies: cogl_deps, - link_with: [libmutter_cogl], + dependencies: [ + cogl_deps, + libmutter_cogl_dep, + ], install: false, ) diff --git a/cogl/tests/unit/meson.build b/cogl/tests/unit/meson.build index 85eb8bfb4..ca852fa25 100644 --- a/cogl/tests/unit/meson.build +++ b/cogl/tests/unit/meson.build @@ -15,8 +15,12 @@ libmutter_cogl_test_unit = executable('test-unit', '-DTESTS_DATADIR="@0@/tests/data"'.format(cogl_srcdir), ], include_directories: cogl_test_unit_includes, - dependencies: [cogl_deps, libmutter_cogl_test_fixtures_dep], - link_with: [libmutter_cogl, libmutter_cogl_path], + dependencies: [ + cogl_deps, + libmutter_cogl_dep, + libmutter_cogl_path_dep, + libmutter_cogl_test_fixtures_dep, + ], install: false, ) diff --git a/src/meson.build b/src/meson.build index 1e5a6ac6c..9925a949b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -782,8 +782,10 @@ if have_introspection libmutter_cogl_pango_gir[0], libmutter_clutter_gir[0], ], - dependencies: [mutter_deps], - link_with: [libmutter], + dependencies: [ + mutter_deps, + libmutter_dep, + ], extra_args: mutter_c_args + [ '-U_GNU_SOURCE', ], diff --git a/src/tests/meson.build b/src/tests/meson.build index dd3e96c33..90620ab4a 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -5,6 +5,7 @@ tests_c_args = mutter_c_args tests_deps = [ mutter_deps, + libmutter_dep, libmutter_cogl_dep, libmutter_clutter_dep, ] @@ -34,7 +35,6 @@ test_runner = executable('mutter-test-runner', ], include_directories: tests_includepath, c_args: tests_c_args, - link_with: [libmutter], dependencies: [tests_deps], install: false, ) @@ -61,7 +61,6 @@ unit_tests = executable('mutter-test-unit-tests', ], include_directories: tests_includepath, c_args: tests_c_args, - link_with: [libmutter], dependencies: [tests_deps], install: false, ) @@ -78,7 +77,6 @@ headless_start_test = executable('mutter-headless-start-test', ], include_directories: tests_includepath, c_args: tests_c_args, - link_with: [libmutter], dependencies: [tests_deps], install: false, )