build: Use internal dependencies

We cannot rely on any build order, except the one we specify ourselves.

St depends on various generated files; other targets depend on those
files existing, so they can be included. There is no direct relationship
between targets and files, unless we declare a dependency, using the
Meson declare_dependency() constructor — which allows us to replace the
various `link_with` directives with the more appropriate `dependencies`
one, and also allows us to specify sources that must exist by the time
we build those targets.
This commit is contained in:
Emmanuele Bassi 2017-08-10 23:30:42 +01:00
parent b0d21c3a37
commit 86995d724e
2 changed files with 10 additions and 5 deletions

View File

@ -101,6 +101,7 @@ libshell_menu_gir = gnome.generate_gir(libshell_menu,
install: true
)
libshell_menu_dep = declare_dependency(link_with: libshell_menu)
libshell_public_headers = [
'shell-app.h',
@ -209,16 +210,18 @@ libshell_no_gir_sources += dbus_generated
libshell = library('gnome-shell',
sources: libshell_gir_sources + libshell_no_gir_sources,
dependencies: gnome_shell_deps + [mutter_dep, m_dep],
dependencies: gnome_shell_deps + [libshell_menu_dep, libst_dep, mutter_dep, m_dep],
include_directories: [conf_inc, st_inc, include_directories('tray')],
c_args: gnome_shell_cflags,
link_with: [libshell_menu, libst, libtray],
link_with: [libtray],
link_args: rpath_link_args,
install_rpath: install_rpath,
install_dir: pkglibdir,
install: true
)
libshell_dep = declare_dependency(link_with: libshell)
libshell_gir_includes = [
'Clutter-@0@'.format(mutter_api_version),
'ClutterX11-@0@'.format(mutter_api_version),
@ -241,7 +244,6 @@ gnome.generate_gir(libshell,
nsversion: '0.1',
namespace: 'Shell',
includes: libshell_gir_includes,
link_with: [libshell_menu, libst],
extra_args: ['--quiet'],
install_dir_gir: pkgdatadir,
install_dir_typelib: pkglibdir,
@ -252,8 +254,7 @@ executable('gnome-shell', 'main.c',
c_args: gnome_shell_cflags + [
'-DMUTTER_TYPELIB_DIR="@0@"'.format(mutter_typelibdir)
],
dependencies: gnome_shell_deps + [mutter_dep],
link_with: libshell,
dependencies: gnome_shell_deps + [libshell_dep, mutter_dep],
include_directories: [conf_inc, st_inc, include_directories('tray')],
link_args: rpath_link_args,
install_rpath: install_rpath,

View File

@ -127,6 +127,10 @@ libst = shared_library('st-1.0',
install: true
)
libst_dep = declare_dependency(link_with: libst,
sources: st_built_sources
)
test_theme = executable('test-theme',
sources: 'test-theme.c',
c_args: st_cflags,