Skip to content

Commit

Permalink
build: Declare dependency chain between static libs in common
Browse files Browse the repository at this point in the history
In common/ there are sub-libraries namely libp11-common.a,
libp11-library.a, libp11-tool.a, and libp11-test.a.

All the latter 3 libs use the symbols from libp11-common.a, it would
make sense to declare a dependency against it.
  • Loading branch information
ueno committed Jun 19, 2019
1 parent eb5eb7a commit 787888e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
17 changes: 6 additions & 11 deletions common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ libp11_library = static_library('p11-library', 'library.c',
gnu_symbol_visibility: 'hidden',
include_directories: configinc)

libp11_library_dep = declare_dependency(include_directories: [configinc,
commoninc],
link_with: libp11_library,
dependencies: thread_deps)
libp11_library_dep = declare_dependency(link_with: libp11_library,
dependencies: [libp11_common_dep] + thread_deps)

libp11_test_sources = [
'mock.c',
Expand All @@ -41,10 +39,8 @@ libp11_test_sources = [

libp11_test = static_library('p11-test', libp11_test_sources,
include_directories: configinc)
libp11_test_dep = declare_dependency(include_directories: [configinc,
commoninc],
link_with: libp11_test,
dependencies: thread_deps)
libp11_test_dep = declare_dependency(link_with: libp11_test,
dependencies: [libp11_common_dep] + thread_deps)

libp11_tool_sources = [
'tool.c'
Expand All @@ -56,9 +52,8 @@ endif

libp11_tool = static_library('p11-tool', libp11_tool_sources,
include_directories: configinc)
libp11_tool_dep = declare_dependency(include_directories: [configinc,
commoninc],
link_with: libp11_tool)
libp11_tool_dep = declare_dependency(link_with: libp11_tool,
dependencies: [libp11_common_dep])

# Tests ----------------------------------------------------------------

Expand Down
22 changes: 10 additions & 12 deletions p11-kit/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ libp11_kit_internal_c_args = [

libp11_kit_internal = static_library('p11-kit-internal',
libp11_kit_internal_sources,
dependencies: [libp11_common_dep,
libp11_library_dep] + libffi_deps,
dependencies: [libp11_library_dep] + libffi_deps,
c_args: libp11_kit_internal_c_args,
implicit_include_directories: false,
gnu_symbol_visibility: 'hidden')
Expand Down Expand Up @@ -117,7 +116,7 @@ libp11_kit_testable = static_library('p11-kit-testable',
libp11_kit_sources,
c_args: libp11_kit_testable_c_args,
implicit_include_directories: false,
dependencies: [libp11_common_dep, libp11_library_dep] + libffi_deps + dlopen_deps)
dependencies: [libp11_library_dep] + libffi_deps + dlopen_deps)

p11_kit_sources = [
'lists.c',
Expand All @@ -127,30 +126,30 @@ p11_kit_sources = [
executable('p11-kit',
p11_kit_sources,
c_args: common_c_args,
dependencies: [libp11_tool_dep, libp11_common_dep] + libffi_deps + dlopen_deps,
dependencies: [libp11_tool_dep] + libffi_deps + dlopen_deps,
link_with: libp11_kit,
install: true)

executable('p11-kit-remote',
'remote.c',
c_args: common_c_args,
dependencies: [libp11_tool_dep, libp11_common_dep] + libffi_deps + dlopen_deps,
dependencies: [libp11_tool_dep] + libffi_deps + dlopen_deps,
link_with: libp11_kit,
install: true,
install_dir: prefix / privatedir)

executable('p11-kit-remote-testable',
'remote.c',
c_args: common_c_args,
dependencies: [libp11_tool_dep, libp11_common_dep] + libffi_deps + dlopen_deps,
dependencies: [libp11_tool_dep] + libffi_deps + dlopen_deps,
link_with: libp11_kit_testable)

executable('p11-kit-server',
'server.c',
c_args: common_c_args + [
'-DP11_KIT_REMOTE="p11-kit-remote"'
],
dependencies: [libp11_tool_dep, libp11_common_dep] + libsystemd_deps + libffi_deps + dlopen_deps,
dependencies: [libp11_tool_dep] + libsystemd_deps + libffi_deps + dlopen_deps,
implicit_include_directories: false,
link_with: libp11_kit,
install: true,
Expand All @@ -162,7 +161,7 @@ executable('p11-kit-server-testable',
'-DP11_KIT_REMOTE="p11-kit-remote-testable"'
],
implicit_include_directories: false,
dependencies: [libp11_tool_dep, libp11_common_dep] + libsystemd_deps + libffi_deps + dlopen_deps,
dependencies: [libp11_tool_dep] + libsystemd_deps + libffi_deps + dlopen_deps,
link_with: libp11_kit_testable)

# Check if compilation succeeds with CRYPTOKI_GNU=1
Expand Down Expand Up @@ -213,7 +212,7 @@ foreach name : p11_kit_tests
t = executable(name, '@0@.c'.format(name),
c_args: tests_c_args + libp11_kit_testable_c_args,
include_directories: [configinc, commoninc],
dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps,
dependencies: [libp11_test_dep] + libffi_deps + dlopen_deps,
link_with: libp11_kit_testable)
test(name, t)
endforeach
Expand All @@ -227,7 +226,7 @@ foreach name : p11_kit_progs
t = executable(name, '@0@.c'.format(name),
c_args: tests_c_args,
include_directories: [configinc, commoninc],
dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps,
dependencies: [libp11_test_dep] + libffi_deps + dlopen_deps,
link_with: libp11_kit_testable)
endforeach

Expand Down Expand Up @@ -264,8 +263,7 @@ foreach name, sources : mock_sources
shared_module(name,
sources,
name_prefix: '',
include_directories: [configinc, commoninc],
dependencies: [libp11_test_dep, libp11_common_dep])
dependencies: [libp11_test_dep])
endforeach

p11_kit_pc_variables = [
Expand Down
10 changes: 3 additions & 7 deletions trust/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ shared_module('p11-kit-trust',
'module-init.c',
name_prefix: '',
c_args: p11_kit_trust_c_args,
dependencies: [libp11_library_dep,
libp11_common_dep] + libtasn1_deps,
dependencies: [libp11_library_dep] + libtasn1_deps,
link_with: libtrust_data,
install: true,
install_dir: prefix / p11_module_path)
Expand Down Expand Up @@ -90,7 +89,6 @@ executable('trust',
c_args: common_c_args,
link_with: libtrust_data,
dependencies: [libp11_kit_dep,
libp11_common_dep,
libp11_tool_dep] + libffi_deps + dlopen_deps + libtasn1_deps,
install: true)

Expand Down Expand Up @@ -133,8 +131,7 @@ foreach name : trust_tests
c_args: common_c_args + tests_c_args + libtrust_testable_c_args,
dependencies: [libp11_kit_dep,
libp11_library_dep,
libp11_test_dep,
libp11_common_dep] + dlopen_deps,
libp11_test_dep] + dlopen_deps,
link_with: [libtrust_testable, libtrust_data, libtrust_test])
test(name, t)
endforeach
Expand All @@ -156,7 +153,6 @@ foreach name : trust_progs
c_args: tests_c_args,
dependencies: [libp11_kit_dep,
libp11_library_dep,
libp11_test_dep,
libp11_common_dep] + libffi_deps + dlopen_deps,
libp11_test_dep] + libffi_deps + dlopen_deps,
link_with: [libtrust_testable, libtrust_data, libtrust_test])
endforeach

0 comments on commit 787888e

Please sign in to comment.