Skip to content

Commit

Permalink
Try to get a proper build log
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Dec 1, 2023
1 parent 1116fbc commit 3dd6ea4
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ jobs:
echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH
echo "C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_PATH
echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_ENV
- name: Add msbuild to PATH
if: runner.os == 'Windows' && matrix.features == 'bundled'
uses: microsoft/[email protected]
with:
msbuild-architecture: x64
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows' && matrix.features == 'bundled'
- name: Windows setup (bundled)
if: runner.os == 'Windows' && matrix.features == 'bundled'
shell: bash
run: |
echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV
echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
- name: Windows setup (bundled)
if: runner.os == 'Windows' && matrix.features == 'bundled'
shell: cmd
run: |
cd pq-src/source/
src\tools\msvc\build.bat libpq
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

Expand All @@ -70,6 +90,7 @@ jobs:
shell: bash
run: |
cargo test --no-default-features --features "${{ matrix.features }}"
- name: Test compile diesel
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "pq-src/source"]
path = pq-src/source
url = https://github.com/postgres/postgres
url = https://github.com/weiznich/postgres
2 changes: 1 addition & 1 deletion pq-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include = [

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

[dependencies]
[target.'cfg(not(target_os = "windows"))'.dependencies]
openssl-sys = { version = "0.9.93", features = ["vendored"] }


Expand Down
13 changes: 13 additions & 0 deletions pq-src/additional_include/pg_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,22 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

// that function does not exist on macos
#ifndef __APPLE__
/* Define to 1 if you have the `strchrnul' function. */
#define HAVE_STRCHRNUL 1
#endif

/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1

// windows does not have that header
#ifndef _WIN32
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

#endif

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

Expand Down Expand Up @@ -126,8 +133,10 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "16.0"

#ifndef _WIN32
/* Define to the name of a signed 128-bit integer type. */
#define PG_INT128_TYPE __int128
#endif

/* Define to the name of a signed 64-bit integer type. */
#define PG_INT64_TYPE long int
Expand Down Expand Up @@ -250,3 +259,7 @@

/* Define to the appropriate printf length modifier for 64-bit ints. */
#define INT64_MODIFIER "l"

#if defined _WIN32
#define HAVE_INET_ATON 1
#endif
59 changes: 57 additions & 2 deletions pq-src/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;

const LIBPORTS: &'static [&'static str] = &[
#[cfg(target_os = "linux")]
"getpeereid.c",
"strlcat.c",
"strlcpy.c",
Expand All @@ -22,7 +23,40 @@ const LIBPORTS: &'static [&'static str] = &[
"quotes.c",
"strerror.c",
"tar.c",
#[cfg(not(target_os = "windows"))]
"thread.c",
#[cfg(target_os = "macos")]
"explicit_bzero.c",
#[cfg(target_os = "windows")]
"win32common.c",
#[cfg(target_os = "windows")]
"win32dlopen.c",
#[cfg(target_os = "windows")]
"win32env.c",
#[cfg(target_os = "windows")]
"win32error.c",
#[cfg(target_os = "windows")]
"win32fdatasync.c",
#[cfg(target_os = "windows")]
"win32fseek.c",
#[cfg(target_os = "windows")]
"win32getrusage.c",
#[cfg(target_os = "windows")]
"win32gettimeofday.c",
#[cfg(target_os = "windows")]
"win32link.c",
#[cfg(target_os = "windows")]
"win32ntdll.c",
#[cfg(target_os = "windows")]
"win32pread.c",
#[cfg(target_os = "windows")]
"win32pwrite.c",
#[cfg(target_os = "windows")]
"win32security.c",
#[cfg(target_os = "windows")]
"win32setlocale.c",
#[cfg(target_os = "windows")]
"win32stat.c",
];

const LIBCOMMON: &'static [&'static str] = &[
Expand Down Expand Up @@ -50,7 +84,11 @@ const LIBCOMMON: &'static [&'static str] = &[
"wait_error.c",
"wchar.c",
"cryptohash_openssl.c",
#[cfg(not(target_os = "windows"))]
"hmac_openssl.c",
#[cfg(target_os = "windows")]
"hmac.c",
#[cfg(not(target_os = "windows"))]
"protocol_openssl.c",
"fe_memutils.c",
"restricted_token.c",
Expand All @@ -59,6 +97,8 @@ const LIBCOMMON: &'static [&'static str] = &[
];

const LIBPQ: &'static [&'static str] = &[
"fe-auth-scram.c",
"fe-auth.c",
"fe-connect.c",
"fe-exec.c",
"fe-lobj.c",
Expand All @@ -70,10 +110,14 @@ const LIBPQ: &'static [&'static str] = &[
"legacy-pqsignal.c",
"libpq-events.c",
"pqexpbuffer.c",
"fe-auth.c",
#[cfg(not(target_os = "windows"))]
"fe-secure-common.c",
#[cfg(not(target_os = "windows"))]
"fe-secure-openssl.c",
"fe-auth-scram.c",
#[cfg(otarget_os = "windows")]
"pthread-win32.c",
#[cfg(otarget_os = "windows")]
"win32.c",
];

fn main() {
Expand Down Expand Up @@ -129,6 +173,17 @@ fn main() {
if cfg!(target_os = "linux") {
basic_build.define("_GNU_SOURCE", None);
}
if cfg!(target_os = "macos") {
// something is broken in homebrew
// https://github.com/Homebrew/legacy-homebrew/pull/23620
basic_build.define("_FORTIFY_SOURCE", Some("0"));
}
if cfg!(target_os = "windows") {
basic_build.define("WIN32", None);
basic_build.define("_WINDOWS", None);
basic_build.define("__WIN32__", None);
basic_build.define("__WINDOWS__", None);
}

basic_build
.clone()
Expand Down
2 changes: 1 addition & 1 deletion pq-src/source
1 change: 1 addition & 0 deletions pq-src/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#[cfg(not(target_os = "windows"))]
extern crate openssl_sys;

0 comments on commit 3dd6ea4

Please sign in to comment.