Debian Codegraph @

src/interfaces/libpq-oauth/meson.build

raw
1 # Copyright (c) 2022-2025, PostgreSQL Global Development Group
2
3 if not oauth_flow_supported
4 subdir_done()
5 endif
6
7 libpq_oauth_sources = files(
8 'oauth-curl.c',
9 )
10
11 # The shared library needs additional glue symbols.
12 libpq_oauth_so_sources = files(
13 'oauth-utils.c',
14 )
15 libpq_oauth_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
16
17 export_file = custom_target('libpq-oauth.exports',
18 kwargs: gen_export_kwargs,
19 )
20
21 # port needs to be in include path due to pthread-win32.h
22 libpq_oauth_inc = include_directories('.', '../libpq', '../../port')
23
24 libpq_oauth_st = static_library('libpq-oauth',
25 libpq_oauth_sources,
26 include_directories: [libpq_oauth_inc, postgres_inc],
27 c_pch: pch_postgres_fe_h,
28 dependencies: [
29 frontend_stlib_code,
30 libpq_oauth_deps,
31 ssl, # libpq-int.h includes OpenSSL headers
32 ],
33 kwargs: default_lib_args,
34 )
35
36 # This is an internal module; we don't want an SONAME and therefore do not set
37 # SO_MAJOR_VERSION.
38 libpq_oauth_name = 'libpq-oauth-@0@'.format(pg_version_major)
39
40 libpq_oauth_so = shared_module(libpq_oauth_name,
41 libpq_oauth_sources + libpq_oauth_so_sources,
42 include_directories: [libpq_oauth_inc, postgres_inc],
43 c_args: libpq_oauth_so_c_args,
44 c_pch: pch_postgres_fe_h,
45 dependencies: [frontend_shlib_code, libpq, libpq_oauth_deps],
46 link_depends: export_file,
47 link_args: export_fmt.format(export_file.full_path()),
48 kwargs: default_lib_args,
49 )
50
51 libpq_oauth_test_deps = []
52
53 oauth_test_sources = files('test-oauth-curl.c') + libpq_oauth_so_sources
54
55 if host_system == 'windows'
56 oauth_test_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
57 '--NAME', 'oauth_tests',
58 '--FILEDESC', 'OAuth unit test program',])
59 endif
60
61 libpq_oauth_test_deps += executable('oauth_tests',
62 oauth_test_sources,
63 dependencies: [frontend_shlib_code, libpq, libpq_oauth_deps],
64 kwargs: default_bin_args + {
65 'c_args': default_bin_args.get('c_args', []) + libpq_oauth_so_c_args,
66 'c_pch': pch_postgres_fe_h,
67 'include_directories': [libpq_inc, postgres_inc],
68 'install': false,
69 }
70 )
71
72 testprep_targets += libpq_oauth_test_deps
73
74 tests += {
75 'name': 'libpq-oauth',
76 'sd': meson.current_source_dir(),
77 'bd': meson.current_build_dir(),
78 'tap': {
79 'tests': [
80 't/001_oauth.pl',
81 ],
82 'deps': libpq_oauth_test_deps,
83 },
84 }