diff options
| author | ashleysommer <flubba86@gmail.com> | 2016-03-01 20:48:03 +1000 |
|---|---|---|
| committer | Ashley Sommer <Ashley.Sommer@csiro.au> | 2016-03-07 17:22:55 +1000 |
| commit | 660bbf4f6f4ce7a3d9e4fa7fdfc5e7c87145e049 (patch) | |
| tree | fdc981019c478af3aa0e6b518c1b921862b83af9 /src/libstd/sys | |
| parent | 979aaafc5179c9bd7235e8871f2f3482b9597386 (diff) | |
| download | rust-660bbf4f6f4ce7a3d9e4fa7fdfc5e7c87145e049.tar.gz rust-660bbf4f6f4ce7a3d9e4fa7fdfc5e7c87145e049.zip | |
Fix building libstd on on emscripten targets.
Squashed 10 commits: 1) The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. 2) Update previous commit to comply with rust formatting standards. Removed tab characters, remove trailing whitespaces. 3) Move emscripten changes into their own file under libstd/os/emscripten Put libstd/os/linux/fs back to the way it was. 4) Cannot use stat.st_ctim on emscripten to get created time. 5) Remove compile-time conditionals for target_env = musl, it looks like musl builds compile fine already. 6) Undone some formatting changes that are no longer needed, Removed some more target_env="musl" compilation checks that I missed from my previous commit. 7) upgrade to liblibc e19309c, it fixes the differences in the musl stat and stat64 definitions. 8) Undo the compile-time checks to check for emscripten (or musl targets) in the FileAttr struct. No longer needed after updating liblibc to e19309c. 9) Change the MetadataExt implementation of emscripten fs.rs module to match the changes in new liblibc. 10) remove a stray return statement, should have been removed in the previous commit.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 250b1b015a0..d1b4b1c5c08 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -25,15 +25,19 @@ use sys::time::SystemTime; use sys::{cvt, cvt_r}; use sys_common::{AsInner, FromInner}; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "emscripten"))] use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64}; #[cfg(target_os = "android")] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off64_t, ftruncate64, lseek64, dirent as dirent64, open as open64}; -#[cfg(not(any(target_os = "linux", target_os = "android")))] +#[cfg(not(any(target_os = "linux", + target_os = "emscripten", + target_os = "android")))] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t, ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64, open as open64}; -#[cfg(not(any(target_os = "linux", target_os = "solaris")))] +#[cfg(not(any(target_os = "linux", + target_os = "emscripten", + target_os = "solaris")))] use libc::{readdir_r as readdir64_r}; pub struct File(FileDesc); |
