From 5858b051e9eddc8e0ed87b4ff2c8aa2f6d1dcbf6 Mon Sep 17 00:00:00 2001 From: David Stoup Date: Fri, 23 Oct 2020 09:55:15 -0400 Subject: [PATCH] Fix psql patch for v12.3. Adapt to file reorganization --- Patches/PostgreSQL/12.3/CMakeLists.txt | 166 +++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Patches/PostgreSQL/12.3/CMakeLists.txt diff --git a/Patches/PostgreSQL/12.3/CMakeLists.txt b/Patches/PostgreSQL/12.3/CMakeLists.txt new file mode 100644 index 00000000..3d85486f --- /dev/null +++ b/Patches/PostgreSQL/12.3/CMakeLists.txt @@ -0,0 +1,166 @@ +cmake_minimum_required(VERSION 2.8) +project(pq) + +set(postgresql_SOURCE_DIR ${pq_SOURCE_DIR}/../../..) + +# add sources from different places in the source tree +# takes a place in the tree, and a list of sources +macro(add_sources dir) + foreach(src ${ARGN}) + list(APPEND pq_SOURCES ${dir}/${src}) + endforeach(src) +endmacro(add_sources) + +set(pq_SOURCES) + +# add sources from port dir +add_sources(../../port + chklocale.c + crypt.c + dirent.c + dirmod.c + getaddrinfo.c + inet_aton.c + inet_net_ntop.c + noblock.c + open.c + pgsleep.c + pgstrcasecmp.c + pqsignal.c + snprintf.c + strlcpy.c + system.c + thread.c + win32error.c + win32setlocale.c + ) + +#add sources from backend dir +add_sources(../../backend/libpq + pqsignal.c + ) + +#add sources from backend dir +add_sources(../../common/ + fe_memutils.c + ip.c + md5.c + ) + +# add sources from backend utils mb +add_sources(../../backend/utils/mb + wchar.c + encnames.c) + +# create .def file +file(READ ${pq_SOURCE_DIR}/libpqdll.def DEF_FILE) +string(REPLACE "LIBRARY LIBPQ" "LIBRARY PQ" DEF_FILE "${DEF_FILE}") +file(WRITE ${pq_BINARY_DIR}/pgdll.def "${DEF_FILE}") +#file(APPEND ${pq_BINARY_DIR}/pgdll.def "pg_fe_scram_init @ 177") + +# add sources in this directory +list(APPEND pq_SOURCES + fe-auth.c + fe-connect.c + fe-exec.c + fe-lobj.c + fe-misc.c + fe-print.c + fe-protocol2.c + fe-protocol3.c + fe-secure.c + libpq-events.c + pqexpbuffer.c + pthread-win32.c + win32.c + ${pq_BINARY_DIR}/pgdll.def + ) + +configure_file(${pq_SOURCE_DIR}/../../include/pg_config.h.win32 + ${pq_BINARY_DIR}/pg_config.h) +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 + ${pq_BINARY_DIR}/pg_config_os.h) +file(WRITE ${pq_BINARY_DIR}/pg_config_paths.h + "#define SYSCONFDIR \"\"") + +add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DFRONTEND -DWIN32) + +include_directories(${pq_BINARY_DIR} + ${pq_SOURCE_DIR}/../../../src/port + ${postgresql_SOURCE_DIR}/src/backend/ + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/ + ${pq_SOURCE_DIR}/../../include + ${pq_SOURCE_DIR}/../../include/utils + ${pq_SOURCE_DIR}/../../include/port/win32 + ${pq_SOURCE_DIR}/../../include/port + ${pq_SOURCE_DIR}/../../include/port/win32_msvc) + +add_library(pq ${pq_SOURCES}) +if(WIN32) + set_target_properties(pq PROPERTIES ARCHIVE_OUTPUT_NAME libpq) +endif() +target_link_libraries(pq ws2_32 Secur32) + +install(TARGETS pq + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +# +# The include installs were derived by examining CopyIncludeFiles +# in Install.pm in the PostgreSQL distribution. Server include +# files were ignored. +# +install(FILES + ${pq_BINARY_DIR}/pg_config.h + ${pq_BINARY_DIR}/pg_config_os.h + ${pq_BINARY_DIR}/pg_config_ext.h + DESTINATION include + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/include/postgres_ext.h + ${postgresql_SOURCE_DIR}/src/include/pg_config_manual.h + DESTINATION include + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/include/libpq/libpq-fs.h + DESTINATION include/libpq + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/fe-auth.h + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-fe.h + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-events.h + DESTINATION include + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-int.h + ${postgresql_SOURCE_DIR}/src/interfaces/libpq/pqexpbuffer.h + DESTINATION include/libpq/internal + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/include/c.h + ${postgresql_SOURCE_DIR}/src/include/port.h + ${postgresql_SOURCE_DIR}/src/include/postgres_fe.h + DESTINATION include/libpq/internal + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/backend/utils/errcodes.h + DESTINATION include/backend/utils/ + ) + +install(FILES + ${postgresql_SOURCE_DIR}/src/include/libpq/pqcomm.h + DESTINATION include/libpq/internal + ) + +install(DIRECTORY ${postgresql_SOURCE_DIR}/src/include/catalog + DESTINATION include/postgresql/server PATTERN "*.h" + )