Skip to content

Commit eff48c9

Browse files
committed
cdylib: apply versioning to symbols
1 parent ca81aa4 commit eff48c9

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

libz-rs-sys-cdylib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rust-version = "1.75" # MSRV
1212

1313
[lib]
1414
name = "z_rs" # turns into e.g. `libz_rs.so`
15-
crate-type = ["cdylib", "lib"]
15+
crate-type = ["cdylib", "staticlib", "lib"]
1616

1717
[profile.dev]
1818
panic = "abort" # abort on panics. This is crucial, unwinding would cause UB!

libz-rs-sys-cdylib/build.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::{env, path::PathBuf};
2+
3+
fn main() {
4+
let os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
5+
match os.as_str() {
6+
"linux" | "android" => { /* fall through */ }
7+
_ => return,
8+
};
9+
10+
let map = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("zlib.map");
11+
12+
println!("cargo:rerun-if-changed={}", map.display());
13+
14+
println!(
15+
"cargo:rustc-link-arg=-Wl,--version-script={}",
16+
map.display()
17+
);
18+
19+
println!("cargo:rustc-link-arg=-Wl,--undefined-version");
20+
}

libz-rs-sys-cdylib/zlib.map

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
ZLIB_1.2.0 {
2+
global:
3+
compressBound;
4+
deflateBound;
5+
inflateBack;
6+
inflateBackEnd;
7+
inflateBackInit_;
8+
inflateCopy;
9+
local:
10+
deflate_copyright;
11+
inflate_copyright;
12+
zcalloc;
13+
zcfree;
14+
z_errmsg;
15+
gz_error;
16+
gz_intmax;
17+
_*;
18+
};
19+
20+
ZLIB_1.2.0.2 {
21+
gzclearerr;
22+
gzungetc;
23+
zlibCompileFlags;
24+
} ZLIB_1.2.0;
25+
26+
ZLIB_1.2.0.8 {
27+
deflatePrime;
28+
} ZLIB_1.2.0.2;
29+
30+
ZLIB_1.2.2 {
31+
adler32_combine;
32+
crc32_combine;
33+
deflateSetHeader;
34+
inflateGetHeader;
35+
} ZLIB_1.2.0.8;
36+
37+
ZLIB_1.2.2.3 {
38+
deflateTune;
39+
gzdirect;
40+
} ZLIB_1.2.2;
41+
42+
ZLIB_1.2.2.4 {
43+
inflatePrime;
44+
} ZLIB_1.2.2.3;
45+
46+
ZLIB_1.2.3.3 {
47+
adler32_combine64;
48+
crc32_combine64;
49+
gzopen64;
50+
gzseek64;
51+
gztell64;
52+
inflateUndermine;
53+
} ZLIB_1.2.2.4;
54+
55+
ZLIB_1.2.3.4 {
56+
inflateReset2;
57+
inflateMark;
58+
} ZLIB_1.2.3.3;
59+
60+
ZLIB_1.2.3.5 {
61+
gzbuffer;
62+
gzoffset;
63+
gzoffset64;
64+
gzclose_r;
65+
gzclose_w;
66+
} ZLIB_1.2.3.4;
67+
68+
ZLIB_1.2.5.1 {
69+
deflatePending;
70+
} ZLIB_1.2.3.5;
71+
72+
ZLIB_1.2.5.2 {
73+
deflateResetKeep;
74+
gzgetc_;
75+
inflateResetKeep;
76+
} ZLIB_1.2.5.1;
77+
78+
ZLIB_1.2.7.1 {
79+
inflateGetDictionary;
80+
gzvprintf;
81+
} ZLIB_1.2.5.2;
82+
83+
ZLIB_1.2.9 {
84+
inflateCodesUsed;
85+
inflateValidate;
86+
uncompress2;
87+
gzfread;
88+
gzfwrite;
89+
deflateGetDictionary;
90+
adler32_z;
91+
crc32_z;
92+
} ZLIB_1.2.7.1;
93+
94+
ZLIB_1.2.12 {
95+
crc32_combine_gen;
96+
crc32_combine_gen64;
97+
crc32_combine_op;
98+
} ZLIB_1.2.9;

0 commit comments

Comments
 (0)