Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions CMake/fletch-tarballs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ list(APPEND fletch_external_sources GeographicLib )
# PostgreSQL
if (fletch_ENABLE_PostgreSQL OR fletch_ENABLE_ALL_PACKAGES)
set(PostgreSQL_SELECT_VERSION 9.5.1 CACHE STRING "Select the major version of PostgreSQL to build.")
set_property(CACHE PostgreSQL_SELECT_VERSION PROPERTY STRINGS "9.5.1" "10.2")
set_property(CACHE PostgreSQL_SELECT_VERSION PROPERTY STRINGS "9.5.1" "10.2" "10.23")
message(STATUS "PostgreSQL Select version: ${PostgreSQL_SELECT_VERSION}")

if (PostgreSQL_SELECT_VERSION VERSION_EQUAL 9.5.1)
Expand All @@ -498,10 +498,15 @@ if (fletch_ENABLE_PostgreSQL OR fletch_ENABLE_ALL_PACKAGES)
set(PostgreSQL_url "https://data.kitware.com/api/v1/file/6622b260df5a87675edbc0d6/download/postgresql.${PostgreSQL_version}.tar.bz2")
set(PostgreSQL_md5 "11e037afaa4bd0c90bb3c3d955e2b401")
elseif(PostgreSQL_SELECT_VERSION VERSION_EQUAL 10.2)
# PostgreSQL 9.4
# PostgreSQL 10.2
set(PostgreSQL_version ${PostgreSQL_SELECT_VERSION})
set(PostgreSQL_url "https://data.kitware.com/api/v1/file/6622b26adf5a87675edbc0d9/download/postgresql.${PostgreSQL_version}.tar.bz2")
set(PostgreSQL_md5 "e97c3cc72bdf661441f29069299b260a")
elseif(PostgreSQL_SELECT_VERSION VERSION_EQUAL 10.23)
# PostgreSQL 10.23
set(PostgreSQL_version ${PostgreSQL_SELECT_VERSION})
set(PostgreSQL_url "https://data.kitware.com/api/v1/file/6837c50a22b9eb620eac12c3/download/postgresql.${PostgreSQL_version}.tar.bz2")
set(PostgreSQL_md5 "9dee14aaa9843206d20a952be465e01e")
else()
message(STATUS "PostgreSQL_SELECT_VERSION: Not supported")
endif()
Expand Down
36 changes: 33 additions & 3 deletions Patches/PostgreSQL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,27 @@ add_sources(../../port
system.c
win32error.c
win32setlocale.c
pg_strong_random.c
)

#add sources from backend dir
add_sources(../../backend/libpq
md5.c
ip.c)
if(EXISTS ../../backend/libpq/md5.c)
# PostgreSQL 9
add_sources(../../backend/libpq
md5.c
ip.c)
else()
# PostgreSQL 10
add_sources(../../common
md5.c
ip.c
base64.c
scram-common.c
sha2.c
saslprep.c
unicode_norm.c
)
endif()

#add sources from backend dir
add_sources(../../common/
Expand All @@ -60,6 +75,7 @@ file(WRITE ${pq_BINARY_DIR}/pgdll.def "${DEF_FILE}")
list(APPEND pq_SOURCES
win32.c
fe-auth.c
fe-auth-scram.c
fe-protocol2.c
fe-protocol3.c
fe-connect.c
Expand All @@ -76,6 +92,20 @@ list(APPEND pq_SOURCES

configure_file(${pq_SOURCE_DIR}/../../include/pg_config.h.win32
${pq_BINARY_DIR}/pg_config.h)

# Add missing BLCKSZ and XLOG_BLCKSZ definitions required by PostgreSQL 10+
# These are needed by c.h for PGAlignedBlock and PGAlignedXLogBlock structs
file(APPEND ${pq_BINARY_DIR}/pg_config.h "

/* Size of a disk block --- this also limits the size of a tuple.
BLCKSZ must be a power of 2. Default is 8192 (8KB). */
#define BLCKSZ 8192

/* Size of a WAL file block. XLOG_BLCKSZ must be a power of 2.
Default is 8192 (8KB). */
#define XLOG_BLCKSZ 8192
")

configure_file(${pq_SOURCE_DIR}/../../include/pg_config_ext.h.win32
${pq_BINARY_DIR}/pg_config_ext.h)
configure_file(${pq_SOURCE_DIR}/../../include/port/win32.h
Expand Down