mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
meson: ecpg: Split definition of static and shared libraries
Required for correct resource file generation, as the resource files should only be added to the shared library. This also fixes a bunch of issues in the .pc files. Previously I tried to avoid building sources twice, once for the static and once for the shared libraries. We could still do so, but it's not clear that it's worth the complication. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de
This commit is contained in:
parent
089c0bc7a7
commit
a1261cd16f
@ -1,11 +1,29 @@
|
||||
export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
|
||||
|
||||
ecpg_compat = both_libraries('libecpg_compat',
|
||||
ecpg_compat_sources = files(
|
||||
'informix.c',
|
||||
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
|
||||
c_args: ['-DSO_MAJOR_VERSION=3'],
|
||||
dependencies: [frontend_code, thread_dep],
|
||||
link_with: [ecpglib, ecpg_pgtypes],
|
||||
)
|
||||
ecpg_compat_so_sources = [] # for shared lib, in addition to the above
|
||||
|
||||
ecpg_compat_inc = [include_directories('.'), ecpg_inc, libpq_inc]
|
||||
ecpg_compat_c_args = ['-DSO_MAJOR_VERSION=3']
|
||||
export_file = custom_target('libecpg_compat.exports', kwargs: gen_export_kwargs)
|
||||
|
||||
# see src/interfaces/libpq/meson.build
|
||||
ecpg_compat_st = static_library('libecpg_compat',
|
||||
ecpg_compat_sources,
|
||||
include_directories: ecpg_compat_inc,
|
||||
c_args: ecpg_compat_c_args,
|
||||
dependencies: [frontend_stlib_code, thread_dep],
|
||||
link_with: [ecpglib_st, ecpg_pgtypes_st],
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += ecpg_compat_st
|
||||
|
||||
ecpg_compat_so = shared_library('libecpg_compat',
|
||||
ecpg_compat_sources + ecpg_compat_so_sources,
|
||||
include_directories: ecpg_compat_inc,
|
||||
c_args: ecpg_compat_c_args,
|
||||
dependencies: [frontend_shlib_code, thread_dep],
|
||||
link_with: [ecpglib_so, ecpg_pgtypes_so],
|
||||
soversion: host_system != 'windows' ? '3' : '',
|
||||
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
|
||||
version: '3.' + pg_version_major.to_string(),
|
||||
@ -13,10 +31,13 @@ ecpg_compat = both_libraries('libecpg_compat',
|
||||
link_depends: export_file,
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += [ecpg_compat.get_shared_lib(), ecpg_compat.get_static_lib()]
|
||||
ecpg_targets += ecpg_compat_so
|
||||
|
||||
pkgconfig.generate(
|
||||
ecpg_compat.get_shared_lib(),
|
||||
name: 'libecpg_compat',
|
||||
description: 'PostgreSQL libecpg_compat library',
|
||||
url: pg_url,
|
||||
libraries: ecpg_compat_so,
|
||||
libraries_private: [frontend_stlib_code, thread_dep],
|
||||
requires_private: ['libecpg', 'libpgtypes'],
|
||||
)
|
||||
|
@ -10,15 +10,29 @@ ecpglib_sources = files(
|
||||
'sqlda.c',
|
||||
'typename.c',
|
||||
)
|
||||
ecpglib_so_sources = [] # for shared lib, in addition to the above
|
||||
|
||||
export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
|
||||
ecpglib_inc = [include_directories('.'), ecpg_inc]
|
||||
ecpglib_c_args = ['-DSO_MAJOR_VERSION=6']
|
||||
export_file = custom_target('libecpg.exports', kwargs: gen_export_kwargs)
|
||||
|
||||
ecpglib = both_libraries('libecpg',
|
||||
# see src/interfaces/libpq/meson.build
|
||||
ecpglib_st = static_library('libecpg',
|
||||
ecpglib_sources,
|
||||
include_directories: ['.', ecpg_inc, postgres_inc],
|
||||
c_args: ['-DSO_MAJOR_VERSION=6'],
|
||||
dependencies: [frontend_code, libpq, thread_dep],
|
||||
link_with: [ecpg_pgtypes],
|
||||
include_directories: ecpglib_inc,
|
||||
c_args: ecpglib_c_args,
|
||||
dependencies: [frontend_stlib_code, thread_dep, libpq],
|
||||
link_with: [ecpg_pgtypes_st],
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += ecpglib_st
|
||||
|
||||
ecpglib_so = shared_library('libecpg',
|
||||
ecpglib_sources + ecpglib_so_sources,
|
||||
include_directories: ecpglib_inc,
|
||||
c_args: ecpglib_c_args,
|
||||
dependencies: [frontend_shlib_code, libpq, thread_dep],
|
||||
link_with: ecpg_pgtypes_so,
|
||||
soversion: host_system != 'windows' ? '6' : '',
|
||||
darwin_versions: ['6', '6.' + pg_version_major.to_string()],
|
||||
version: '6.' + pg_version_major.to_string(),
|
||||
@ -26,12 +40,15 @@ ecpglib = both_libraries('libecpg',
|
||||
link_depends: export_file,
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += [ecpglib.get_shared_lib(), ecpglib.get_static_lib()]
|
||||
ecpg_targets += ecpglib_so
|
||||
|
||||
pkgconfig.generate(
|
||||
ecpglib.get_shared_lib(),
|
||||
name: 'libecpg',
|
||||
description: 'PostgreSQL libecpg library',
|
||||
url: pg_url,
|
||||
libraries: ecpglib_so,
|
||||
libraries_private: [frontend_shlib_code, thread_dep],
|
||||
requires_private: ['libpgtypes', 'libpq'],
|
||||
)
|
||||
|
||||
subdir('po', if_found: libintl)
|
||||
|
@ -6,14 +6,27 @@ ecpg_pgtypes_sources = files(
|
||||
'numeric.c',
|
||||
'timestamp.c',
|
||||
)
|
||||
ecpg_pgtypes_so_sources = [] # for shared lib, in addition to the above
|
||||
|
||||
export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
|
||||
export_file = custom_target('libpgtypes.exports', kwargs: gen_export_kwargs)
|
||||
ecpg_pgtypes_inc = [include_directories('.'), ecpg_inc]
|
||||
ecpg_pgtypes_c_args = ['-DSO_MAJOR_VERSION=3']
|
||||
|
||||
ecpg_pgtypes = both_libraries('libpgtypes',
|
||||
# see src/interfaces/libpq/meson.build
|
||||
ecpg_pgtypes_st = static_library('libpgtypes',
|
||||
ecpg_pgtypes_sources,
|
||||
include_directories: ['.', ecpg_inc, postgres_inc],
|
||||
c_args: ['-DSO_MAJOR_VERSION=3'],
|
||||
dependencies: [frontend_code],
|
||||
include_directories: ecpg_pgtypes_inc,
|
||||
c_args: ecpg_pgtypes_c_args,
|
||||
dependencies: frontend_stlib_code,
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += ecpg_pgtypes_st
|
||||
|
||||
ecpg_pgtypes_so = shared_library('libpgtypes',
|
||||
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
|
||||
include_directories: ecpg_pgtypes_inc,
|
||||
c_args: ecpg_pgtypes_c_args,
|
||||
dependencies: frontend_shlib_code,
|
||||
version: '3.' + pg_version_major.to_string(),
|
||||
soversion: host_system != 'windows' ? '3' : '',
|
||||
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
|
||||
@ -21,10 +34,12 @@ ecpg_pgtypes = both_libraries('libpgtypes',
|
||||
link_depends: export_file,
|
||||
kwargs: default_lib_args,
|
||||
)
|
||||
ecpg_targets += [ecpg_pgtypes.get_shared_lib(), ecpg_pgtypes.get_static_lib()]
|
||||
ecpg_targets += ecpg_pgtypes_so
|
||||
|
||||
pkgconfig.generate(
|
||||
ecpg_pgtypes.get_shared_lib(),
|
||||
name: 'libpgtypes',
|
||||
description: 'PostgreSQL libpgtypes library',
|
||||
url: pg_url,
|
||||
libraries: ecpg_pgtypes_so,
|
||||
libraries_private: [frontend_stlib_code],
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ testprep_targets += pg_regress_ecpg
|
||||
ecpg_test_exec_kw = {
|
||||
'dependencies': [frontend_code, libpq],
|
||||
'include_directories': [ecpg_inc],
|
||||
'link_with': [ecpglib, ecpg_compat, ecpg_pgtypes],
|
||||
'link_with': [ecpglib_so, ecpg_compat_so, ecpg_pgtypes_so],
|
||||
'build_by_default': false,
|
||||
'install': false,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user