Skip to content

Commit 5858b05

Browse files
committed
Fix psql patch for v12.3. Adapt to file reorganization
1 parent dd70608 commit 5858b05

1 file changed

Lines changed: 166 additions & 0 deletions

File tree

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
project(pq)
3+
4+
set(postgresql_SOURCE_DIR ${pq_SOURCE_DIR}/../../..)
5+
6+
# add sources from different places in the source tree
7+
# takes a place in the tree, and a list of sources
8+
macro(add_sources dir)
9+
foreach(src ${ARGN})
10+
list(APPEND pq_SOURCES ${dir}/${src})
11+
endforeach(src)
12+
endmacro(add_sources)
13+
14+
set(pq_SOURCES)
15+
16+
# add sources from port dir
17+
add_sources(../../port
18+
chklocale.c
19+
crypt.c
20+
dirent.c
21+
dirmod.c
22+
getaddrinfo.c
23+
inet_aton.c
24+
inet_net_ntop.c
25+
noblock.c
26+
open.c
27+
pgsleep.c
28+
pgstrcasecmp.c
29+
pqsignal.c
30+
snprintf.c
31+
strlcpy.c
32+
system.c
33+
thread.c
34+
win32error.c
35+
win32setlocale.c
36+
)
37+
38+
#add sources from backend dir
39+
add_sources(../../backend/libpq
40+
pqsignal.c
41+
)
42+
43+
#add sources from backend dir
44+
add_sources(../../common/
45+
fe_memutils.c
46+
ip.c
47+
md5.c
48+
)
49+
50+
# add sources from backend utils mb
51+
add_sources(../../backend/utils/mb
52+
wchar.c
53+
encnames.c)
54+
55+
# create .def file
56+
file(READ ${pq_SOURCE_DIR}/libpqdll.def DEF_FILE)
57+
string(REPLACE "LIBRARY LIBPQ" "LIBRARY PQ" DEF_FILE "${DEF_FILE}")
58+
file(WRITE ${pq_BINARY_DIR}/pgdll.def "${DEF_FILE}")
59+
#file(APPEND ${pq_BINARY_DIR}/pgdll.def "pg_fe_scram_init @ 177")
60+
61+
# add sources in this directory
62+
list(APPEND pq_SOURCES
63+
fe-auth.c
64+
fe-connect.c
65+
fe-exec.c
66+
fe-lobj.c
67+
fe-misc.c
68+
fe-print.c
69+
fe-protocol2.c
70+
fe-protocol3.c
71+
fe-secure.c
72+
libpq-events.c
73+
pqexpbuffer.c
74+
pthread-win32.c
75+
win32.c
76+
${pq_BINARY_DIR}/pgdll.def
77+
)
78+
79+
configure_file(${pq_SOURCE_DIR}/../../include/pg_config.h.win32
80+
${pq_BINARY_DIR}/pg_config.h)
81+
configure_file(${pq_SOURCE_DIR}/../../include/pg_config_ext.h.win32
82+
${pq_BINARY_DIR}/pg_config_ext.h)
83+
configure_file(${pq_SOURCE_DIR}/../../include/port/win32.h
84+
${pq_BINARY_DIR}/pg_config_os.h)
85+
file(WRITE ${pq_BINARY_DIR}/pg_config_paths.h
86+
"#define SYSCONFDIR \"\"")
87+
88+
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DFRONTEND -DWIN32)
89+
90+
include_directories(${pq_BINARY_DIR}
91+
${pq_SOURCE_DIR}/../../../src/port
92+
${postgresql_SOURCE_DIR}/src/backend/
93+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/
94+
${pq_SOURCE_DIR}/../../include
95+
${pq_SOURCE_DIR}/../../include/utils
96+
${pq_SOURCE_DIR}/../../include/port/win32
97+
${pq_SOURCE_DIR}/../../include/port
98+
${pq_SOURCE_DIR}/../../include/port/win32_msvc)
99+
100+
add_library(pq ${pq_SOURCES})
101+
if(WIN32)
102+
set_target_properties(pq PROPERTIES ARCHIVE_OUTPUT_NAME libpq)
103+
endif()
104+
target_link_libraries(pq ws2_32 Secur32)
105+
106+
install(TARGETS pq
107+
RUNTIME DESTINATION bin
108+
LIBRARY DESTINATION lib
109+
ARCHIVE DESTINATION lib)
110+
111+
#
112+
# The include installs were derived by examining CopyIncludeFiles
113+
# in Install.pm in the PostgreSQL distribution. Server include
114+
# files were ignored.
115+
#
116+
install(FILES
117+
${pq_BINARY_DIR}/pg_config.h
118+
${pq_BINARY_DIR}/pg_config_os.h
119+
${pq_BINARY_DIR}/pg_config_ext.h
120+
DESTINATION include
121+
)
122+
123+
install(FILES
124+
${postgresql_SOURCE_DIR}/src/include/postgres_ext.h
125+
${postgresql_SOURCE_DIR}/src/include/pg_config_manual.h
126+
DESTINATION include
127+
)
128+
129+
install(FILES
130+
${postgresql_SOURCE_DIR}/src/include/libpq/libpq-fs.h
131+
DESTINATION include/libpq
132+
)
133+
134+
install(FILES
135+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/fe-auth.h
136+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-fe.h
137+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-events.h
138+
DESTINATION include
139+
)
140+
141+
install(FILES
142+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/libpq-int.h
143+
${postgresql_SOURCE_DIR}/src/interfaces/libpq/pqexpbuffer.h
144+
DESTINATION include/libpq/internal
145+
)
146+
147+
install(FILES
148+
${postgresql_SOURCE_DIR}/src/include/c.h
149+
${postgresql_SOURCE_DIR}/src/include/port.h
150+
${postgresql_SOURCE_DIR}/src/include/postgres_fe.h
151+
DESTINATION include/libpq/internal
152+
)
153+
154+
install(FILES
155+
${postgresql_SOURCE_DIR}/src/backend/utils/errcodes.h
156+
DESTINATION include/backend/utils/
157+
)
158+
159+
install(FILES
160+
${postgresql_SOURCE_DIR}/src/include/libpq/pqcomm.h
161+
DESTINATION include/libpq/internal
162+
)
163+
164+
install(DIRECTORY ${postgresql_SOURCE_DIR}/src/include/catalog
165+
DESTINATION include/postgresql/server PATTERN "*.h"
166+
)

0 commit comments

Comments
 (0)