meson: Fix dependencies

Libraries build by gitg expose a number of includes in their public
headers belonging to different libraries. Therefore, these libraries
are indirect dependencies of the library to be built.

With this in mind, these indirect dependencies are also included
when a direct dependency is included, so there is no need to include
them again.

Dependency hierarchy has been fixed and duplicated dependencies
removed.

Created `pkg-config` files requirements have also been fixed.
This commit is contained in:
Iñigo Martínez 2018-10-05 07:32:30 +02:00 committed by Alberto Fanjul
parent 99fef67ee9
commit 8b09eb1892
9 changed files with 53 additions and 75 deletions

View file

@ -1,17 +1,24 @@
common_deps = [
gio_dep,
glib_dep,
]
sources = files(
'ide-doap.c',
'ide-doap-person.c',
)
deps = common_deps + [libxml_reader_dep]
libide = static_library(
'ide',
sources: sources,
include_directories: top_inc,
dependencies: libxml_dep,
dependencies: deps,
)
libide_dep = declare_dependency(
link_with: libide,
include_directories: include_directories('.'),
dependencies: valac.find_library('ide', dirs: meson.current_source_dir()),
dependencies: common_deps + [valac.find_library('ide', dirs: meson.current_source_dir())],
link_with: libide,
)

View file

@ -2,18 +2,18 @@ sources = files('xml-reader.c')
deps = [
gio_dep,
dependency('libxml-2.0', version: '>= 2.9.0'),
libxml_dep,
]
libxml = static_library(
libxml_reader = static_library(
'xml',
sources: sources,
include_directories: top_inc,
dependencies: deps,
)
libxml_dep = declare_dependency(
link_with: libxml,
libxml_reader_dep = declare_dependency(
include_directories: include_directories('.'),
dependencies: deps,
link_with: libxml_reader,
)

View file

@ -54,19 +54,12 @@ sources = gitg_sources + files(
deps = [
config_dep,
gee_dep,
gio_dep,
gitg_platform_support_dep,
glib_dep,
gtk_dep,
gobject_introspection_dep,
gtksourceview_dep,
libgit2_glib_dep,
libgitg_dep,
gtkspell_dep,
libgitg_ext_dep,
libpeas_dep,
m_dep,
dependency('gobject-introspection-1.0', version: '>= 0.10.1'),
dependency('gtkspell3-3.0'),
]
cflags = warn_flags + [

View file

@ -35,13 +35,6 @@ sources = files(
'gitg-ext-user-query.vala',
)
deps = [
gee_dep,
gtk_dep,
libgit2_glib_dep,
libgitg_dep,
]
cflags = warn_flags + [
'-DDATADIR="@0@"'.format(gitg_datadir),
'-DLIBDIR="@0@"'.format(gitg_libdir),
@ -53,7 +46,7 @@ libgitg_ext = shared_library(
version: libversion,
soversion: soversion,
include_directories: top_inc,
dependencies: deps,
dependencies: libgitg_dep,
c_args: cflags,
vala_header: lib_name + '.h',
vala_vapi: lib_api_name + '.vapi',
@ -69,9 +62,18 @@ libgitg_ext = shared_library(
],
)
deps = [
gee_dep,
gio_dep,
glib_dep,
gtk_dep,
libgit2_glib_dep,
]
libgitg_ext_dep = declare_dependency(
link_with: libgitg_ext,
include_directories: include_directories('.'),
dependencies: deps + [libgitg_dep],
link_with: libgitg_ext,
)
pkg.generate(
@ -81,17 +83,7 @@ pkg.generate(
description: gitg_name + ' extensions library',
filebase: lib_api_name,
subdirs: lib_api_name,
requires: [
'gio-2.0',
'glib-2.0',
'gmodule-2.0',
'gobject-2.0',
'gtk+-3.0',
'gthread-2.0',
'libgit2-glib-1.0',
'libgitg-1.0',
gio_system_pkg,
],
requires: deps + ['libgitg-1.0'],
variables: 'exec_prefix=' + gitg_prefix,
)

View file

@ -9,6 +9,14 @@ gir_api_name = '@0@-@1@'.format(gir_ns, gitg_gir_version)
gir_name = gir_api_name + '.gir'
gir_typelib = gir_api_name + '.typelib'
common_deps = [
gee_dep,
gio_dep,
glib_dep,
gtk_dep,
libgit2_glib_dep,
]
sources = files(
'gitg-assembly-info.vala',
'gitg-async.vala',
@ -84,18 +92,14 @@ sources += gnome.compile_resources(
dependencies: resource_data,
)
deps = [
gee_dep,
deps = common_deps + [
gitg_platform_support_dep,
glib_dep,
gtk_dep,
gsettings_desktop_schemas_dep,
gtksourceview_dep,
libgit2_glib_dep,
libide_dep,
libsecret_dep,
libsoup_dep,
m_dep,
dependency('gsettings-desktop-schemas'),
dependency('libsecret-1'),
]
cflags = warn_flags + [
@ -108,9 +112,8 @@ ldflags = common_ldflags
if gdk_targets.contains('quartz')
sources += files('gitg-platform-support-osx.c')
gio_system_pkg = 'gio-unix-2.0'
deps += [
dependency(gio_system_pkg),
dependency('gio-unix-2.0'),
find_library('objc'),
]
cflags += '-xobjective-c'
@ -121,12 +124,10 @@ if gdk_targets.contains('quartz')
])
elif gdk_targets.contains('win32')
sources += files('gitg-platform-support-win32.c')
gio_system_pkg = 'gio-windows-2.0'
deps += dependency(gio_system_pkg)
deps += dependency('gio-windows-2.0')
else
sources += files('gitg-platform-support.c')
gio_system_pkg = 'gio-unix-2.0'
deps += dependency(gio_system_pkg)
deps += dependency('gio-unix-2.0')
endif
libgitg = shared_library(
@ -152,10 +153,13 @@ libgitg = shared_library(
)
libgitg_dep = declare_dependency(
link_with: libgitg,
include_directories: include_directories('.'),
dependencies: common_deps + [m_dep],
link_with: libgitg,
)
# FIXME: libgitg_dep requires m_dep because math.h and float.h includes are exposed
# However, meson is not able to append it
pkg.generate(
libraries: libgitg,
version: gitg_version,
@ -163,16 +167,7 @@ pkg.generate(
description: gitg_name + ' library',
filebase: lib_api_name,
subdirs: lib_api_name,
requires: [
'gio-2.0',
'glib-2.0',
'gmodule-2.0',
'gobject-2.0',
'gthread-2.0',
'gtk+-3.0',
'libgit2-glib-1.0',
gio_system_pkg,
],
requires: common_deps,
variables: 'exec_prefix=' + gitg_prefix,
)

View file

@ -122,11 +122,16 @@ glib_req_version = '>= 2.38'
gee_dep = dependency('gee-0.8')
gio_dep = dependency('gio-2.0', version: glib_req_version)
glib_dep = dependency('glib-2.0', version: glib_req_version)
gobject_introspection_dep = dependency('gobject-introspection-1.0', version: '>= 0.10.1')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.20.0')
gtkspell_dep = dependency('gtkspell3-3.0')
gtksourceview_dep = dependency('gtksourceview-3.0', version: '>= 3.10')
libgit2_glib_dep = dependency('libgit2-glib-1.0', version: ['>= 0.25.0', '< 0.27.0'])
libpeas_dep = dependency('libpeas-1.0')
libsecret_dep = dependency('libsecret-1')
libsoup_dep = dependency('libsoup-2.4')
libxml_dep = dependency('libxml-2.0', version: '>= 2.9.0')
config_dep = valac.find_library('config', dirs: vapi_dir)
gitg_platform_support_dep = valac.find_library('gitg-platform-support', dirs: vapi_dir)

View file

@ -11,11 +11,7 @@ sources = gitg_sources + support_sources + files(
deps = [
config_dep,
gee_dep,
gitg_assert_dep,
gtk_dep,
libgit2_glib_dep,
libgitg_dep,
libgitg_ext_dep,
]

View file

@ -7,10 +7,7 @@ sources = support_sources + files(
)
deps = [
gee_dep,
gitg_assert_dep,
gtk_dep,
libgit2_glib_dep,
libgitg_dep,
]

View file

@ -2,13 +2,6 @@ subdir('support')
subdir('libgitg')
subdir('gitg')
deps = [
gee_dep,
gtk_dep,
libgit2_glib_dep,
libgitg_dep,
]
test_names = [
'diff-view',
'repository-list-box',
@ -20,7 +13,7 @@ foreach test_name: test_names
'tests-' + test_name,
sources: test_name + '.vala',
include_directories: top_inc,
dependencies: deps,
dependencies: libgitg_dep,
c_args: warn_flags,
)
endforeach