Skip to content

Commit

Permalink
Allow building under longer paths (#44)
Browse files Browse the repository at this point in the history
It turns out that #41 was insufficient since `cmake` will forcibly _set_
`CMAKE_INSTALL_PREFIX` to the output directory (which is under the
target directory) if it isn't already set[1]. So, we need to explicitly
set a short dummy value.

This should hopefully _actually_ fix docs.rs builds.

The version bump to ibverbs (non-sys) is just to force docs.rs to
attempt re-generation of the docs.

[1]: https://github.com/rust-lang/cmake-rs/blob/94da9de2ea79ab6cad572e908864a160cf4847a9/src/lib.rs#L699-L703
  • Loading branch information
jonhoo authored Dec 27, 2024
1 parent b45ae84 commit 122f5d3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ibverbs-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibverbs-sys"
version = "0.3.0+55.0"
version = "0.3.1+55.0"
edition = "2021"
rust-version = "1.82" # unsafe extern in generated bindings

Expand Down
12 changes: 12 additions & 0 deletions ibverbs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ fn main() {
eprintln!("run cmake");
let built_in = cmake::Config::new("vendor/rdma-core")
.define("NO_MAN_PAGES", "1")
// cmake crate defaults CMAKE_INSTALL_PREFIX to the output directory
//
// https://github.com/rust-lang/cmake-rs/blob/94da9de2ea79ab6cad572e908864a160cf4847a9/src/lib.rs#L699-L703
//
// this results in overly long runtime paths on docs.rs, which then fail the build. it also
// causes sadness for users trying to build since the bindings may fail to build for the
// same reason (see https://github.com/jonhoo/rust-ibverbs/pull/41 for what was an
// incomplete fix).
//
// since we never actually _install_ anything when building here, we should be able to
// safely set this to any short path. simply by convention we set it to `/usr`.
.define("CMAKE_INSTALL_PREFIX", "/usr")
.no_build_target(true)
.build();
let built_in = built_in
Expand Down
2 changes: 1 addition & 1 deletion ibverbs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibverbs"
version = "0.9.0"
version = "0.9.1"
edition = "2021"

description = "Bindings for RDMA ibverbs through rdma-core"
Expand Down

0 comments on commit 122f5d3

Please sign in to comment.