File: rmake.rs

package info (click to toggle)
rustc 1.89.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 906,624 kB
  • sloc: xml: 158,148; python: 34,888; javascript: 19,595; sh: 19,221; ansic: 13,046; cpp: 7,144; asm: 4,376; makefile: 692; lisp: 174; sql: 15
file content (49 lines) | stat: -rw-r--r-- 1,648 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//@ needs-target-std
//
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
// a specified name. This test checks that this modifier works as intended.
// This test is the same as native-link-modifier-linker, but with rlibs.
// See https://github.com/rust-lang/rust/issues/99425

use run_make_support::rustc;

fn main() {
    // Verbatim allows for the specification of a precise name
    // - in this case, the unconventional ".ext" extension.
    rustc()
        .input("upstream_native_dep.rs")
        .crate_type("staticlib")
        .output("upstream_some_strange_name.ext")
        .run();
    rustc()
        .input("rust_dep.rs")
        .crate_type("rlib")
        .arg("-lstatic:+verbatim=upstream_some_strange_name.ext")
        .run();

    // This section voluntarily avoids using static_lib_name helpers to be verbatim.
    // With verbatim, even these common library names are refused
    // - it wants upstream_native_dep without
    // any file extensions.
    rustc()
        .input("upstream_native_dep.rs")
        .crate_type("staticlib")
        .output("libupstream_native_dep.a")
        .run();
    rustc()
        .input("upstream_native_dep.rs")
        .crate_type("staticlib")
        .output("upstream_native_dep.a")
        .run();
    rustc()
        .input("upstream_native_dep.rs")
        .crate_type("staticlib")
        .output("upstream_native_dep.lib")
        .run();
    rustc()
        .input("rust_dep.rs")
        .crate_type("rlib")
        .arg("-lstatic:+verbatim=upstream_native_dep")
        .run_fail()
        .assert_stderr_contains("upstream_native_dep");
}