Repository: thecoshman/http (language: rust)

Issue:
Failed to install on Mac OS X
When I try to run `cargo install http`, I get the following:
```
tl.c:2:10: fatal error: 'linux/fs.h' file not found
cargo:warning=#include <linux/fs.h>
cargo:warning=         ^
cargo:warning=1 error generated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-E" "/var/folders/5_/hmrg04kx24b3q_wjr6q7v5tm0000gn/T/cargo-installoZX3fX/release/build/https-42fae33222fd6a00/out/ioctl-data/ioctl.c" with args "cc" did not execute successfully (status code exit code: 1).

'
```
Presumably because `<linux/fs.h>` is incorrect for Mac OS X. 


Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index b0c116e..2949f06 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ categories = ["network-programming", "web-programming::http-server"]
 license = "MIT"
 build = "build.rs"
 # Remember to also update in appveyor.yml
-version = "1.3.2"
+version = "1.3.3"
 # Remember to also update in http.md
 authors = ["thecoshman <thecoshman@gmail.com>",
            "nabijaczleweli <nabijaczleweli@gmail.com>"]
@@ -41,13 +41,13 @@ default-features = false
 version = "0.5"
 features = ["hyper-native-tls"]
 
-[target.'cfg(not(target_os = "windows"))'.dependencies.libc]
+[target.'cfg(not(any(target_os = "windows", target_os = "macos")))'.dependencies.libc]
 version = "0.2"
 
 [build-dependencies]
 embed-resource = "1.1"
 
-[target.'cfg(not(target_os = "windows"))'.build-dependencies.gcc]
+[target.'cfg(not(any(target_os = "windows", target_os = "macos")))'.build-dependencies.gcc]
 version = "0.3"
 
 
diff --git a/appveyor.yml b/appveyor.yml
index ef43e66..6f47fa4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 1.3.2-{build}
+version: 1.3.3-{build}
 
 skip_tags: false
 
@@ -22,21 +22,21 @@ build: off
 build_script:
   - git submodule update --init --recursive
   - cargo build --verbose --release
-  - cp target\release\http.exe http-v1.3.2.exe
-  - strip --strip-all --remove-section=.comment --remove-section=.note http-v1.3.2.exe
-  - makensis -DHTTP_VERSION=v1.3.2 "/X!include \"EnvVarUpdate.nsh\"" install.nsi
+  - cp target\release\http.exe http-v1.3.3.exe
+  - strip --strip-all --remove-section=.comment --remove-section=.note http-v1.3.3.exe
+  - makensis -DHTTP_VERSION=v1.3.3 "/X!include \"EnvVarUpdate.nsh\"" install.nsi
 
 test: off
 test_script:
   - cargo test --verbose --release
 
 artifacts:
-  - path: http-v1.3.2.exe
-  - path: http v1.3.2 installer.exe
+  - path: http-v1.3.3.exe
+  - path: http v1.3.3 installer.exe
 
 deploy:
   provider: GitHub
-  artifact: /http.*v1.3.2.*\.exe/
+  artifact: /http.*v1.3.3.*\.exe/
   auth_token:
     secure: ZTXvCrv9y01s7Hd60w8W7NaouPnPoaw9YJt9WhWQ2Pep8HLvCikt9Exjkz8SGP9P
   on:
diff --git a/build.rs b/build.rs
index 7ec64d8..522db92 100644
--- a/build.rs
+++ b/build.rs
@@ -1,18 +1,19 @@
 extern crate embed_resource;
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 extern crate gcc;
 
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 use std::env;
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 use std::io::Write;
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 use std::path::Path;
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 use std::fs::{self, File};
 
 
 /// The last line of this, after running it through a preprocessor, will expand to the value of `BLKGETSIZE`
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 static IOCTL_CHECK_SOURCE: &str = r#"
 #include <linux/fs.h>
 
@@ -20,6 +21,7 @@ BLKGETSIZE
 "#;
 
 /// Replace `{}` with the `BLKGETSIZE` expression from `IOCTL_CHECK_SOURCE`
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 static IOCTL_INCLUDE_SKELETON: &str = r#"
 /// Return `device size / 512` (`long *` arg)
 static BLKGETSIZE: c_ulong = {};
@@ -35,12 +37,10 @@ fn embed_resources() {
     embed_resource::compile("http-manifest.rc");
 }
 
-#[cfg(target_os = "windows")]
-fn get_ioctl_data() {
-
-}
+#[cfg(any(target_os = "windows", target_os = "macos"))]
+fn get_ioctl_data() {}
 
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 fn get_ioctl_data() {
     let ioctl_dir = Path::new(&env::var("OUT_DIR").unwrap()).join("ioctl-data");
     fs::create_dir_all(&ioctl_dir).unwrap();
diff --git a/src/main.rs b/src/main.rs
index fc4ae22..ad0dc34 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,7 +16,7 @@ extern crate serde;
 #[macro_use]
 extern crate clap;
 extern crate iron;
-#[cfg(not(target_os = "windows"))]
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
 extern crate libc;
 extern crate time;
 extern crate url;
diff --git a/src/util/os/mod.rs b/src/util/os/mod.rs
index 709275a..4103c02 100644
--- a/src/util/os/mod.rs
+++ b/src/util/os/mod.rs
@@ -1,9 +1,9 @@
-#[cfg(target_os = "windows")]
-mod windows;
-#[cfg(not(target_os = "windows"))]
-mod non_windows;
+#[cfg(any(target_os = "windows", target_os = "macos"))]
+mod windows_macos;
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
+mod non_windows_non_macos;
 
-#[cfg(target_os = "windows")]
-pub use self::windows::{file_length, is_device};
-#[cfg(not(target_os = "windows"))]
-pub use self::non_windows::{file_length, is_device};
+#[cfg(any(target_os = "windows", target_os = "macos"))]
+pub use self::windows_macos::{file_length, is_device};
+#[cfg(not(any(target_os = "windows", target_os = "macos")))]
+pub use self::non_windows_non_macos::{file_length, is_device};
diff --git a/src/util/os/non_windows.rs b/src/util/os/non_windows_non_macos.rs
similarity index 100%
rename from src/util/os/non_windows.rs
rename to src/util/os/non_windows_non_macos.rs
diff --git a/src/util/os/windows.rs b/src/util/os/windows_macos.rs
similarity index 100%
rename from src/util/os/windows.rs
rename to src/util/os/windows_macos.rs


Test patch: