Debian Codegraph @

src/pl/plperl/meson.build

raw
1 # Copyright (c) 2022-2025, PostgreSQL Global Development Group
2
3 if not perl_dep.found()
4 subdir_done()
5 endif
6
7 plperl_sources = files(
8 'plperl.c',
9 )
10
11 subppdir = run_command(perl, '-e', 'use List::Util qw(first); print first { -r "$_/ExtUtils/xsubpp" } @INC',
12 check: true).stdout()
13 xsubpp = '@0@/ExtUtils/xsubpp'.format(subppdir)
14 typemap = '@0@/ExtUtils/typemap'.format(privlibexp)
15
16 plperl_sources += custom_target('perlchunks.h',
17 input: files('plc_perlboot.pl', 'plc_trusted.pl'),
18 output: 'perlchunks.h',
19 capture: true,
20 command: [perl, files('text2macro.pl'), '@INPUT@']
21 )
22
23 plperl_sources += custom_target('plperl_opmask.h',
24 input: files('plperl_opmask.pl'),
25 output: 'plperl_opmask.h',
26 command: [perl, '@INPUT@', '@OUTPUT@']
27 )
28
29 foreach n : ['SPI', 'Util']
30 xs = files(n + '.xs')
31 xs_c_name = n + '.c'
32 xs_c = custom_target(xs_c_name,
33 input: xs,
34 output: xs_c_name,
35 command: [perl, xsubpp, '-typemap', typemap, '-output', '@OUTPUT@', '@INPUT@']
36 )
37 plperl_sources += xs_c
38 endforeach
39
40 plperl_inc = include_directories('.')
41
42 if host_system == 'windows'
43 plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
44 '--NAME', 'plperl',
45 '--FILEDESC', 'PL/Perl - procedural language',])
46 endif
47
48 plperl = shared_module('plperl',
49 plperl_sources,
50 c_pch: pch_postgres_h,
51 include_directories: [plperl_inc, postgres_inc],
52 kwargs: pg_mod_args + {
53 'dependencies': [perl_dep, pg_mod_args['dependencies']],
54 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
55 'build_rpath': '@0@/CORE'.format(archlibexp),
56 },
57 )
58 pl_targets += plperl
59
60 install_data(
61 'plperl.control',
62 'plperl--1.0.sql',
63 install_dir: dir_data_extension,
64 )
65
66 install_data(
67 'plperlu.control',
68 'plperlu--1.0.sql',
69 install_dir: dir_data_extension,
70 )
71
72 install_headers(
73 'plperl.h',
74 'plperl_system.h',
75 'ppport.h',
76 install_dir: dir_include_server,
77 )
78
79 tests += {
80 'name': 'plperl',
81 'sd': meson.current_source_dir(),
82 'bd': meson.current_build_dir(),
83 'regress': {
84 'sql': [
85 'plperl_setup',
86 'plperl',
87 'plperl_lc',
88 'plperl_trigger',
89 'plperl_shared',
90 'plperl_elog',
91 'plperl_unicode',
92 'plperl_util',
93 'plperl_init',
94 'plperlu',
95 'plperl_array',
96 'plperl_call',
97 'plperl_transaction',
98 'plperl_env',
99 ],
100 'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
101 },
102 }
103
104 subdir('po', if_found: libintl)