Skip to content

Commit

Permalink
Allow explicit disabling of optional dependencies in meson builds.
Browse files Browse the repository at this point in the history
On some platforms, e.g. FreeBSD, there is a requirement to allow the user to disable support for features even when the required library is present.

Introduce tri-state options for the optional features: auto mimics the current behavior and is the default, enable requires libraries for the feature to be present, and disable disables the feature without checking the libraries.
  • Loading branch information
mschout committed Apr 9, 2024
1 parent dab5273 commit 7b95fd3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions doc/xml/release/2024/2.52.xml
@@ -1,6 +1,17 @@
<release date="XXXX-XX-XX" version="2.52dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-improvement-list>
<release-item>
<github-pull-request id="2321"/>

<release-item-contributor-list>
<release-item-contributor id="michael.schout"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>

<p>Allow explicit disabling of optional dependencies in meson builds.</p>
</release-item>

<release-item>
<github-pull-request id="2312"/>

Expand Down
6 changes: 3 additions & 3 deletions meson.build
Expand Up @@ -144,7 +144,7 @@ endif
lib_bz2 = cc.find_library('bz2')

# Find optional lz4 library
lib_lz4 = dependency('liblz4', required: false)
lib_lz4 = dependency('liblz4', required: get_option('liblz4'))

if lib_lz4.found()
configuration.set('HAVE_LIBLZ4', true, description: 'Is liblz4 present?')
Expand All @@ -168,14 +168,14 @@ lib_z = dependency('zlib')
configuration.set('ZLIB_CONST', true, description: 'Require zlib const input buffer')

# Find optional libssh2 library
lib_ssh2 = dependency('libssh2', required: false)
lib_ssh2 = dependency('libssh2', required: get_option('libssh2'))

if lib_ssh2.found()
configuration.set('HAVE_LIBSSH2', true, description: 'Is libssh2 present?')
endif

# Find optional zstd library
lib_zstd = dependency('libzstd', version: '>=1.0', required: false)
lib_zstd = dependency('libzstd', version: '>=1.0', required: get_option('libzstd'))

if lib_zstd.found()
configuration.set('HAVE_LIBZST', true, description: 'Is libzstd present?')
Expand Down
3 changes: 3 additions & 0 deletions meson_options.txt
@@ -1,2 +1,5 @@
option('configdir', type: 'string', value: '/etc/pgbackrest', description: 'Configuration directory')
option('fatal-errors', type: 'boolean', value: false, description: 'Stop compilation on first error')
option('liblz4', type: 'feature', value: 'auto', description: 'Enable LZ4 compression support')
option('libssh2', type: 'feature', value: 'auto', description: 'Enable SFTP storage support')
option('libzstd', type: 'feature', value: 'auto', description: 'Enable Zstandard compression support')

0 comments on commit 7b95fd3

Please sign in to comment.