summaryrefslogtreecommitdiff
path: root/src/pl/plperl/meson.build
blob: 6a28f40a119c947faecd2023696855db0ac6e31e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright (c) 2022-2023, PostgreSQL Global Development Group

if not perl_dep.found()
  subdir_done()
endif

plperl_sources = files(
  'plperl.c',
)

subppdir = run_command(perl, '-e', 'use List::Util qw(first); print first { -r "$_/ExtUtils/xsubpp" } @INC',
  check: true).stdout()
xsubpp = '@0@/ExtUtils/xsubpp'.format(subppdir)
typemap = '@0@/ExtUtils/typemap'.format(privlibexp)

plperl_sources += custom_target('perlchunks.h',
  input: files('plc_perlboot.pl', 'plc_trusted.pl'),
  output: 'perlchunks.h',
  capture: true,
  command: [perl, files('text2macro.pl'), '--strip=^(\#.*|\s*)$', '@INPUT@']
)

plperl_sources += custom_target('plperl_opmask.h',
  input: files('plperl_opmask.pl'),
  output: 'plperl_opmask.h',
  command: [perl, '@INPUT@', '@OUTPUT@']
)

foreach n : ['SPI', 'Util']
  xs = files(n + '.xs')
  xs_c_name = n + '.c'
  xs_c = custom_target(xs_c_name,
    input: xs,
    output: xs_c_name,
    command: [perl, xsubpp, '-typemap', typemap, '-output', '@OUTPUT@', '@INPUT@']
  )
  plperl_sources += xs_c
endforeach

plperl_inc = include_directories('.')

if host_system == 'windows'
  plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
    '--NAME', 'plperl',
    '--FILEDESC', 'PL/Perl - procedural language',])
endif

plperl = shared_module('plperl',
  plperl_sources,
  c_pch: pch_postgres_h,
  include_directories: [plperl_inc, postgres_inc],
  kwargs: pg_mod_args + {
    'dependencies': [perl_dep, pg_mod_args['dependencies']],
    'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
    'build_rpath': '@0@/CORE'.format(archlibexp),
  },
)
pl_targets += plperl

install_data(
  'plperl.control',
  'plperl--1.0.sql',
  install_dir: dir_data_extension,
)

install_data(
  'plperlu.control',
  'plperlu--1.0.sql',
  install_dir: dir_data_extension,
)

install_headers(
  'plperl.h',
  'ppport.h',
  install_dir: dir_include_server,
)

tests += {
  'name': 'plperl',
  'sd': meson.current_source_dir(),
  'bd': meson.current_build_dir(),
  'regress': {
    'sql': [
      'plperl_setup',
      'plperl',
      'plperl_lc',
      'plperl_trigger',
      'plperl_shared',
      'plperl_elog',
      'plperl_util',
      'plperl_init',
      'plperlu',
      'plperl_array',
      'plperl_call',
      'plperl_transaction',
    ],
  },
}

subdir('po', if_found: libintl)