Debian Codegraph @

test cases/rust/21 transitive dependencies/diamond/meson.build

raw
1 # Regression test for a diamond dependency graph:
2 # ┌►R1┐
3 # main-►R3─┤ ├─►C1
4 # └►R2┘
5 # Both libr1.rlib and libr2.rlib used to contain func.c.o. That was causing
6 # libr3.rlib to have duplicated func.c.o and then libmain.so failed to link:
7 # multiple definition of `c_func'.
8
9 libc1 = static_library('c1', 'func.c')
10 libr1 = static_library('r1', 'r1.rs', link_with: libc1)
11 libr2 = static_library('r2', 'r2.rs', link_with: libc1)
12 libr3 = static_library('r3', 'r3.rs',
13 link_with: [libr1, libr2],
14 rust_abi: 'c',
15 )
16 shared_library('main', 'main.c', link_whole: [libr3])
17
18 #Same dependency graph, but r1 and r2 use link_whole. c1 need not be
19 #included in r3.
20 libr1_whole = static_library('r1+whole', 'r1.rs', link_whole: libc1)
21 libr2_whole = static_library('r2+whole', 'r2.rs', link_whole: libc1)
22 libr3_whole = static_library('r3+whole', 'r3.rs',
23 link_with: [libr1_whole, libr2_whole],
24 rust_abi: 'c',
25 )
26 shared_library('main-whole', 'main.c', link_with: [libr3_whole])
27
28 # Same dependency graph, but r3 is now installed. Since c1, r1 and r2 are
29 # not installed, r3 must contain them.
30 libr3 = static_library('r3-installed', 'r3.rs',
31 link_with: [libr1, libr2],
32 rust_abi: 'c',
33 install: true,
34 )
35 shared_library('main-installed', 'main.c', link_with: [libr3])