Use meson's "feature" build option

This commit is contained in:
Sebastian Ramacher 2018-11-27 20:55:16 +01:00
parent a428e19b15
commit 886649dfbf
3 changed files with 32 additions and 31 deletions

12
README
View file

@ -7,7 +7,7 @@ girara user interface library and several document libraries.
Requirements
------------
meson (>= 0.45)
meson (>= 0.47)
gtk3 (>= 3.22)
glib (>= 2.50)
girara (>= 0.2.8)
@ -23,17 +23,17 @@ breathe (optional, for HTML documentation)
sphinx_rtd_theme (optional, for HTML documentation)
Note that Sphinx is needed to build the manpages. If it is not installed, the
man pages won't be built. For the HTML documentation, doxygen, breathe and
sphinx_rtd_theme are needed in addition to Sphinx.
man pages won't be built. For building the HTML documentation, doxygen, breathe
and sphinx_rtd_theme are needed in addition to Sphinx.
If you don't want to build with support for sqlite databases, you can configure
the build system with -Denable-sqlite=false and sqlite support won't be available.
the build system with -Dsqlite=disabled and sqlite support won't be available.
The use of magic to detect mime types is optional and can be disabled by
configuring the build system with -Denable-magic=false.
configuring the build system with -Dmagic=disabled.
The use of seccomp to create a sandboxed environment is optional and can be
disabled by configure the build system with -Denable-seccomp=false. The sandbox
disabled by configure the build system with -Dseccomp=disabled. The sandbox
will by default be set to "normal" mode, which should not interfere with the
normal operation of zathura. For strict sandbox mode set "sandbox strict" in
zathurarc. Strict sandbox mode will reduce the available functionality of

View file

@ -1,6 +1,6 @@
project('zathura', 'c',
version: '0.4.1',
meson_version: '>=0.45',
meson_version: '>=0.47',
default_options: 'c_std=c11',
)
@ -68,18 +68,18 @@ flags = cc.get_supported_arguments(flags)
# optional dependencies
additional_sources = []
sqlite = dependency('sqlite3', version: '>=3.5.9', required: false)
synctex = dependency('synctex', required: false)
magic = cc.find_library('magic', required: false)
seccomp = dependency('libseccomp', required: false)
sqlite = dependency('sqlite3', version: '>=3.5.9', required: get_option('sqlite'))
synctex = dependency('synctex', required: get_option('synctex'))
magic = cc.find_library('magic', required: get_option('magic'))
seccomp = dependency('libseccomp', required: get_option('seccomp'))
if get_option('enable-sqlite') and sqlite.found()
if sqlite.found()
build_dependencies += sqlite
defines += '-DWITH_SQLITE'
additional_sources += files('zathura/database-sqlite.c')
endif
if get_option('enable-synctex') and synctex.found()
if synctex.found()
build_dependencies += synctex
defines += '-DWITH_SYNCTEX'
if synctex.version() < '2.0.0'
@ -91,12 +91,12 @@ if get_option('enable-synctex') and synctex.found()
endif
endif
if get_option('enable-magic') and magic.found()
if magic.found()
build_dependencies += magic
defines += '-DWITH_MAGIC'
endif
if get_option('enable-seccomp') and seccomp.found()
if seccomp.found()
build_dependencies += seccomp
defines += '-DWITH_SECCOMP'
additional_sources += files('zathura/seccomp-filters.c')

View file

@ -1,20 +1,21 @@
option('enable-sqlite',
type: 'boolean',
value: true,
description: 'Enable sqlite support if available.'
option('sqlite',
type: 'feature',
value: 'auto',
description: 'SQLite database backend'
)
option('enable-synctex',
type: 'boolean',
value: true,
description: 'Enable synctex support if available.'
option('synctex',
type: 'feature',
value: 'auto',
description: 'SyncTeX integration'
)
option('enable-magic',
type: 'boolean',
value: true,
description: 'Enable magic support if available.'
option('magic',
type: 'feature',
value: 'auto',
description: 'magic-based MIME type detection'
)
option('seccomp',
type: 'feature',
value: 'auto',
description: 'seccomp-based sandbox'
)
option('enable-seccomp',
type: 'boolean',
value: true,
description: 'Enable experimental seccomp support if available.'
)