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

Fix the generated include #55

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading