Skip to content

Commit

Permalink
Allow other crates to reuse the bundled static build
Browse files Browse the repository at this point in the history
This commit sets the `DEP_PQ_SYS_SRC_INCLUDE` and
`DEP_PQ_SYS_SRC_LIB_DIR` enviroment variable so that other crates can
reuse the static build.
  • Loading branch information
weiznich committed Jan 29, 2024
1 parent 0bad18b commit 77e6729
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions pq-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include = [
description = "Bundled version of libpq"
license = "MIT OR Apache-2.0"
repository = "https://github.com/sgrif/pq-sys"
links = "pq_sys_src"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
20 changes: 10 additions & 10 deletions pq-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ fn main() {

basic_build
.clone()
.files(LIBPORTS.iter().map(|p| format!("{path}{port_path}{p}")))
.compile("ports");

basic_build
.clone()
.files(LIBCOMMON.iter().map(|p| format!("{path}{common_path}{p}")))
.compile("pgcommon");

basic_build
.files(LIBPQ.iter().map(|p| format!("{path}{pq_path}{p}")))
.files(
LIBPORTS
.iter()
.map(|p| format!("{path}{port_path}{p}"))
.chain(LIBCOMMON.iter().map(|p| format!("{path}{common_path}{p}")))
.chain(LIBPQ.iter().map(|p| format!("{path}{pq_path}{p}"))),
)
.compile("pq");

println!("cargo:include={path}/src/include");
println!("cargo:lib_dir={}", std::env::var("OUT_DIR").expect("Set by cargo"));
}

0 comments on commit 77e6729

Please sign in to comment.