36.20. postgresql-extension.pc #

When Postgres is built by using meson, it generates postgresql-extension.pc pkg-config file. Extension libraries can use this file like PGXS (Section 36.19). To use the postgresql-extension.pc infrastructure for your extension, you must write a simple meson.build file. In the meson.build file, you need to include the postgresql-extension.pc pkg-config file. Here is an example that builds an extension module named isbn_issn, consisting of a shared library containing some C code, an extension control file, an SQL script, an include file (only needed if other modules might need to access the extension functions without going via SQL), and a documentation text file:

project('isbn_issn', 'c')

pg_ext = dependency('postgresql-extension-warnings')

isbn_issn_sources = files('isbn_issn.c')

isbn_issn = shared_module('isbn_issn',
  isbn_issn_sources,
  dependencies: pg_ext,
  install_dir: pg_ext.get_variable(pkgconfig: 'dir_mod'),
)

install_data(
     'isbn_issn.control',
     'isbn_issn--1.0.sql',
     install_dir: pg_ext.get_variable(pkgconfig: 'dir_data'),
)

install_headers(
     'isbn_issn.h',
     install_dir: pg_ext.get_variable(pkgconfig: 'dir_include'),
)

install_data(
     'README.isbn_issn',
     install_dir: pg_ext.get_variable(pkgconfig: 'dir_doc'),
)