2018-02-10 13:13:06 +01:00
project ( 'zathura' , 'c' ,
2022-09-09 00:17:20 +02:00
version : '0.5.1' ,
2021-09-12 16:11:35 +02:00
meson_version : '>=0.56' ,
2020-04-26 16:25:57 +02:00
default_options : [ 'c_std=c11' , 'warning_level=3' ] ,
2018-02-10 13:13:06 +01:00
)
version = meson . project_version ( )
version_array = version . split ( '.' )
# Rules for so_major and so_minor:
# Before a release perform the following checks against the last release:
# * If a function has been removed or the paramaters of a function have changed
# bump SOMAJOR and set SOMINOR to 0.
# * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR.
2018-02-10 21:39:50 +01:00
plugin_api_version = '3'
plugin_abi_version = '4'
2018-02-10 13:13:06 +01:00
conf_data = configuration_data ( )
conf_data . set ( 'ZVMAJOR' , version_array [ 0 ] )
conf_data . set ( 'ZVMINOR' , version_array [ 1 ] )
conf_data . set ( 'ZVREV' , version_array [ 2 ] )
conf_data . set ( 'ZVAPI' , plugin_api_version )
conf_data . set ( 'ZVABI' , plugin_abi_version )
conf_data . set ( 'version' , version )
2018-08-21 18:11:29 +02:00
cc = meson . get_compiler ( 'c' )
2018-02-10 13:13:06 +01:00
prefix = get_option ( 'prefix' )
localedir = get_option ( 'localedir' )
datadir = get_option ( 'datadir' )
metainfodir = join_paths ( datadir , 'metainfo' )
desktopdir = join_paths ( datadir , 'applications' )
dbusinterfacesdir = join_paths ( datadir , 'dbus-1' , 'interfaces' )
plugindir = join_paths ( get_option ( 'libdir' ) , 'zathura' )
# required dependencies
2018-10-30 00:39:19 +01:00
libm = cc . find_library ( 'm' , required : false )
2022-02-13 19:20:02 +01:00
girara = dependency ( 'girara-gtk3' , version : '>=0.3.7' , fallback : [ 'girara' , 'girara_dependency' ] )
2018-02-10 13:13:06 +01:00
glib = dependency ( 'glib-2.0' , version : '>=2.50' )
2018-04-11 17:22:21 +02:00
gio = dependency ( 'gio-unix-2.0' , required : host_machine . system ( ) != 'windows' )
2018-02-10 13:13:06 +01:00
gthread = dependency ( 'gthread-2.0' , version : '>=2.50' )
gmodule = dependency ( 'gmodule-no-export-2.0' , version : '>=2.50' )
2018-02-23 15:47:52 +01:00
gtk3 = dependency ( 'gtk+-3.0' , version : '>=3.22' )
2018-03-04 20:17:17 +01:00
cairo = dependency ( 'cairo' )
2022-05-08 15:43:16 +02:00
magic = cc . find_library ( 'magic' , required : true )
2018-02-10 13:13:06 +01:00
2022-05-08 15:43:16 +02:00
build_dependencies = [ libm , girara , glib , gio , gthread , gmodule , gtk3 , cairo , magic ]
2018-02-10 13:13:06 +01:00
2021-01-05 09:31:48 +01:00
if host_machine . system ( ) == 'darwin'
gtk_mac_integration = dependency ( 'gtk-mac-integration-gtk3' )
build_dependencies + = gtk_mac_integration
endif
2018-02-10 13:13:06 +01:00
# defines
defines = [
'-DGETTEXT_PACKAGE="zathura"' ,
'-DLOCALEDIR="@0@"' . format ( join_paths ( prefix , localedir ) ) ,
'-DZATHURA_PLUGINDIR="@0@"' . format ( join_paths ( prefix , plugindir ) ) ,
'-D_DEFAULT_SOURCE' ,
]
2021-01-05 09:46:31 +01:00
if host_machine . system ( ) == 'darwin'
defines + = '-DGTKOSXAPPLICATION'
endif
2018-02-10 13:13:06 +01:00
# compile flags
flags = [
2018-03-04 11:14:01 +01:00
'-Werror=implicit-function-declaration' ,
2018-03-04 17:21:29 +01:00
'-Werror=vla' ,
'-fvisibility=hidden'
2018-02-10 13:13:06 +01:00
]
flags = cc . get_supported_arguments ( flags )
# optional dependencies
additional_sources = [ ]
2019-01-20 20:12:36 +01:00
sqlite = dependency ( 'sqlite3' , version : '>=3.6.23' , required : get_option ( 'sqlite' ) )
2019-03-03 18:30:32 +01:00
synctex = dependency ( 'synctex' , version : '>=1.19' , required : get_option ( 'synctex' ) )
2018-11-27 20:55:16 +01:00
seccomp = dependency ( 'libseccomp' , required : get_option ( 'seccomp' ) )
2018-02-10 13:13:06 +01:00
2018-11-27 20:55:16 +01:00
if sqlite . found ( )
2018-02-10 13:13:06 +01:00
build_dependencies + = sqlite
defines + = '-DWITH_SQLITE'
2018-03-11 16:17:56 +01:00
additional_sources + = files ( 'zathura/database-sqlite.c' )
2018-02-10 13:13:06 +01:00
endif
2018-11-27 20:55:16 +01:00
if synctex . found ( )
2018-02-10 13:13:06 +01:00
build_dependencies + = synctex
defines + = '-DWITH_SYNCTEX'
2019-03-03 18:30:32 +01:00
if synctex . version ( ) < '2.0.0' and synctex . version ( ) > = '1.19.0'
warning ( 'You are using a synctex version pre-SONAME bump, but post-ABI-break. Please make sure to always run zathura using the correct synctex version.' )
2018-04-21 13:11:10 +02:00
endif
2018-02-10 13:13:06 +01:00
endif
2018-11-27 20:55:16 +01:00
if seccomp . found ( )
2018-03-11 16:17:56 +01:00
build_dependencies + = seccomp
defines + = '-DWITH_SECCOMP'
2018-03-11 15:59:47 +01:00
additional_sources + = files ( 'zathura/seccomp-filters.c' )
2018-03-11 16:17:56 +01:00
endif
2018-02-10 13:13:06 +01:00
# generate version header file
version_header = configure_file (
input : 'zathura/version.h.in' ,
2018-02-20 21:42:43 +01:00
output : 'zathura-version.h' ,
2018-02-10 13:13:06 +01:00
configuration : conf_data
)
2021-01-05 09:31:48 +01:00
2018-02-10 13:13:06 +01:00
include_directories = [
include_directories ( '.' )
]
subdir ( 'data' )
subdir ( 'po' )
# source files
sources = files (
'zathura/adjustment.c' ,
'zathura/bookmarks.c' ,
'zathura/callbacks.c' ,
'zathura/checked-integer-arithmetic.c' ,
'zathura/commands.c' ,
'zathura/completion.c' ,
'zathura/config.c' ,
'zathura/content-type.c' ,
'zathura/database.c' ,
'zathura/database-plain.c' ,
'zathura/dbus-interface.c' ,
'zathura/document.c' ,
'zathura/file-monitor.c' ,
'zathura/file-monitor-glib.c' ,
2018-09-17 22:57:25 +02:00
'zathura/file-monitor-noop.c' ,
2018-02-10 13:13:06 +01:00
'zathura/file-monitor-signal.c' ,
'zathura/jumplist.c' ,
'zathura/links.c' ,
'zathura/marks.c' ,
'zathura/page.c' ,
'zathura/page-widget.c' ,
'zathura/plugin.c' ,
'zathura/print.c' ,
'zathura/render.c' ,
'zathura/shortcuts.c' ,
'zathura/synctex.c' ,
'zathura/types.c' ,
'zathura/utils.c' ,
'zathura/zathura.c' ,
)
sources + = zathura_resources
sources + = additional_sources
2021-01-05 09:46:31 +01:00
# header files to install
2018-02-10 13:13:06 +01:00
headers = files (
'zathura/document.h' ,
'zathura/links.h' ,
'zathura/macros.h' ,
'zathura/page.h' ,
'zathura/plugin-api.h' ,
'zathura/types.h' ,
)
headers + = version_header
# zathura helper library
libzathura = static_library ( 'zathura' ,
sources ,
dependencies : build_dependencies ,
include_directories : include_directories ,
c_args : defines + flags
)
# zathura executable
zathura = executable (
'zathura' ,
files ( 'zathura/main.c' ) ,
dependencies : build_dependencies + [ declare_dependency ( link_with : libzathura ) ] ,
install : true ,
include_directories : include_directories ,
c_args : defines + flags ,
2018-03-08 11:03:38 +01:00
export_dynamic : true ,
2021-09-12 16:11:35 +02:00
win_subsystem : 'windows'
2018-02-10 13:13:06 +01:00
)
install_headers ( headers , subdir : 'zathura' )
# pkg-config file
pkg = import ( 'pkgconfig' )
pkg . generate (
name : 'zathura' ,
description : 'document viewer - plugin API' ,
url : 'https://pwmt.org/projects/zathura' ,
version : version ,
requires_private : [ 'girara-gtk3' , 'cairo' ] ,
variables : [
'apiversion=@0@' . format ( plugin_api_version ) ,
'abiversion=@0@' . format ( plugin_abi_version ) ,
'plugindir=${libdir}/zathura'
]
)
2020-01-05 17:26:33 +01:00
zathura_dependency = declare_dependency ( link_with : zathura , include_directories : include_directories )
2018-02-10 13:13:06 +01:00
subdir ( 'doc' )
subdir ( 'tests' )