Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc build-related fixes #2

Merged
merged 5 commits into from
May 18, 2020
Merged

Misc build-related fixes #2

merged 5 commits into from
May 18, 2020

Conversation

jmagnuson
Copy link
Owner

@jmagnuson jmagnuson commented May 17, 2020

Fixes a few issues seen when cross-compiling, and also when building from OSX:

  • Add feature flag pkgconfig to be able to re-enable pkg-config support when building with default-features = false.
  • Remove setting target in clang_arg for bindgen. There were issues encountered when cross-compiling, and it gets discovered by bindgen internally, anyway. I still haven't looked into the code path discrepancies, but I suspect there might be an issue with not also setting the sysroot. TBD.
  • Set and pass OPENSSL_ROOT_DIR into cmake when doing bundled builds. FindOpenSSL.cmake needs this.

Also included are some additions for verbose building.

pkg-config needs the ability to be re-enabled if `default-features` are
set to false. This cannot be done outside of an extra feature flag, so
feature `pkgconfig` is added.

Also, `libevent-sys` is added to `libevent-rs` without default features,
so they can be controlled entirely from the latter.
`FindOpenSSL` relies on this, so map the `DEP_OPENSSL_ROOT` supplied by
`openssl-sys` (or try to create using `DEP_OPENSSL_INCLUDE`).
@@ -30,6 +30,18 @@ fn build_libevent(libevent_path: impl AsRef<std::path::Path>) -> PathBuf {
}

config.register_dep("openssl");

let openssl_root = if let Ok(root) = env::var("DEP_OPENSSL_ROOT") {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity, this metadata was only added in openssl-sys 0.9.48 (sfackler/rust-openssl@ef86438), and the logic here exists to be backwards-compatible with earlier versions.

static = [ "libevent-sys/static" ]
pkgconfig = [ "libevent-sys/pkgconfig" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a package is optional you can include it the same as you'd include a feature - so this can just be libevent-sys/pkg-config and you can remove the named feature in the libevent-sys crate. Additionally you could just add the feature libevent-sys/pkg-config to your default config and get rid of all the pkgconfig aliases.

@jmagnuson jmagnuson merged commit c370a90 into master May 18, 2020
@jmagnuson jmagnuson deleted the feature/pkgconfig-flag branch May 18, 2020 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants