File tree 6 files changed +78
-1
lines changed
6 files changed +78
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ fn main() {
10
10
let const_extern_fn_cargo_feature =
11
11
env:: var ( "CARGO_FEATURE_CONST_EXTERN_FN" ) . is_ok ( ) ;
12
12
let libc_ci = env:: var ( "LIBC_CI" ) . is_ok ( ) ;
13
+ let target = env:: var ( "TARGET" ) . unwrap ( ) ;
13
14
14
15
if env:: var ( "CARGO_FEATURE_USE_STD" ) . is_ok ( ) {
15
16
println ! (
@@ -82,6 +83,12 @@ fn main() {
82
83
}
83
84
println ! ( "cargo:rustc-cfg=libc_const_extern_fn" ) ;
84
85
}
86
+
87
+ // For unknown reason, libiconv can't be linked by adding #[link(name = iconv)] to
88
+ // a macOS-specific struct, so we do the linking here.
89
+ if target. contains ( "-apple-" ) {
90
+ println ! ( "cargo:rustc-link-lib=iconv" ) ;
91
+ }
85
92
}
86
93
87
94
fn rustc_minor_nightly ( ) -> Option < ( u32 , bool ) > {
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ fn test_apple(target: &str) {
107
107
"fcntl.h" ,
108
108
"glob.h" ,
109
109
"grp.h" ,
110
+ "iconv.h" ,
110
111
"ifaddrs.h" ,
111
112
"langinfo.h" ,
112
113
"limits.h" ,
@@ -360,6 +361,7 @@ fn test_openbsd(target: &str) {
360
361
"pthread_np.h" ,
361
362
"sys/syscall.h" ,
362
363
"sys/shm.h" ,
364
+ "iconv.h" ,
363
365
}
364
366
365
367
cfg. skip_struct ( move |ty| {
@@ -558,6 +560,7 @@ fn test_redox(target: &str) {
558
560
"errno.h" ,
559
561
"fcntl.h" ,
560
562
"grp.h" ,
563
+ "iconv.h" ,
561
564
"limits.h" ,
562
565
"locale.h" ,
563
566
"netdb.h" ,
@@ -618,6 +621,7 @@ fn test_solarish(target: &str) {
618
621
"fcntl.h" ,
619
622
"glob.h" ,
620
623
"grp.h" ,
624
+ "iconv.h" ,
621
625
"ifaddrs.h" ,
622
626
"langinfo.h" ,
623
627
"limits.h" ,
@@ -893,6 +897,7 @@ fn test_netbsd(target: &str) {
893
897
"sys/event.h" ,
894
898
"sys/quota.h" ,
895
899
"sys/shm.h" ,
900
+ "iconv.h" ,
896
901
}
897
902
898
903
cfg. type_name ( move |ty, is_struct, is_union| {
@@ -1100,6 +1105,7 @@ fn test_dragonflybsd(target: &str) {
1100
1105
"utime.h" ,
1101
1106
"utmpx.h" ,
1102
1107
"wchar.h" ,
1108
+ "iconv.h" ,
1103
1109
}
1104
1110
1105
1111
cfg. type_name ( move |ty, is_struct, is_union| {
@@ -1329,6 +1335,7 @@ fn test_android(target: &str) {
1329
1335
"errno.h" ,
1330
1336
"fcntl.h" ,
1331
1337
"grp.h" ,
1338
+ "iconv.h" ,
1332
1339
"ifaddrs.h" ,
1333
1340
"limits.h" ,
1334
1341
"locale.h" ,
@@ -1381,8 +1388,8 @@ fn test_android(target: &str) {
1381
1388
"sys/syscall.h" ,
1382
1389
"sys/sysinfo.h" ,
1383
1390
"sys/time.h" ,
1384
- "sys/times.h" ,
1385
1391
"sys/timerfd.h" ,
1392
+ "sys/times.h" ,
1386
1393
"sys/types.h" ,
1387
1394
"sys/ucontext.h" ,
1388
1395
"sys/uio.h" ,
@@ -1609,6 +1616,7 @@ fn test_freebsd(target: &str) {
1609
1616
"fcntl.h" ,
1610
1617
"glob.h" ,
1611
1618
"grp.h" ,
1619
+ "iconv.h" ,
1612
1620
"ifaddrs.h" ,
1613
1621
"langinfo.h" ,
1614
1622
"libutil.h" ,
@@ -1915,6 +1923,7 @@ fn test_emscripten(target: &str) {
1915
1923
"fcntl.h" ,
1916
1924
"glob.h" ,
1917
1925
"grp.h" ,
1926
+ "iconv.h" ,
1918
1927
"ifaddrs.h" ,
1919
1928
"langinfo.h" ,
1920
1929
"limits.h" ,
@@ -2279,6 +2288,7 @@ fn test_linux(target: &str) {
2279
2288
"fcntl.h" ,
2280
2289
"glob.h" ,
2281
2290
"grp.h" ,
2291
+ "iconv.h" ,
2282
2292
"ifaddrs.h" ,
2283
2293
"langinfo.h" ,
2284
2294
"limits.h" ,
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ pub type sae_connid_t = u32;
37
37
38
38
pub type mach_port_t = :: c_uint ;
39
39
40
+ pub type iconv_t = * mut :: c_void ;
41
+
40
42
deprecated_mach ! {
41
43
pub type vm_prot_t = :: c_int;
42
44
pub type vm_size_t = :: uintptr_t;
@@ -3764,6 +3766,19 @@ extern "C" {
3764
3766
bufsize : :: c_int ,
3765
3767
flags : :: c_int ,
3766
3768
) -> :: c_int ;
3769
+
3770
+ pub fn iconv_open (
3771
+ tocode : * const :: c_char ,
3772
+ fromcode : * const :: c_char ,
3773
+ ) -> iconv_t ;
3774
+ pub fn iconv (
3775
+ cd : iconv_t ,
3776
+ inbuf : * mut * mut :: c_char ,
3777
+ inbytesleft : * mut :: size_t ,
3778
+ outbuf : * mut * mut :: c_char ,
3779
+ outbytesleft : * mut :: size_t ,
3780
+ ) -> :: size_t ;
3781
+ pub fn iconv_close ( cd : iconv_t ) -> :: c_int ;
3767
3782
}
3768
3783
3769
3784
cfg_if ! {
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ pub type Elf64_Sxword = i64;
32
32
pub type Elf64_Word = u32 ;
33
33
pub type Elf64_Xword = u64 ;
34
34
35
+ pub type iconv_t = * mut :: c_void ;
36
+
35
37
cfg_if ! {
36
38
if #[ cfg( target_pointer_width = "64" ) ] {
37
39
type Elf_Addr = Elf64_Addr ;
@@ -1593,6 +1595,19 @@ extern "C" {
1593
1595
> ,
1594
1596
data : * mut :: c_void ,
1595
1597
) -> :: c_int ;
1598
+
1599
+ pub fn iconv_open (
1600
+ tocode : * const :: c_char ,
1601
+ fromcode : * const :: c_char ,
1602
+ ) -> iconv_t ;
1603
+ pub fn iconv (
1604
+ cd : iconv_t ,
1605
+ inbuf : * mut * mut :: c_char ,
1606
+ inbytesleft : * mut :: size_t ,
1607
+ outbuf : * mut * mut :: c_char ,
1608
+ outbytesleft : * mut :: size_t ,
1609
+ ) -> :: size_t ;
1610
+ pub fn iconv_close ( cd : iconv_t ) -> :: c_int ;
1596
1611
}
1597
1612
1598
1613
#[ link( name = "rt" ) ]
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ pub type Elf64_Sxword = i64;
29
29
pub type Elf64_Word = u32 ;
30
30
pub type Elf64_Xword = u64 ;
31
31
32
+ pub type iconv_t = * mut :: c_void ;
33
+
32
34
cfg_if ! {
33
35
if #[ cfg( target_pointer_width = "64" ) ] {
34
36
type Elf_Addr = Elf64_Addr ;
@@ -2081,6 +2083,19 @@ extern "C" {
2081
2083
> ,
2082
2084
data : * mut :: c_void ,
2083
2085
) -> :: c_int ;
2086
+
2087
+ pub fn iconv_open (
2088
+ tocode : * const :: c_char ,
2089
+ fromcode : * const :: c_char ,
2090
+ ) -> iconv_t ;
2091
+ pub fn iconv (
2092
+ cd : iconv_t ,
2093
+ inbuf : * mut * mut :: c_char ,
2094
+ inbytesleft : * mut :: size_t ,
2095
+ outbuf : * mut * mut :: c_char ,
2096
+ outbytesleft : * mut :: size_t ,
2097
+ ) -> :: size_t ;
2098
+ pub fn iconv_close ( cd : iconv_t ) -> :: c_int ;
2084
2099
}
2085
2100
2086
2101
#[ link( name = "util" ) ]
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ pub type Elf64_Section = u16;
40
40
pub type canid_t = u32 ;
41
41
pub type can_err_mask_t = u32 ;
42
42
43
+ pub type iconv_t = * mut :: c_void ;
44
+
43
45
#[ cfg_attr( feature = "extra_traits" , derive( Debug ) ) ]
44
46
pub enum fpos64_t { } // FIXME: fill this out with a struct
45
47
impl :: Copy for fpos64_t { }
@@ -3576,6 +3578,19 @@ extern "C" {
3576
3578
) -> :: size_t ;
3577
3579
3578
3580
pub fn regfree ( preg : * mut :: regex_t ) ;
3581
+
3582
+ pub fn iconv_open (
3583
+ tocode : * const :: c_char ,
3584
+ fromcode : * const :: c_char ,
3585
+ ) -> iconv_t ;
3586
+ pub fn iconv (
3587
+ cd : iconv_t ,
3588
+ inbuf : * mut * mut :: c_char ,
3589
+ inbytesleft : * mut :: size_t ,
3590
+ outbuf : * mut * mut :: c_char ,
3591
+ outbytesleft : * mut :: size_t ,
3592
+ ) -> :: size_t ;
3593
+ pub fn iconv_close ( cd : iconv_t ) -> :: c_int ;
3579
3594
}
3580
3595
3581
3596
cfg_if ! {
You can’t perform that action at this time.
0 commit comments