{"action":"created","comment":{"url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/comments/58560489","id":58560489,"diff_hunk":"@@ -6,10 +31,29 @@ fn main() {\n      .file(\"openzwave-c/manager.cc\")\n      .file(\"openzwave-c/notification.cc\")\n      .file(\"openzwave-c/value_classes/value_id.cc\")\n-     .include(\"/usr/include/openzwave\") // workaround for https://github.com/OpenZWave/open-zwave/issues/771\n-     .include(\"/usr/local/include/openzwave\")\n      .cpp(true)\n-     .flag(\"-std=c++11\") // to iterate with ranges\n-     .compile(\"libopenzwave-c.a\");\n-    println!(\"cargo:rustc-flags=-l openzwave\");\n+     .flag(\"-std=c++11\"); // to iterate with ranges\n+\n+    if find_include_path(&mut c).is_ok() {\n+        c.compile(\"libopenzwave-c.a\");\n+        println!(\"cargo:rustc-flags=-l openzwave\");\n+        return;\n+    }\n+\n+    // OK then let's build the real stuff...\n+    println!(\"Building the open-zwave library...\");\n+    let exit_code = Command::new(\"make\").current_dir(\"open-zwave\").status().unwrap();\n+    if !exit_code.success() {\n+        panic!(\"Could not build the open-zwave library.\");\n+    }\n+\n+    // then build our library\n+    c.include(\"open-zwave/cpp/src\").compile(\"libopenzwave-c.a\");\n+\n+    let this_dir = env::var(\"CARGO_MANIFEST_DIR\").unwrap();\n+\n+    // then tell rust to link with open-zwave\n+    println!(\"cargo:rustc-link-lib=udev\");","path":"openzwave-sys/build.rs","position":null,"original_position":61,"commit_id":"09c629386bb40c6b0ceda9dba16898058bd4abc1","original_commit_id":"c7b7e61ed180a6034294fff00df6bef941a021c9","user":{"login":"dhylands","id":127500,"avatar_url":"https://avatars.githubusercontent.com/u/127500?v=3","gravatar_id":"","url":"https://api.github.com/users/dhylands","html_url":"https://github.com/dhylands","followers_url":"https://api.github.com/users/dhylands/followers","following_url":"https://api.github.com/users/dhylands/following{/other_user}","gists_url":"https://api.github.com/users/dhylands/gists{/gist_id}","starred_url":"https://api.github.com/users/dhylands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhylands/subscriptions","organizations_url":"https://api.github.com/users/dhylands/orgs","repos_url":"https://api.github.com/users/dhylands/repos","events_url":"https://api.github.com/users/dhylands/events{/privacy}","received_events_url":"https://api.github.com/users/dhylands/received_events","type":"User","site_admin":false},"body":"Yeah udev only exists on linux. So you'll probably need to have two separate function to do the println! (one for linux and one one for non-linux) and use:\r\n#[cfg(target_os = \"linux\")] and #[cfg(not(target_os = \"linux\"))] in front of the 2 functions.","created_at":"2016-04-05T15:34:07Z","updated_at":"2016-04-05T15:34:07Z","html_url":"https://github.com/fxbox/openzwave-rust/pull/22#discussion_r58560489","pull_request_url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/comments/58560489"},"html":{"href":"https://github.com/fxbox/openzwave-rust/pull/22#discussion_r58560489"},"pull_request":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22","id":65255993,"html_url":"https://github.com/fxbox/openzwave-rust/pull/22","diff_url":"https://github.com/fxbox/openzwave-rust/pull/22.diff","patch_url":"https://github.com/fxbox/openzwave-rust/pull/22.patch","issue_url":"https://api.github.com/repos/fxbox/openzwave-rust/issues/22","number":22,"state":"open","locked":false,"title":"Build openzwave locally","user":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-05T06:15:17Z","updated_at":"2016-04-05T15:34:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4b499266aedcdaa911e498f864a79231063d7a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22/commits","review_comments_url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22/comments","review_comment_url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fxbox/openzwave-rust/issues/22/comments","statuses_url":"https://api.github.com/repos/fxbox/openzwave-rust/statuses/09c629386bb40c6b0ceda9dba16898058bd4abc1","head":{"label":"julienw:build-openzwave-locally","ref":"build-openzwave-locally","sha":"09c629386bb40c6b0ceda9dba16898058bd4abc1","user":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"repo":{"id":52023983,"name":"openzwave-rust","full_name":"julienw/openzwave-rust","owner":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/julienw/openzwave-rust","description":"Rust wrapper for the open-zwave library","fork":true,"url":"https://api.github.com/repos/julienw/openzwave-rust","forks_url":"https://api.github.com/repos/julienw/openzwave-rust/forks","keys_url":"https://api.github.com/repos/julienw/openzwave-rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/julienw/openzwave-rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/julienw/openzwave-rust/teams","hooks_url":"https://api.github.com/repos/julienw/openzwave-rust/hooks","issue_events_url":"https://api.github.com/repos/julienw/openzwave-rust/issues/events{/number}","events_url":"https://api.github.com/repos/julienw/openzwave-rust/events","assignees_url":"https://api.github.com/repos/julienw/openzwave-rust/assignees{/user}","branches_url":"https://api.github.com/repos/julienw/openzwave-rust/branches{/branch}","tags_url":"https://api.github.com/repos/julienw/openzwave-rust/tags","blobs_url":"https://api.github.com/repos/julienw/openzwave-rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/julienw/openzwave-rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/julienw/openzwave-rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/julienw/openzwave-rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/julienw/openzwave-rust/statuses/{sha}","languages_url":"https://api.github.com/repos/julienw/openzwave-rust/languages","stargazers_url":"https://api.github.com/repos/julienw/openzwave-rust/stargazers","contributors_url":"https://api.github.com/repos/julienw/openzwave-rust/contributors","subscribers_url":"https://api.github.com/repos/julienw/openzwave-rust/subscribers","subscription_url":"https://api.github.com/repos/julienw/openzwave-rust/subscription","commits_url":"https://api.github.com/repos/julienw/openzwave-rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/julienw/openzwave-rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/julienw/openzwave-rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/julienw/openzwave-rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/julienw/openzwave-rust/contents/{+path}","compare_url":"https://api.github.com/repos/julienw/openzwave-rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/julienw/openzwave-rust/merges","archive_url":"https://api.github.com/repos/julienw/openzwave-rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/julienw/openzwave-rust/downloads","issues_url":"https://api.github.com/repos/julienw/openzwave-rust/issues{/number}","pulls_url":"https://api.github.com/repos/julienw/openzwave-rust/pulls{/number}","milestones_url":"https://api.github.com/repos/julienw/openzwave-rust/milestones{/number}","notifications_url":"https://api.github.com/repos/julienw/openzwave-rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/julienw/openzwave-rust/labels{/name}","releases_url":"https://api.github.com/repos/julienw/openzwave-rust/releases{/id}","deployments_url":"https://api.github.com/repos/julienw/openzwave-rust/deployments","created_at":"2016-02-18T17:08:36Z","updated_at":"2016-02-18T17:08:37Z","pushed_at":"2016-04-05T14:23:09Z","git_url":"git://github.com/julienw/openzwave-rust.git","ssh_url":"git@github.com:julienw/openzwave-rust.git","clone_url":"https://github.com/julienw/openzwave-rust.git","svn_url":"https://github.com/julienw/openzwave-rust","homepage":"","size":107,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fxbox:master","ref":"master","sha":"ba44f73ff52d25c79212b1e76be25b358956d2c7","user":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"repo":{"id":51142552,"name":"openzwave-rust","full_name":"fxbox/openzwave-rust","owner":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fxbox/openzwave-rust","description":"Rust wrapper for the open-zwave library","fork":false,"url":"https://api.github.com/repos/fxbox/openzwave-rust","forks_url":"https://api.github.com/repos/fxbox/openzwave-rust/forks","keys_url":"https://api.github.com/repos/fxbox/openzwave-rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fxbox/openzwave-rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fxbox/openzwave-rust/teams","hooks_url":"https://api.github.com/repos/fxbox/openzwave-rust/hooks","issue_events_url":"https://api.github.com/repos/fxbox/openzwave-rust/issues/events{/number}","events_url":"https://api.github.com/repos/fxbox/openzwave-rust/events","assignees_url":"https://api.github.com/repos/fxbox/openzwave-rust/assignees{/user}","branches_url":"https://api.github.com/repos/fxbox/openzwave-rust/branches{/branch}","tags_url":"https://api.github.com/repos/fxbox/openzwave-rust/tags","blobs_url":"https://api.github.com/repos/fxbox/openzwave-rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fxbox/openzwave-rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fxbox/openzwave-rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/fxbox/openzwave-rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fxbox/openzwave-rust/statuses/{sha}","languages_url":"https://api.github.com/repos/fxbox/openzwave-rust/languages","stargazers_url":"https://api.github.com/repos/fxbox/openzwave-rust/stargazers","contributors_url":"https://api.github.com/repos/fxbox/openzwave-rust/contributors","subscribers_url":"https://api.github.com/repos/fxbox/openzwave-rust/subscribers","subscription_url":"https://api.github.com/repos/fxbox/openzwave-rust/subscription","commits_url":"https://api.github.com/repos/fxbox/openzwave-rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/fxbox/openzwave-rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/fxbox/openzwave-rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/fxbox/openzwave-rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/fxbox/openzwave-rust/contents/{+path}","compare_url":"https://api.github.com/repos/fxbox/openzwave-rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fxbox/openzwave-rust/merges","archive_url":"https://api.github.com/repos/fxbox/openzwave-rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fxbox/openzwave-rust/downloads","issues_url":"https://api.github.com/repos/fxbox/openzwave-rust/issues{/number}","pulls_url":"https://api.github.com/repos/fxbox/openzwave-rust/pulls{/number}","milestones_url":"https://api.github.com/repos/fxbox/openzwave-rust/milestones{/number}","notifications_url":"https://api.github.com/repos/fxbox/openzwave-rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fxbox/openzwave-rust/labels{/name}","releases_url":"https://api.github.com/repos/fxbox/openzwave-rust/releases{/id}","deployments_url":"https://api.github.com/repos/fxbox/openzwave-rust/deployments","created_at":"2016-02-05T11:21:13Z","updated_at":"2016-03-25T02:06:12Z","pushed_at":"2016-04-05T14:23:09Z","git_url":"git://github.com/fxbox/openzwave-rust.git","ssh_url":"git@github.com:fxbox/openzwave-rust.git","clone_url":"https://github.com/fxbox/openzwave-rust.git","svn_url":"https://github.com/fxbox/openzwave-rust","homepage":"","size":107,"stargazers_count":1,"watchers_count":1,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22"},"html":{"href":"https://github.com/fxbox/openzwave-rust/pull/22"},"issue":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/issues/22"},"comments":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/fxbox/openzwave-rust/statuses/09c629386bb40c6b0ceda9dba16898058bd4abc1"}}}}