* Update PostgreSQL lib version and fix resource cleanup - update the bundled PostgreSQL/libpq headers and static libraries to 18.4 (resolve #1802) - adjust pgsql extension link inputs for the newer libpq split libraries, and drop unsupported macOS pgsql builds - build connection parameters with instead of manually formatting a connection string - make own and clear its , preventing leaks when prepared statements are executed repeatedly - close prepared statements with when statement handles are destroyed - track copied vs borrowed prepared-statement parameter buffers so borrowed strings/blobs are not freed (resolve #1946) * Rebuild libs --------- Co-authored-by: Nicholas Hastings <[email protected]>
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
|
import os
|
|
|
|
for cxx in builder.targets:
|
|
arch = cxx.target.arch
|
|
binary = SM.ExtLibrary(builder, cxx, 'dbi.pgsql.ext')
|
|
compiler = binary.compiler
|
|
compiler.cxxincludes += [
|
|
os.path.join(SM.mms_root, 'core', 'sourcehook')
|
|
]
|
|
if compiler.family == 'gcc' or compiler.family == 'clang':
|
|
compiler.cxxflags += ['-fno-rtti']
|
|
elif compiler.family == 'msvc':
|
|
compiler.cxxflags += ['/GR-']
|
|
|
|
if compiler.target.platform == 'linux':
|
|
compiler.postlink += [
|
|
'-lpthread',
|
|
'-lm'
|
|
]
|
|
if compiler.target.platform == 'linux':
|
|
if arch == 'x86':
|
|
path = os.path.join(builder.sourcePath, 'extensions', 'pgsql', 'lib_linux')
|
|
elif arch == 'x86_64':
|
|
path = os.path.join(builder.sourcePath, 'extensions', 'pgsql', 'lib_linux64')
|
|
compiler.postlink += [
|
|
os.path.join(path, 'libpq.a'),
|
|
os.path.join(path, 'libpgcommon_shlib.a'),
|
|
os.path.join(path, 'libpgport_shlib.a'),
|
|
]
|
|
elif compiler.target.platform == 'windows':
|
|
if arch == 'x86':
|
|
path = os.path.join(builder.sourcePath, 'extensions', 'pgsql', 'lib_win')
|
|
elif arch == 'x86_64':
|
|
path = os.path.join(builder.sourcePath, 'extensions', 'pgsql', 'lib_win64')
|
|
compiler.postlink += [
|
|
os.path.join(path, 'libpq.lib'),
|
|
os.path.join(path, 'libpgcommon_shlib.lib'),
|
|
os.path.join(path, 'libpgport_shlib.lib'),
|
|
'wsock32.lib',
|
|
'ws2_32.lib',
|
|
'secur32.lib',
|
|
'wldap32.lib',
|
|
'advapi32.lib',
|
|
'shell32.lib'
|
|
]
|
|
elif compiler.target.platform == 'mac': # mac isn't supported
|
|
continue
|
|
|
|
compiler.cxxincludes += [path]
|
|
|
|
binary.sources += [
|
|
os.path.join('..', '..', 'public', 'smsdk_ext.cpp'),
|
|
os.path.join('pgsql', 'PgBasicResults.cpp'),
|
|
os.path.join('pgsql', 'PgDatabase.cpp'),
|
|
os.path.join('pgsql', 'PgDriver.cpp'),
|
|
os.path.join('pgsql', 'PgStatement.cpp'),
|
|
'extension.cpp'
|
|
]
|
|
SM.extensions += [builder.Add(binary)]
|