blob: 9959821a981b1a923b737ee8d86a0a4910a94c1f [file] [log] [blame]
Alex Crichtonb5da7c02015-09-16 17:44:40 -07001#![deny(warnings)]
2
Alex Crichtond11e9142015-09-15 23:28:52 -07003extern crate ctest;
Alex Crichton8e5f0cd2015-09-09 22:46:19 -07004
5use std::env;
Alex Crichton8e5f0cd2015-09-09 22:46:19 -07006
Alex Crichtond11e9142015-09-15 23:28:52 -07007fn main() {
8 let target = env::var("TARGET").unwrap();
Alex Crichton8dce9ad2015-12-03 11:44:14 -08009 let x86_64 = target.contains("x86_64");
Alex Crichtond11e9142015-09-15 23:28:52 -070010 let windows = target.contains("windows");
11 let mingw = target.contains("windows-gnu");
Alex Crichtoncd9b33e2015-09-17 14:47:40 -070012 let linux = target.contains("unknown-linux");
Alex Crichton1ff96102015-09-17 15:09:02 -070013 let android = target.contains("android");
Alex Crichtonbaef6112015-09-19 23:20:53 -070014 let apple = target.contains("apple");
Alex Crichton15b83c22015-09-17 17:25:52 -070015 let musl = target.contains("musl");
Alex Crichtona1b948e2015-09-18 11:54:32 -070016 let freebsd = target.contains("freebsd");
Alexander Polakov26974c72015-11-27 03:02:44 +030017 let mips = target.contains("mips");
Alex Crichton49d7bca2015-11-27 09:40:37 -080018 let netbsd = target.contains("netbsd");
Sébastien Mariec618f362015-12-21 17:26:41 +010019 let openbsd = target.contains("openbsd");
Alex Crichton49d7bca2015-11-27 09:40:37 -080020 let rumprun = target.contains("rumprun");
Sébastien Mariec618f362015-12-21 17:26:41 +010021 let bsdlike = freebsd || apple || netbsd || openbsd;
Alex Crichtond11e9142015-09-15 23:28:52 -070022 let mut cfg = ctest::TestGenerator::new();
Alex Crichton8e5f0cd2015-09-09 22:46:19 -070023
Alex Crichtond11e9142015-09-15 23:28:52 -070024 // Pull in extra goodies on linux/mingw
Alex Crichton8dce9ad2015-12-03 11:44:14 -080025 if linux || android {
Alex Crichtond11e9142015-09-15 23:28:52 -070026 cfg.define("_GNU_SOURCE", None);
Alex Crichton1ff96102015-09-17 15:09:02 -070027 } else if windows {
Alex Crichtond11e9142015-09-15 23:28:52 -070028 cfg.define("_WIN32_WINNT", Some("0x8000"));
Alex Crichton0df7c102015-09-10 16:35:37 -070029 }
30
Alex Crichton094f44d2015-09-16 16:27:23 -070031 // Android doesn't actually have in_port_t but it's much easier if we
32 // provide one for us to test against
Alex Crichton1ff96102015-09-17 15:09:02 -070033 if android {
Alex Crichton094f44d2015-09-16 16:27:23 -070034 cfg.define("in_port_t", Some("uint16_t"));
35 }
36
Alex Crichtond11e9142015-09-15 23:28:52 -070037 cfg.header("errno.h")
38 .header("fcntl.h")
39 .header("limits.h")
40 .header("stddef.h")
41 .header("stdint.h")
42 .header("stdio.h")
43 .header("stdlib.h")
44 .header("sys/stat.h")
45 .header("sys/types.h")
46 .header("time.h")
47 .header("wchar.h");
Alex Crichtonac2bd852015-09-10 17:21:20 -070048
Alex Crichton1ff96102015-09-17 15:09:02 -070049 if windows {
Alex Crichtond11e9142015-09-15 23:28:52 -070050 cfg.header("winsock2.h"); // must be before windows.h
51
52 cfg.header("direct.h");
53 cfg.header("io.h");
54 cfg.header("sys/utime.h");
55 cfg.header("windows.h");
56 cfg.header("process.h");
57 cfg.header("ws2ipdef.h");
58
59 if target.contains("gnu") {
60 cfg.header("ws2tcpip.h");
Alex Crichton310d6232015-09-10 10:56:31 -070061 }
Alex Crichtond11e9142015-09-15 23:28:52 -070062 } else {
63 cfg.header("ctype.h");
64 cfg.header("dirent.h");
Sébastien Mariec618f362015-12-21 17:26:41 +010065 if openbsd {
66 cfg.header("sys/socket.h");
67 }
Alex Crichtond11e9142015-09-15 23:28:52 -070068 cfg.header("net/if.h");
69 cfg.header("netdb.h");
70 cfg.header("netinet/in.h");
71 cfg.header("netinet/ip.h");
72 cfg.header("netinet/tcp.h");
73 cfg.header("pthread.h");
Alex Crichton1ff96102015-09-17 15:09:02 -070074 cfg.header("dlfcn.h");
Alex Crichtond11e9142015-09-15 23:28:52 -070075 cfg.header("signal.h");
76 cfg.header("string.h");
77 cfg.header("sys/file.h");
78 cfg.header("sys/ioctl.h");
79 cfg.header("sys/mman.h");
80 cfg.header("sys/resource.h");
81 cfg.header("sys/socket.h");
82 cfg.header("sys/time.h");
83 cfg.header("sys/un.h");
84 cfg.header("sys/wait.h");
85 cfg.header("unistd.h");
86 cfg.header("utime.h");
Alex Crichtoncd9b33e2015-09-17 14:47:40 -070087 cfg.header("pwd.h");
88 cfg.header("grp.h");
Alex Crichton8dce9ad2015-12-03 11:44:14 -080089 cfg.header("sys/utsname.h");
90 cfg.header("sys/ptrace.h");
91 cfg.header("sys/mount.h");
92 cfg.header("sys/uio.h");
93 cfg.header("sched.h");
94 cfg.header("termios.h");
Alex Crichtoncd9b33e2015-09-17 14:47:40 -070095 }
Alex Crichtona1b948e2015-09-18 11:54:32 -070096
97 if android {
98 cfg.header("arpa/inet.h");
Alex Crichton568705e2015-11-03 14:18:52 -080099 cfg.header("time64.h");
Alex Crichtona1b948e2015-09-18 11:54:32 -0700100 } else if !windows {
101 cfg.header("glob.h");
102 cfg.header("ifaddrs.h");
Sébastien Mariec618f362015-12-21 17:26:41 +0100103 if !openbsd {
104 cfg.header("sys/quota.h");
105 }
Dan Burkert85a76f82015-11-04 20:26:27 -0800106 cfg.header("sys/statvfs.h");
Alex Crichtona1b948e2015-09-18 11:54:32 -0700107
108 if !musl {
Alex Crichtona1b948e2015-09-18 11:54:32 -0700109 cfg.header("sys/sysctl.h");
Alex Crichton49d7bca2015-11-27 09:40:37 -0800110
Sébastien Mariec618f362015-12-21 17:26:41 +0100111 if !netbsd && !openbsd {
Alex Crichton49d7bca2015-11-27 09:40:37 -0800112 cfg.header("execinfo.h");
113 }
Alex Crichtona1b948e2015-09-18 11:54:32 -0700114 }
115 }
116
Alex Crichtonbaef6112015-09-19 23:20:53 -0700117 if apple {
Alex Crichtona1b948e2015-09-18 11:54:32 -0700118 cfg.header("mach-o/dyld.h");
119 cfg.header("mach/mach_time.h");
120 cfg.header("malloc/malloc.h");
Alex Crichtonbaef6112015-09-19 23:20:53 -0700121 if target.starts_with("x86") {
122 cfg.header("crt_externs.h");
123 }
Alex Crichtona1b948e2015-09-18 11:54:32 -0700124 }
125
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800126 if bsdlike {
127 cfg.header("sys/event.h");
128 }
129
Alexander Polakov30baed02015-12-01 15:29:05 +0300130 if linux {
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800131 cfg.header("mqueue.h");
132 cfg.header("sys/signalfd.h");
Alexander Polakov30baed02015-12-01 15:29:05 +0300133 cfg.header("sys/xattr.h");
Alexander Polakov58501562015-12-14 02:09:45 +0300134 cfg.header("sys/ipc.h");
135 cfg.header("sys/shm.h");
Alexander Polakov30baed02015-12-01 15:29:05 +0300136 }
137
Alex Crichtona1b948e2015-09-18 11:54:32 -0700138 if linux || android {
Alex Crichtona1b948e2015-09-18 11:54:32 -0700139 cfg.header("malloc.h");
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800140 cfg.header("net/ethernet.h");
141 cfg.header("netpacket/packet.h");
142 cfg.header("sched.h");
143 cfg.header("sys/epoll.h");
144 cfg.header("sys/eventfd.h");
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700145 cfg.header("sys/prctl.h");
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800146 cfg.header("sys/vfs.h");
Alex Crichton881ef9b2015-12-01 09:04:13 -0800147 cfg.header("sys/syscall.h");
Alexander Polakov420f2e42015-11-11 01:53:39 +0300148 if !musl {
149 cfg.header("linux/netlink.h");
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800150 cfg.header("linux/magic.h");
151 cfg.header("linux/fs.h");
152
153 if !mips {
154 cfg.header("linux/quota.h");
155 }
Alexander Polakov420f2e42015-11-11 01:53:39 +0300156 }
Alex Crichton310d6232015-09-10 10:56:31 -0700157 }
158
Alex Crichtona1b948e2015-09-18 11:54:32 -0700159 if freebsd {
160 cfg.header("pthread_np.h");
Alexander Polakov26974c72015-11-27 03:02:44 +0300161 cfg.header("sched.h");
Alex Crichtona1b948e2015-09-18 11:54:32 -0700162 }
163
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800164 if netbsd {
165 cfg.header("ufs/ufs/quota.h");
166 cfg.header("ufs/ufs/quota1.h");
167 cfg.header("sys/ioctl_compat.h");
168 }
169
Sébastien Mariec618f362015-12-21 17:26:41 +0100170 if openbsd {
171 cfg.header("ufs/ufs/quota.h");
172 cfg.header("rpcsvc/rex.h");
173 cfg.header("pthread_np.h");
174 cfg.header("sys/syscall.h");
175 }
176
Alex Crichtond11e9142015-09-15 23:28:52 -0700177 cfg.type_name(move |ty, is_struct| {
Alex Crichton310d6232015-09-10 10:56:31 -0700178 match ty {
Alex Crichton31504842015-09-10 23:43:41 -0700179 // Just pass all these through, no need for a "struct" prefix
Alex Crichton22378822015-09-10 19:59:23 -0700180 "FILE" |
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700181 "fd_set" |
Alex Crichton88d23e72015-11-02 17:03:19 -0800182 "Dl_info" |
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700183 "DIR" => ty.to_string(),
184
185 // Fixup a few types on windows that don't actually exist.
186 "time64_t" if windows => "__time64_t".to_string(),
187 "ssize_t" if windows => "SSIZE_T".to_string(),
188
Alex Crichtonde9736d2015-09-17 15:47:44 -0700189 // OSX calls this something else
Alex Crichtona1b948e2015-09-18 11:54:32 -0700190 "sighandler_t" if bsdlike => "sig_t".to_string(),
Alex Crichtonde9736d2015-09-17 15:47:44 -0700191
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700192 t if t.ends_with("_t") => t.to_string(),
Alex Crichton310d6232015-09-10 10:56:31 -0700193
Alex Crichton31504842015-09-10 23:43:41 -0700194 // Windows uppercase structs don't have `struct` in front, there's a
195 // few special cases for windows, and then otherwise put `struct` in
196 // front of everything.
Alex Crichtond11e9142015-09-15 23:28:52 -0700197 t if is_struct => {
Alex Crichton13a6f2d2015-09-10 18:10:58 -0700198 if windows && ty.chars().next().unwrap().is_uppercase() {
199 t.to_string()
200 } else if windows && t == "stat" {
201 "struct __stat64".to_string()
Alex Crichton7da9b102015-09-10 20:57:14 -0700202 } else if windows && t == "utimbuf" {
203 "struct __utimbuf64".to_string()
Alex Crichton13a6f2d2015-09-10 18:10:58 -0700204 } else {
205 format!("struct {}", t)
206 }
207 }
Alex Crichton310d6232015-09-10 10:56:31 -0700208
209 t => t.to_string(),
210 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700211 });
Alex Crichton310d6232015-09-10 10:56:31 -0700212
Alex Crichtond11e9142015-09-15 23:28:52 -0700213 let target2 = target.clone();
214 cfg.field_name(move |struct_, field| {
Alex Crichton310d6232015-09-10 10:56:31 -0700215 match field {
Sébastien Marie6c8a63a2015-12-23 18:54:25 +0100216 "st_birthtime" if openbsd && struct_ == "stat" => "__st_birthtime".to_string(),
Sébastien Mariec618f362015-12-21 17:26:41 +0100217 "st_birthtime_nsec" if openbsd && struct_ == "stat" => "__st_birthtimensec".to_string(),
Alex Crichton31504842015-09-10 23:43:41 -0700218 // Our stat *_nsec fields normally don't actually exist but are part
219 // of a timeval struct
Alex Crichton74825222015-10-29 17:36:55 -0700220 s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
Alex Crichtonbaef6112015-09-19 23:20:53 -0700221 if target2.contains("apple") {
Alex Crichton310d6232015-09-10 10:56:31 -0700222 s.replace("_nsec", "spec.tv_nsec")
Alex Crichtond11e9142015-09-15 23:28:52 -0700223 } else if target2.contains("android") {
Alex Crichtond3d77922015-09-11 17:03:39 -0700224 s.to_string()
Alex Crichton310d6232015-09-10 10:56:31 -0700225 } else {
226 s.replace("e_nsec", ".tv_nsec")
227 }
228 }
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800229 "u64" if struct_ == "epoll_event" => "data.u64".to_string(),
Alex Crichton310d6232015-09-10 10:56:31 -0700230 s => s.to_string(),
231 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700232 });
Alex Crichton310d6232015-09-10 10:56:31 -0700233
Alex Crichtond11e9142015-09-15 23:28:52 -0700234 cfg.skip_type(move |ty| {
Alex Crichton310d6232015-09-10 10:56:31 -0700235 match ty {
Alex Crichtond3d77922015-09-11 17:03:39 -0700236 // sighandler_t is crazy across platforms
Alex Crichtond11e9142015-09-15 23:28:52 -0700237 "sighandler_t" => true,
Alex Crichtond3d77922015-09-11 17:03:39 -0700238
Alex Crichtond11e9142015-09-15 23:28:52 -0700239 _ => false
Alex Crichton310d6232015-09-10 10:56:31 -0700240 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700241 });
Alex Crichton16083062015-09-09 22:59:24 -0700242
Alexander Polakov420f2e42015-11-11 01:53:39 +0300243 cfg.skip_struct(move |ty| {
244 match ty {
245 "sockaddr_nl" => musl,
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800246
247 // The alignment of this is 4 on 64-bit OSX...
248 "kevent" if apple && x86_64 => true,
249
Alexander Polakov420f2e42015-11-11 01:53:39 +0300250 _ => false
251 }
252 });
253
Alex Crichtond11e9142015-09-15 23:28:52 -0700254 cfg.skip_signededness(|c| {
Alex Crichton6d3cfdb2015-09-15 14:53:01 -0700255 match c {
Alex Crichton7b28c272015-09-15 20:56:16 -0700256 "LARGE_INTEGER" |
Alex Crichtoneef03da2015-09-15 16:57:06 -0700257 "mach_timebase_info_data_t" |
Alex Crichton7b28c272015-09-15 20:56:16 -0700258 "float" |
Alex Crichtond11e9142015-09-15 23:28:52 -0700259 "double" => true,
260 n if n.starts_with("pthread") => true,
Alex Crichton18469182015-09-15 20:57:42 -0700261
262 // windows-isms
Alex Crichtond11e9142015-09-15 23:28:52 -0700263 n if n.starts_with("P") => true,
264 n if n.starts_with("H") => true,
265 n if n.starts_with("LP") => true,
266 _ => false,
Alex Crichton6d3cfdb2015-09-15 14:53:01 -0700267 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700268 });
Alex Crichton6d3cfdb2015-09-15 14:53:01 -0700269
Alex Crichtond11e9142015-09-15 23:28:52 -0700270 cfg.skip_const(move |name| {
Alex Crichton31504842015-09-10 23:43:41 -0700271 match name {
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700272 // Apparently these don't exist in mingw headers?
Alex Crichton31504842015-09-10 23:43:41 -0700273 "MEM_RESET_UNDO" |
274 "FILE_ATTRIBUTE_NO_SCRUB_DATA" |
275 "FILE_ATTRIBUTE_INTEGRITY_STREAM" |
Alex Crichtond11e9142015-09-15 23:28:52 -0700276 "ERROR_NOTHING_TO_TERMINATE" if mingw => true,
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700277
Alex Crichtond11e9142015-09-15 23:28:52 -0700278 "SIG_IGN" => true, // sighandler_t weirdness
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700279
Alex Crichton15b83c22015-09-17 17:25:52 -0700280 // types on musl are defined a little differently
Alex Crichton3a572fd2015-10-29 16:52:25 -0700281 n if musl && n.contains("__SIZEOF_PTHREAD") => true,
Alex Crichton15b83c22015-09-17 17:25:52 -0700282
Alex Crichton74825222015-10-29 17:36:55 -0700283 // Skip constants not defined in MUSL but just passed down to the
284 // kernel regardless
285 "RLIMIT_NLIMITS" |
286 "TCP_COOKIE_TRANSACTIONS" |
287 "RLIMIT_RTTIME" if musl => true,
Alexander Polakov26974c72015-11-27 03:02:44 +0300288 // work around super old mips toolchain
Alexander Polakov58501562015-12-14 02:09:45 +0300289 "SCHED_IDLE" | "SHM_NORESERVE" => mips,
Alex Crichton74825222015-10-29 17:36:55 -0700290
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800291 // weird signed extension or something like that?
292 "MS_NOUSER" => true,
293
294 // These OSX constants are flagged as deprecated
295 "NOTE_EXIT_REPARENTED" |
296 "NOTE_REAP" if apple => true,
297
298 // The linux/quota.h header file which defines these can't be
299 // included with sys/quota.h currently on MIPS, so we don't include
300 // it and just ignore these constants
301 "QFMT_VFS_OLD" |
302 "QFMT_VFS_V0" if mips && linux => true,
303
Alex Crichtond11e9142015-09-15 23:28:52 -0700304 _ => false,
Alex Crichton31504842015-09-10 23:43:41 -0700305 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700306 });
Alex Crichton31504842015-09-10 23:43:41 -0700307
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700308 cfg.skip_fn(move |name| {
309 // skip those that are manually verifiedmanually verified
Alex Crichton22378822015-09-10 19:59:23 -0700310 match name {
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700311 "execv" | // crazy stuff with const/mut
Alex Crichton22378822015-09-10 19:59:23 -0700312 "execve" |
313 "execvp" |
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700314 "execvpe" => true,
315
Alex Crichton74825222015-10-29 17:36:55 -0700316 "getrlimit" | "getrlimit64" | // non-int in 1st arg
317 "setrlimit" | "setrlimit64" | // non-int in 1st arg
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700318 "strerror_r" if linux => true, // actually xpg-something-or-other
319
Alex Crichton1ff96102015-09-17 15:09:02 -0700320 // typed 2nd arg on linux and android
Sébastien Mariec618f362015-12-21 17:26:41 +0100321 "gettimeofday" if linux || android || freebsd || openbsd => true,
Alex Crichton1ff96102015-09-17 15:09:02 -0700322
Alex Crichton881ef9b2015-12-01 09:04:13 -0800323 // not declared in newer android toolchains
324 "getdtablesize" if android => true,
325
Alex Crichton1ff96102015-09-17 15:09:02 -0700326 "dlerror" if android => true, // const-ness is added
Alex Crichton88d23e72015-11-02 17:03:19 -0800327 "dladdr" if musl => true, // const-ness only added recently
Alex Crichton1ff96102015-09-17 15:09:02 -0700328
Alex Crichton568705e2015-11-03 14:18:52 -0800329 // OSX has 'struct tm *const' which we can't actually represent in
330 // Rust, but is close enough to *mut
331 "timegm" if apple => true,
332
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800333 // OSX's daemon is deprecated in 10.5 so we'll get a warning (which
334 // we turn into an error) so just ignore it.
335 "daemon" if apple => true,
336
Alex Crichton49d7bca2015-11-27 09:40:37 -0800337 // These functions presumably exist on netbsd but don't look like
338 // they're implemented on rumprun yet, just let them slide for now.
339 // Some of them look like they have headers but then don't have
340 // corresponding actual definitions either...
341 "backtrace" |
342 "pthread_main_np" |
343 "pthread_set_name_np" |
344 "pthread_stackseg_np" |
345 "shm_open" |
346 "shm_unlink" |
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800347 "syscall" |
348 "ptrace" |
Alex Crichton49d7bca2015-11-27 09:40:37 -0800349 "sigaltstack" if rumprun => true,
350
Alex Crichtond11e9142015-09-15 23:28:52 -0700351 _ => false,
Alex Crichton22378822015-09-10 19:59:23 -0700352 }
Alex Crichtond11e9142015-09-15 23:28:52 -0700353 });
Alex Crichton22378822015-09-10 19:59:23 -0700354
Alex Crichton881ef9b2015-12-01 09:04:13 -0800355 cfg.skip_fn_ptrcheck(move |name| {
356 match name {
357 // This used to be called bsd_signal in rev 18 of the android
358 // platform and is now just called signal, the old `bsd_signal`
359 // symbol, however, still remains, just gives a different function
360 // pointer.
361 "signal" if android => true,
362
363 // dllimport weirdness?
364 _ if windows => true,
365
366 _ => false,
367 }
368 });
Alex Crichtone0f4d102015-09-16 09:48:14 -0700369
Alex Crichton15b83c22015-09-17 17:25:52 -0700370 cfg.skip_field_type(move |struct_, field| {
Alex Crichtonf3b97482015-09-16 14:13:20 -0700371 // This is a weird union, don't check the type.
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700372 (struct_ == "ifaddrs" && field == "ifa_ifu") ||
373 // sighandler_t type is super weird
374 (struct_ == "sigaction" && field == "sa_sigaction")
375 });
376
Alex Crichton15b83c22015-09-17 17:25:52 -0700377 cfg.skip_field(move |struct_, field| {
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700378 // this is actually a union on linux, so we can't represent it well and
379 // just insert some padding.
Alex Crichton15b83c22015-09-17 17:25:52 -0700380 (struct_ == "siginfo_t" && field == "_pad") ||
381 // musl names this __dummy1 but it's still there
382 (musl && struct_ == "glob_t" && field == "gl_flags")
Alex Crichtonf3b97482015-09-16 14:13:20 -0700383 });
384
Alex Crichton49d7bca2015-11-27 09:40:37 -0800385 cfg.fn_cname(move |name, cname| {
Alex Crichton881ef9b2015-12-01 09:04:13 -0800386 if windows {
Alex Crichton49d7bca2015-11-27 09:40:37 -0800387 cname.unwrap_or(name).to_string()
Alex Crichton0af5e232015-11-30 15:07:28 -0800388 } else {
Alex Crichton49d7bca2015-11-27 09:40:37 -0800389 name.to_string()
Alex Crichton0af5e232015-11-30 15:07:28 -0800390 }
391 });
392
Alex Crichtond11e9142015-09-15 23:28:52 -0700393 cfg.generate("../src/lib.rs", "all.rs");
Alex Crichton310d6232015-09-10 10:56:31 -0700394}