File: _meson.build

package info (click to toggle)
plr 1%3A8.4.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,172 kB
  • sloc: ansic: 4,742; sql: 629; sh: 357; makefile: 78; perl: 20
file content (89 lines) | stat: -rw-r--r-- 2,298 bytes parent folder | download
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
project('plr', 'c',
  version : '8_4_8',
  license : 'GNU Public License Version 2',
)

R_home = get_option('R_HOME')
if R_home == ''
  error('One must supply: -DR_HOME=newvalue')
endif

pg_home = get_option('PG_HOME')
if pg_home == ''
  error('One must supply: -DPG_HOME=newvalue')
endif

plr_sources = files(
  'plr.c',
  'pg_conversion.c',
  'pg_backend_support.c',
  'pg_userfuncs.c',
  'pg_rsupport.c',
)

plr_deps = []
dep_libR = dependency('libR', required : true)
plr_deps += dep_libR
dep_libpq = dependency('libpq', required : true)
plr_deps += dep_libpq
dep_libpostgres = dependency('libpostgres', required : true)
plr_deps += dep_libpostgres

plr_incdir = []
pg_incdir1= include_directories(R_home / 'include')
plr_incdir += pg_incdir1
pg_incdir2 = include_directories(pg_home / 'include' / 'postgresql' / 'server' )
plr_incdir += pg_incdir2
#  mingw
pg_incdir3 = include_directories(pg_home / 'include' / 'postgresql' / 'server' / 'port' / 'win32' )
plr_incdir += pg_incdir3

# Refactor DLSUFFIX handling (PostreSQL 15 AND newer)
# https://github.com/postgres/postgres/commit/23119d51a14c046dae35ae5e6ad9e35982d044fd
#
# PostgreSQL 14 and older
# USE_PGXS=1 make CPPFLAGS=-DDLSUFFIX=\".so\"
# https://github.com/postgres-plr/plr/issues/4
#
plr_c_args = []
#
# Detect MinGW host #8776
# https://github.com/mesonbuild/meson/issues/8776
#
# Operating system names
# https://mesonbuild.com/Reference-tables.html#operating-system-names
#
if ((host_machine.system() == 'windows') or (host_machine.system()  == 'cygwin'))
  message('begin -DDLSUFFIX=".dll"')
  dlsuffix = '-DDLSUFFIX=".dll"'
  message('end   -DDLSUFFIX=".dll"')
endif

if host_machine.system() == 'linux'
  dlsuffix = '-DDLSUFFIX=".so"'
endif
if host_machine.system() == 'darwin'
  dlsuffix = '-DDLSUFFIX=".dylib"'
endif
plr_c_args += dlsuffix

plr = shared_module('plr',
  plr_sources,
  c_args: plr_c_args,
  name_prefix : '',
  include_directories: plr_incdir,
  dependencies: plr_deps,
)

if meson.version().version_compare('>=0.57')

  summary(
    {
      'libR'               : dep_libR,
      'libpq'              : dep_libpq,
      'libpostgres (fake)' : dep_libpostgres,
    },
    section: 'Required Dependencies',
  )

endif