From ccae9cad8ce58f9529ccae450793480226bc9ca7 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 10 Nov 2023 08:59:07 +0100 Subject: [PATCH] Try to get a proper build log --- .github/workflows/ci.yml | 17 +++++++++++++++++ .gitmodules | 2 +- pq-src/additional_include/pg_config.h | 13 +++++++++++++ pq-src/build.rs | 26 ++++++++++++++++++++++++++ pq-src/source | 2 +- 5 files changed, 58 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f315e35..e418cb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,22 @@ 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/setup-msbuild@v1.3 + with: + msbuild-architecture: x64 + - 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 + cd pq-src/source/ + dir + which msbuild + ./src/tools/msvc/build.bat libpq - name: Install rust toolchain uses: dtolnay/rust-toolchain@stable @@ -70,6 +86,7 @@ jobs: shell: bash run: | cargo test --no-default-features --features "${{ matrix.features }}" + - name: Test compile diesel shell: bash run: | diff --git a/.gitmodules b/.gitmodules index b5eb492..e00e12f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "pq-src/source"] path = pq-src/source - url = https://github.com/postgres/postgres + url = https://github.com/weiznich/postgres diff --git a/pq-src/additional_include/pg_config.h b/pq-src/additional_include/pg_config.h index 07c1bcb..cbd5c55 100644 --- a/pq-src/additional_include/pg_config.h +++ b/pq-src/additional_include/pg_config.h @@ -68,15 +68,22 @@ /* Define to 1 if you have the 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 header file. */ #define HAVE_STRINGS_H 1 +#endif + /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 @@ -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 @@ -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 diff --git a/pq-src/build.rs b/pq-src/build.rs index 9e49ee8..0f3bca4 100644 --- a/pq-src/build.rs +++ b/pq-src/build.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; const LIBPORTS: &'static [&'static str] = &[ + #[cfg(target_os = "linux")] "getpeereid.c", "strlcat.c", "strlcpy.c", @@ -8,11 +9,15 @@ const LIBPORTS: &'static [&'static str] = &[ "pg_crc32c_sb8.c", "bsearch_arg.c", "chklocale.c", + #[cfg(not(target_os = "windows"))] "inet_net_ntop.c", "noblock.c", "pg_bitutils.c", + #[cfg(not(target_os = "windows"))] "pg_strong_random.c", + #[cfg(not(target_os = "windows"))] "pgcheckdir.c", + #[cfg(not(target_os = "windows"))] "pgmkdirp.c", "pgsleep.c", "pgstrcasecmp.c", @@ -22,14 +27,19 @@ 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", ]; const LIBCOMMON: &'static [&'static str] = &[ "file_perm.c", + #[cfg(not(target_os = "windows"))] "encnames.c", "base64.c", "scram-common.c", + #[cfg(not(target_os = "windows"))] "ip.c", "jsonapi.c", "kwlookup.c", @@ -39,22 +49,30 @@ const LIBCOMMON: &'static [&'static str] = &[ "pg_get_line.c", "pg_lzcompress.c", "pg_prng.c", + #[cfg(not(target_os = "windows"))] "pgfnames.c", "psprintf.c", + #[cfg(not(target_os = "windows"))] "rmtree.c", "saslprep.c", "string.c", "stringinfo.c", "unicode_norm.c", + #[cfg(not(target_os = "windows"))] "username.c", + #[cfg(not(target_os = "windows"))] "wait_error.c", "wchar.c", + #[cfg(not(target_os = "windows"))] "cryptohash_openssl.c", + #[cfg(not(target_os = "windows"))] "hmac_openssl.c", + #[cfg(not(target_os = "windows"))] "protocol_openssl.c", "fe_memutils.c", "restricted_token.c", "sprompt.c", + #[cfg(not(target_os = "windows"))] "logging.c", ]; @@ -129,6 +147,14 @@ 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 .clone() diff --git a/pq-src/source b/pq-src/source index c372fbb..9837d6a 160000 --- a/pq-src/source +++ b/pq-src/source @@ -1 +1 @@ -Subproject commit c372fbbd8e911f2412b80a8c39d7079366565d67 +Subproject commit 9837d6a4726bec939c0e96896005b881bbc8d8fd