diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2023-11-13 14:31:21 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-11-13 23:17:14 +0200 |
commit | 2da53e943ad9d44c4416ec4cca8ef549bf40d7b3 (patch) | |
tree | a1490b9f7ae053d524606d5a0ad66cabfa670619 /test cases | |
parent | 0bc01e87d9a82c59ae77ba62a9b3fe26922afee8 (diff) | |
download | meson-2da53e943ad9d44c4416ec4cca8ef549bf40d7b3.zip meson-2da53e943ad9d44c4416ec4cca8ef549bf40d7b3.tar.gz meson-2da53e943ad9d44c4416ec4cca8ef549bf40d7b3.tar.bz2 |
rust: Add transitive dependencies to ninja rules
In the case r1 -> s1 -> s2 where s1 and s2 are uninstalled C static
libraries, the libs1.a rule does not depend on libs2.a. That means that
r1 rule must depend on both s1 and s2.
Diffstat (limited to 'test cases')
4 files changed, 29 insertions, 0 deletions
diff --git a/test cases/rust/21 transitive dependencies/app.rs b/test cases/rust/21 transitive dependencies/app.rs new file mode 100644 index 0000000..a9802b3 --- /dev/null +++ b/test cases/rust/21 transitive dependencies/app.rs @@ -0,0 +1,9 @@ +extern "C" { + fn static2() -> i32; +} + +fn main() { + unsafe { + static2(); + } +} diff --git a/test cases/rust/21 transitive dependencies/meson.build b/test cases/rust/21 transitive dependencies/meson.build index b786e64..37687fd 100644 --- a/test cases/rust/21 transitive dependencies/meson.build +++ b/test cases/rust/21 transitive dependencies/meson.build @@ -27,3 +27,11 @@ exe = executable('footest', 'foo.c', test('footest', exe) subdir('diamond') + +# The ninja rule for libstatic2.a does not depend on libstatic1.a because it +# only need static2.c.o to create the archive. That means that the ninja rule +# for app must depend on both, otherwise libstatic1.a won't be built and linking +# will fail. +static1 = static_library('static1', 'static1.c', build_by_default: false) +static2 = static_library('static2', 'static2.c', link_with: static1) +exe = executable('app', 'app.rs', link_with: static2) diff --git a/test cases/rust/21 transitive dependencies/static1.c b/test cases/rust/21 transitive dependencies/static1.c new file mode 100644 index 0000000..104618a --- /dev/null +++ b/test cases/rust/21 transitive dependencies/static1.c @@ -0,0 +1,5 @@ +int static1(void); + +int static1(void){ + return 1; +} diff --git a/test cases/rust/21 transitive dependencies/static2.c b/test cases/rust/21 transitive dependencies/static2.c new file mode 100644 index 0000000..6877c04 --- /dev/null +++ b/test cases/rust/21 transitive dependencies/static2.c @@ -0,0 +1,7 @@ +int static1(void); +int static2(void); + +int static2(void) +{ + return 1 + static1(); +} |