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 Requirements
------------ ------------
meson (>= 0.45) meson (>= 0.47)
gtk3 (>= 3.22) gtk3 (>= 3.22)
glib (>= 2.50) glib (>= 2.50)
girara (>= 0.2.8) girara (>= 0.2.8)
@ -23,17 +23,17 @@ breathe (optional, for HTML documentation)
sphinx_rtd_theme (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 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 man pages won't be built. For building the HTML documentation, doxygen, breathe
sphinx_rtd_theme are needed in addition to Sphinx. 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 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 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 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 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 normal operation of zathura. For strict sandbox mode set "sandbox strict" in
zathurarc. Strict sandbox mode will reduce the available functionality of zathurarc. Strict sandbox mode will reduce the available functionality of

View file

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

View file

@ -1,20 +1,21 @@
option('enable-sqlite', option('sqlite',
type: 'boolean', type: 'feature',
value: true, value: 'auto',
description: 'Enable sqlite support if available.' description: 'SQLite database backend'
) )
option('enable-synctex', option('synctex',
type: 'boolean', type: 'feature',
value: true, value: 'auto',
description: 'Enable synctex support if available.' description: 'SyncTeX integration'
) )
option('enable-magic', option('magic',
type: 'boolean', type: 'feature',
value: true, value: 'auto',
description: 'Enable magic support if available.' 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.'
) )