Skip to content

Commit

Permalink
Merge pull request #55 from sgrif/fix/generated_include
Browse files Browse the repository at this point in the history
Fix the generated include
  • Loading branch information
weiznich committed Apr 4, 2024
2 parents 31d60fb + 3b0b90d commit 8007be7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pq-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::path::PathBuf;
use std::{env, fs};

const LIBPORTS_BASE: &[&str] = &[
"strlcat.c",
"strlcpy.c",
"snprintf.c",
"pg_crc32c_sb8.c",
Expand Down Expand Up @@ -48,6 +47,7 @@ const LIBPORTS_WINDOWS: &[&str] = &[
"win32stat.c",
"open.c",
"dirmod.c",
"strlcat.c",
];

const LIBCOMMON_BASE: &[&str] = &[
Expand Down Expand Up @@ -232,6 +232,8 @@ fn main() {
let out = env::var("OUT_DIR").expect("Set by cargo");
let include_path = PathBuf::from(&out).join("include");
let lib_pq_path = PathBuf::from(format!("{path}/{pq_path}"));
let postgres_include_path = PathBuf::from(format!("{path}src/include"));
let additional_includes_path = PathBuf::from(format!("{crate_dir}/additional_include"));
fs::create_dir_all(&include_path).expect("Failed to create include directory");
fs::create_dir_all(include_path.join("postgres").join("internal"))
.expect("Failed to create include directory");
Expand All @@ -245,6 +247,16 @@ fn main() {
include_path.join("libpq-events.h"),
)
.expect("Copying headers failed");
fs::copy(
postgres_include_path.join("postgres_ext.h"),
include_path.join("postgres_ext.h"),
)
.expect("Copying headers failed");
fs::copy(
additional_includes_path.join("pg_config_ext.h"),
include_path.join("pg_config_ext.h"),
)
.expect("Copying headers failed");

fs::copy(
lib_pq_path.join("libpq-int.h"),
Expand Down

0 comments on commit 8007be7

Please sign in to comment.