| 1 |
# Copyright (c) 2022-2025, PostgreSQL Global Development Group |
| 2 |
|
| 3 |
ecpg_sources = files( |
| 4 |
'../ecpglib/typename.c', |
| 5 |
'c_keywords.c', |
| 6 |
'descriptor.c', |
| 7 |
'ecpg.c', |
| 8 |
'ecpg_keywords.c', |
| 9 |
'keywords.c', |
| 10 |
'output.c', |
| 11 |
'parser.c', |
| 12 |
'type.c', |
| 13 |
'util.c', |
| 14 |
'variable.c', |
| 15 |
) |
| 16 |
|
| 17 |
pgc = custom_target('pgc.c', |
| 18 |
input: 'pgc.l', |
| 19 |
output: 'pgc.c', |
| 20 |
command: flex_cmd, |
| 21 |
) |
| 22 |
generated_sources += pgc |
| 23 |
ecpg_sources += pgc |
| 24 |
|
| 25 |
ecpg_files = [ |
| 26 |
'ecpg.addons', |
| 27 |
'ecpg.header', |
| 28 |
'ecpg.tokens', |
| 29 |
'ecpg.trailer', |
| 30 |
'ecpg.type', |
| 31 |
] |
| 32 |
|
| 33 |
preproc_y = custom_target('preproc.y', |
| 34 |
input: [ |
| 35 |
'../../../backend/parser/gram.y', |
| 36 |
ecpg_files, |
| 37 |
], |
| 38 |
output: ['preproc.y'], |
| 39 |
command: [ |
| 40 |
perl, files('parse.pl'), |
| 41 |
'--srcdir', '@CURRENT_SOURCE_DIR@', |
| 42 |
'--parser', '@INPUT0@', |
| 43 |
'--output', '@OUTPUT0@', |
| 44 |
], |
| 45 |
) |
| 46 |
generated_sources += preproc_y |
| 47 |
|
| 48 |
preproc = custom_target('preproc.c', |
| 49 |
input: preproc_y, |
| 50 |
kwargs: bison_kw, |
| 51 |
) |
| 52 |
generated_sources += preproc.to_list() |
| 53 |
ecpg_sources += preproc |
| 54 |
|
| 55 |
c_kwlist = custom_target('c_kwlist_d.h', |
| 56 |
input: ['c_kwlist.h'], |
| 57 |
output: ['c_kwlist_d.h'], |
| 58 |
depend_files: gen_kwlist_deps, |
| 59 |
command: [gen_kwlist_cmd, '--varname', 'ScanCKeywords', '--no-case-fold'], |
| 60 |
) |
| 61 |
generated_sources += c_kwlist |
| 62 |
ecpg_sources += c_kwlist |
| 63 |
|
| 64 |
ecpg_kwlist = custom_target('ecpg_kwlist_d.h', |
| 65 |
input: ['ecpg_kwlist.h'], |
| 66 |
output: ['ecpg_kwlist_d.h'], |
| 67 |
depend_files: gen_kwlist_deps, |
| 68 |
command: [gen_kwlist_cmd, '--varname', 'ScanECPGKeywords'], |
| 69 |
) |
| 70 |
generated_sources += ecpg_kwlist |
| 71 |
ecpg_sources += ecpg_kwlist |
| 72 |
|
| 73 |
if host_system == 'windows' |
| 74 |
ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ |
| 75 |
'--NAME', 'ecpg', |
| 76 |
'--FILEDESC', 'ecpg - embedded SQL precompiler for C',]) |
| 77 |
endif |
| 78 |
|
| 79 |
ecpg_exe = executable('ecpg', |
| 80 |
ecpg_sources, |
| 81 |
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc], |
| 82 |
c_pch: pch_postgres_fe_h, |
| 83 |
dependencies: [frontend_code], |
| 84 |
kwargs: default_bin_args, |
| 85 |
) |
| 86 |
ecpg_targets += ecpg_exe |
| 87 |
|
| 88 |
subdir('po', if_found: libintl) |
| 89 |
|
| 90 |
tests += { |
| 91 |
'name': 'ecpg', |
| 92 |
'sd': meson.current_source_dir(), |
| 93 |
'bd': meson.current_build_dir(), |
| 94 |
'tap': { |
| 95 |
'tests': [ |
| 96 |
't/001_ecpg_err_warn_msg.pl', |
| 97 |
't/002_ecpg_err_warn_msg_informix.pl', |
| 98 |
], |
| 99 |
'deps': [ecpg_exe], |
| 100 |
}, |
| 101 |
} |