Commit d69158ec authored by Iñigo Martínez's avatar Iñigo Martínez

build: Port to Meson build system

Meson is a build system focused on speed and ease of use, which
helps speed up software development. This patch adds Meson support
alongside Autotools.
parent cbe1388e
Pipeline #32456 passed with stage
in 8 minutes and 20 seconds
{
global:
register_evince_backend;
local:
*;
};
sources = files(
'comics-document.c',
'ev-archive.c',
)
incs = backends_incs + [cut_n_paste_inc]
deps = backends_deps + [
libarchive_dep,
libunarr_dep,
]
shared_module(
backend_name,
sources: sources,
include_directories: incs,
dependencies: deps,
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
test_name = 'test-ev-archive'
sources = files(
'ev-archive.c',
'test-ev-archive.c',
)
executable(
test_name,
sources,
include_directories: incs,
dependencies: deps,
)
sources = files(
'djvu-document.c',
'djvu-links.c',
'djvu-text-page.c',
)
shared_module(
backend_name,
sources: sources,
include_directories: backends_incs,
dependencies: backends_deps + [ddjvuapi_dep],
c_args: backends_cflags + ['-DGNOMEICONDIR="@0@"'.format(join_paths(ev_datadir, 'pixmaps'))],
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
sources = files(
'afmparse.c',
'bitmap.c',
'color.c',
'common.c',
'dviread.c',
'files.c',
'font.c',
'fontmap.c',
'fontsrch.c',
'gf.c',
'hash.c',
'list.c',
'pagesel.c',
'paper.c',
'pk.c',
'setup.c',
'special.c',
'sp-epsf.c',
't1.c',
'tfm.c',
'tfmfile.c',
'tt.c',
'util.c',
'vf.c',
)
libmdvi = static_library(
'mdvi',
sources: sources,
include_directories: top_inc,
)
libmdvi_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libmdvi,
)
subdir('mdvi-lib')
sources = files(
'cairo-device.c',
'dvi-document.c',
'fonts.c',
'texmfcnf.c',
)
deps = backends_deps + [
libmdvi_dep,
libspectre_dep,
kpathsea_dep,
t1_dep,
]
shared_module(
backend_name,
sources: sources,
include_directories: backends_incs,
dependencies: deps,
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
backends_incs = [top_inc]
backends_deps = [libevdocument_dep]
backends_cflags = [
'-DGNOMELOCALEDIR="@0@"'.format(ev_localedir),
'-DEVINCE_COMPILATION',
'-DGDK_MULTIHEAD_SAFE',
'-DGTK_MULTIHEAD_SAFE',
]
backends_symbol_map = join_paths(meson.current_source_dir(), 'backend-symbol.map')
backends_ldflags = cpp.get_supported_link_arguments('-Wl,--version-script,' + backends_symbol_map)
foreach backend, backend_mime_types: backends
backend_name = backend + 'document'
backend_mime_types_conf = configuration_data()
backend_mime_types_conf.set(backend.to_upper() + '_MIME_TYPES', ';'.join(backend_mime_types))
appdata_mime_types = ''
foreach type: backend_mime_types
appdata_mime_types += '\t<mimetype>@0@</mimetype>\n'.format(type)
endforeach
backend_mime_types_conf.set('APPDATA_@0@_MIME_TYPES'.format(backend.to_upper()), appdata_mime_types)
backend_desc = backend_name + '.evince-backend'
backend_desc_in = configure_file(
input: '@0@/@1@.in.in'.format(backend, backend_desc),
output: backend_desc + '.in',
configuration: backend_mime_types_conf,
)
custom_target(
backend_desc,
input: backend_desc_in,
output: backend_desc,
command: intltool_desktop_cmd,
install: true,
install_dir: ev_backendsdir,
)
appstream = 'evince-@0@.metainfo.xml'.format(backend_name)
appstream_in = configure_file(
input: '@0@/@1@.in.in'.format(backend, appstream),
output: appstream + '.in',
configuration: backend_mime_types_conf,
)
custom_target(
appstream,
input: appstream_in,
output: appstream,
command: intltool_xml_cmd,
install: true,
install_dir: ev_appstreamdir,
)
subdir(backend)
endforeach
deps = backends_deps + [
cairo_pdf_dep,
cairo_ps_dep,
libxml_dep,
poppler_glib_dep,
]
shared_module(
backend_name,
sources: 'ev-poppler.cc',
include_directories: backends_incs,
dependencies: deps,
cpp_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
shared_module(
backend_name,
sources: 'ev-spectre.c',
include_directories: backends_incs,
dependencies: backends_deps + [libspectre_dep],
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
sources = files(
'tiff-document.c',
'tiff2ps.c',
)
shared_module(
backend_name,
sources: sources,
include_directories: backends_incs,
dependencies: backends_deps + [libtiff_dep],
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
shared_module(
backend_name,
sources: 'xps-document.c',
include_directories: backends_incs,
dependencies: backends_deps + [libgxps_dep],
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
sources = files(
'EvBrowserPlugin.cpp',
'EvBrowserPluginMain.cpp',
'EvBrowserPluginToolbar.cpp',
)
resource_data = files(
'../data/thumbnail-frame.png',
'evince-browser.css',
)
resource = 'EvBrowserPlugin'
sources += gnome.compile_resources(
resource + 'Resources',
resource + '.gresource.xml',
source_dir: data_dir,
dependencies: resource_data,
export: true,
)
incs = [
top_inc,
include_directories('npapi'),
]
cflags = [
'-DGNOMELOCALEDIR="@0@"'.format(ev_localedir),
'-DEVINCE_COMPILATION',
'-DMOZ_X11',
'-DXP_UNIX',
]
cppflags = cflags + cc.get_supported_arguments([
'-std=c++11',
'-fno-exceptions',
'-fno-strict-aliasing',
'-fno-rtti',
])
symbol_map = join_paths(meson.current_source_dir(), 'plugin-symbol.map')
ldflag = cpp.get_supported_link_arguments([
'-Wl,--version-script,' + symbol_map,
'-Wl,-z,nodelete',
])
shared_module(
'evbrowserplugin',
sources: sources,
include_directories: incs,
dependencies: libevmisc_dep,
cpp_args: cppflags,
install: true,
install_dir: browser_plugin_dir,
)
{
global:
NP_GetMIMEDescription;
NP_GetValue;
NP_Initialize;
NP_Shutdown;
local:
*;
};
libgimpcellrenderertoggle = static_library(
'gimpcellrenderertoggle',
sources: 'gimpcellrenderertoggle.c',
include_directories: top_inc,
dependencies: gtk_dep,
)
libgimpcellrenderertoggle_dep = declare_dependency(
include_directories: include_directories('.'),
dependencies: gtk_dep,
link_with: libgimpcellrenderertoggle,
)
sources = files(
'gd-icon-utils.c',
'gd-two-lines-renderer.c',
)
deps = [
cairo_dep,
gtk_dep,
]
libgd = static_library(
'gd',
sources: sources,
include_directories: top_inc,
dependencies: deps,
)
libgd_dep = declare_dependency(
include_directories: include_directories('.'),
dependencies: deps,
link_with: libgd,
)
cut_n_paste_inc = include_directories('.')
subdir('gimpcellrenderertoggle')
subdir('libgd')
subdir('unarr')
if not external_synctex
subdir('synctex')
endif
sources = files(
'synctex_parser.c',
'synctex_parser_utils.c',
)
libsynctex = static_library(
'synctex',
sources: sources,
include_directories: top_inc,
c_args: '-DSYNCTEX_VERBOSE=0',
)
synctex_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libsynctex,
)
sources = files(
'common/conv.c',
'common/crc32.c',
'common/stream.c',
'common/unarr.c',
'lzmasdk/CpuArch.c',
'lzmasdk/Ppmd7.c',
'lzmasdk/Ppmd7Dec.c',
'rar/filter-rar.c',
'rar/huffman-rar.c',
'rar/parse-rar.c',
'rar/rar.c',
'rar/rarvm.c',
'rar/uncompress-rar.c',
)
libunarr = static_library(
'unarr',
sources: sources,
dependencies: zlib_dep,
c_args: '-DHAVE_ZLIB',
)
libunarr_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libunarr,
)
# array: [size, actions, mimetypes, apps]
icons = []
actions = [
'object-rotate-left.png',
'object-rotate-right.png',
'view-page-continuous.png',
'view-page-facing.png',
'zoom-fit-height.png',
'zoom-fit-width.png',
'zoom.png',
]
icons += [['16x16', actions, ['x-office-presentation.png'], [ev_namespace + '.png']]]
actions = [
'eye.png',
'object-rotate-left.png',
'object-rotate-right.png',
'view-page-continuous.png',
'view-page-facing.png',
'zoom-fit-page.png',
'zoom-fit-width.png',
'zoom.png',
]
icons += [['22x22', actions, ['x-office-presentation.png'], [ev_namespace + '.png']]]
actions = [
'object-rotate-left.png',
'object-rotate-right.png',
'stock_filters-invert.png',
'view-page-continuous.png',
'view-page-facing.png',
'zoom-fit-height.png',
'zoom-fit-width.png',
'zoom.png',
]
icons += [['24x24', actions, ['x-office-presentation.png'], [ev_namespace + '.png']]]
actions = [
'object-rotate-left.png',
'object-rotate-right.png',
'view-page-continuous.png',
'view-page-facing.png',
]
icons += [['32x32', actions, ['x-office-presentation.png'], []]]
actions = [
'close.png',
'resize-se.png',
'resize-sw.png',
'view-page-continuous.png',
'view-page-facing.png',
]
icons += [['48x48', actions, [], [ev_namespace + '.png']]]
icons += [['256x256', [], [], [ev_namespace + '.png']]]
actions = [
'object-rotate-left.svg',
'object-rotate-right.svg',
'outline-symbolic.svg',
'view-sidebar-symbolic.svg',
]
icons += [['scalable', actions, ['x-office-presentation.svg'], []]]
icons += [['symbolic', [], [], [ev_namespace + '-symbolic.svg']]]
foreach icon: icons
foreach action: icon[1]
install_data(
join_paths(icon[0], 'actions', action),
install_dir: join_paths(ev_pkgdatadir, 'icons', 'hicolor', icon[0], 'actions'),
)
endforeach
foreach mimetype: icon[2]
install_data(
join_paths(icon[0], 'mimetypes', mimetype),
install_dir: join_paths(ev_pkgdatadir, 'icons', 'hicolor', icon[0], 'mimetypes'),
)
endforeach
foreach app: icon[3]
install_data(
join_paths(icon[0], 'apps', app),
install_dir: join_paths(ev_datadir, 'icons', 'hicolor', icon[0], 'apps'),
)
endforeach
endforeach
subdir('icons')
# Desktop file
desktops = [ev_namespace + '.desktop']
if enable_previewer
desktops += [ev_namespace + '-previewer.desktop']
endif
foreach desktop: desktops
desktop_in = configure_file(
input: desktop + '.in.in',
output: desktop + '.in',
configuration: mime_types_conf,
)
custom_target(
desktop,
input: desktop_in,
output: desktop,
command: intltool_desktop_cmd,
install: true,
install_dir: join_paths(ev_datadir, 'applications'),
)
endforeach
# DBus service file
if enable_dbus
service_conf = configuration_data()
service_conf.set('libexecdir', join_paths(ev_prefix, ev_libexecdir))
service_conf.set('if_systemd_service', '')
services = [[ev_namespace + '.Daemon.service', dbus_service_dir]]
if install_systemd_user_unit_dir
services += [[ev_namespace + '.service', systemd_user_unit_dir]]
endif
foreach service: services
configure_file(
input: service[0] + '.in',
output: service[0],
configuration: service_conf,
install: true,
install_dir: service[1],
)
endforeach
endif
# GSettings schema
gschema = ev_namespace + '.gschema.xml'
custom_target(
gschema,
input: gschema + '.in',
output: gschema,
command: [intltool_merge, '-x', '-u', '--no-translations', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: join_paths(ev_datadir, 'glib-2.0', 'schemas'),
)
install_data(
'evince.convert',
install_dir: join_paths(ev_datadir, 'GConf', 'gsettings'),
)
# man file
install_data(
'evince.1',
install_dir: join_paths(ev_mandir, 'man1'),
)
# UI descriptions
install_data(
'hand-open.png',
install_dir: ev_pkgdatadir,
)
#!/bin/sh
if [ -d "$1/.git" ]; then
git log -M -C --name-status --date=short --no-color | fmt --split-only > $2.tmp &&
mv -f $2.tmp $2 ||
{
rm -f $2.tmp &&
echo "Failed to generate ChangeLog, your ChangeLog may be outdated" >&2;
}
else
echo "Git repository not found" >&2
exit 1
fi
# please keep this list sorted alphabetically
bg
ca
cs
da
de
el
en_GB
es
eu
fi
fr
gl
hu
id
it
ja
ko
lv
nl
oc
pl
pt_BR
ro
ru
sl
sr
sv
te
uk
vi
zh_CN
zh_HK
zh_TW
enable_gtk_doc = get_option('gtk_doc')
if enable_gtk_doc
glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
common_fixxref_args = [
'--extra-dir=' + join_paths(glib_prefix, gnome.gtkdoc_html_dir('glib')),
'--extra-dir=' + join_paths(glib_prefix, gnome.gtkdoc_html_dir('gio')),
'--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gdk')),
'--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gdk-pixbuf')),
'--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gtk')),
]
subdir('reference/libdocument')
subdir('reference/libview')
subdir('reference/shell')
endif
sources = [
'annotation-properties.page',
'annotations-delete.page',
'annotations-disabled.page',
'annotations-navigate.page',
'annotations.page',
'annotations-save.page',
'bookmarks.page',
'bug-filing.page',
'commandline.page',
'convertpdf.page',
'convertPostScript.page',
'convertSVG.page',
'default-settings.page',
'develop.page',
'documentation.page',
'duplex-10pages.page',
'duplex-11pages.page',
'duplex-12pages.page',
'duplex-13pages.page',
'duplex-14pages.page',
'duplex-15pages.page',
'duplex-16pages.page',
'duplex-3pages.page',
'duplex-4pages.page',
'duplex-5pages.page',
'duplex-6pages.page',
'duplex-7pages.page',
'duplex-8pages.page',
'duplex-9pages.page',
'duplex-npages.page',
'editing.page',
'finding.page',
'formats.page',
'forms.page',
'forms-saving.page',
'index.page',
'introduction.page',
'invert-colors.page',
'license.page',
'legal.xml',
'legal-unported.xml',
'movingaround.page',
'noprint.page',
'openerror.page',
'opening.page',
'password.page',
'presentations.page',
'print-2sided.page',
'print-booklet.page',
'print-differentsize.page',
'printing.page',
'print-order.page',
'print-pagescaling.page',
'print-select.page',
'reload.page',
'shortcuts.page',
'singlesided-13-16pages.page',
'singlesided-17-20pages.page',
'singlesided-3-4pages.page',
'singlesided-5-8pages.page',
'singlesided-9-12pages.page',
'singlesided-npages.page',
'synctex-beamer.page',
'synctex-compile.page',
'synctex-editors.page',
'synctex.page',
'synctex-search.page',
'synctex-support.page',
'textselection.page',
'titlebar.page',
'translate.page',
]
media = [
'figures/add-text-annotation.png',
'figures/annotations-nav-to-page.png',
'figures/evincelogo.png',
'figures/evince-trail.png',
'figures/list-add-tabs.png',
'figures/print-select.png',
'figures/reverse-collate.png',
'figures/zoom.png',
]
gnome.yelp(
ev_name,
sources: sources,
media: media,
symlink_media: true,
)
doc_module = 'libevdocument'
doc_module_dir = '@0@-@1@'.format(doc_module, ev_api_version)
private_headers = [
'ev-backend-info.h',
'ev-debug.h',
'ev-macros.h',
'ev-module.h',
]
libevdocument_doc_path = join_paths(ev_prefix, gnome.gtkdoc_html_dir(doc_module_dir))
fixxref_args = common_fixxref_args + ['--html-dir=' + libevdocument_doc_path]
version_conf = configuration_data()
version_conf.set('VERSION', ev_version)
version_xml = 'version.xml'
version = configure_file(
input: version_xml + '.in',
output: version_xml,
configuration: version_conf,
)
gnome.gtkdoc(
doc_module,
main_xml: doc_module + '-docs.xml',
src_dir: libdocument_inc,
dependencies: libevdocument_dep,
ignore_headers: private_headers,
namespace: ev_code_prefix.to_lower(),
fixxref_args: fixxref_args,
gobject_typesfile: files(doc_module + '.types'),
content_files: version,
install: true,
install_dir: doc_module_dir,
)