Commit b55f6656 authored by Iñigo Martínez's avatar Iñigo Martínez Committed by Felix Riemann

build: Port to meson build system

meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=784354
parent 9fe34b11
......@@ -12,6 +12,10 @@ EXTRA_DIST = \
ChangeLog-2.6 \
ChangeLog-2.18 \
ChangeLog.pre-git \
meson.build \
meson_options.txt \
meson_post_install.py \
po/meson.build \
tests
DISTCLEANFILES =
......
......@@ -47,7 +47,8 @@ EXTRA_DIST = \
popup-menus.ui \
$(DESKTOP_IN_FILES) \
$(appdata_in_files) \
eog.convert
eog.convert \
meson.build
CLEANFILES = \
$(DESKTOP_FILES) \
......
SUBDIRS = 16x16 22x22 24x24 32x32 48x48 256x256 scalable
EXTRA_DIST = meson.build
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook: update-icon-cache
......
icon_sizes = [
'16x16',
'22x22',
'24x24',
'32x32',
'256x256'
]
foreach icon_size: icon_sizes
install_subdir(
join_paths(icon_size, 'apps'),
install_dir: join_paths(eog_datadir, 'icons', 'hicolor', icon_size)
)
endforeach
install_data(
'scalable/apps/eog-symbolic.svg',
install_dir: join_paths(eog_datadir, 'icons', 'hicolor', 'scalable', 'apps')
)
icon_sizes = [
['16x16', ['slideshow-play.png', 'eog-plugin.png']],
['22x22', ['slideshow-play.png', 'eog-plugin.png']],
['24x24', ['slideshow-play.png']],
['32x32', ['slideshow-play.png', 'eog-plugin.png']],
['48x48', ['slideshow-play.png']]
]
foreach icon_size: icon_sizes
actions_icons = []
foreach file: icon_size[1]
actions_icons += files(join_paths(icon_size[0], 'actions', file))
endforeach
install_data(
actions_icons,
install_dir: join_paths(eog_pkgdatadir, 'icons', 'hicolor', icon_size[0], 'actions')
)
endforeach
install_subdir(
'scalable/actions',
install_dir: join_paths(eog_pkgdatadir, 'icons', 'hicolor', 'scalable')
)
subdir('icons')
resource_data = files(
'pixmaps/thumbnail-frame.png',
'eog-app-menu.ui',
'eog-gear-menu.ui',
'eog-image-properties-dialog.ui',
'eog-multiple-save-as-dialog.ui',
'eog-preferences-dialog.ui',
'eog-zoom-entry.ui',
'eog.css',
'fullscreen-toolbar.ui',
'help-overlay.ui',
'metadata-sidebar.ui',
'popup-menus.ui'
)
desktop_conf = configuration_data()
desktop_conf.set('VERSION', eog_version)
desktop = 'eog.desktop'
desktop_in = configure_file(
input: desktop + '.in.in',
output: desktop + '.in',
configuration: desktop_conf
)
i18n.merge_file(
desktop,
type: 'desktop',
input: desktop_in,
output: desktop,
po_dir: po_dir,
install: true,
install_dir: join_paths(eog_datadir, 'applications')
)
appdata = 'eog.appdata.xml'
i18n.merge_file(
appdata,
input: appdata + '.in',
output: appdata,
po_dir: po_dir,
install: true,
install_dir: join_paths(eog_datadir, 'metainfo')
)
schema_conf = configuration_data()
schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
schema = 'org.gnome.eog.gschema.xml'
configure_file(
input: schema + '.in',
output: schema,
install: true,
install_dir: eog_schemadir,
configuration: schema_conf
)
install_data(
'eog.convert',
install_dir: join_paths(eog_datadir, 'GConf', 'gsettings')
)
......@@ -126,7 +126,8 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += version.xml.in \
$(DOC_MODULE)-docs.xml.in
$(DOC_MODULE)-docs.xml.in \
meson.build
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
......
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Eye of GNOME Reference Manual</title>
<releaseinfo>
for Eye of GNOME &version;
</releaseinfo>
</bookinfo>
<reference>
<title>API Reference</title>
<chapter>
<title>User Interface</title>
<xi:include href="xml/eog-properties-dialog.xml"/>
<xi:include href="xml/eog-list-store.xml"/>
<xi:include href="xml/eog-file-chooser.xml"/>
<xi:include href="xml/eog-thumb-nav.xml"/>
<xi:include href="xml/eog-thumb-view.xml"/>
<xi:include href="xml/eog-scroll-view.xml"/>
<xi:include href="xml/eog-window.xml"/>
<xi:include href="xml/eog-window-activatable.xml"/>
<xi:include href="xml/eog-statusbar.xml"/>
<xi:include href="xml/eog-sidebar.xml"/>
<xi:include href="xml/eog-thumbnail.xml"/>
<xi:include href="xml/eog-save-as-dialog-helper.xml"/>
<xi:include href="xml/eog-error-message-area.xml"/>
</chapter>
<chapter>
<title>Image data and manipulation</title>
<xi:include href="xml/eog-image.xml"/>
<xi:include href="xml/eog-image-save-info.xml"/>
<xi:include href="xml/eog-transform.xml"/>
<xi:include href="xml/eog-clipboard-handler.xml"/>
</chapter>
<chapter>
<title>Printing</title>
<xi:include href="xml/eog-print.xml"/>
</chapter>
<chapter>
<title>Application and configuration</title>
<xi:include href="xml/eog-application.xml"/>
<xi:include href="xml/eog-session.xml"/>
<xi:include href="xml/eog-config-keys.xml"/>
</chapter>
<!--<chapter>
<title>Plugins</title>
<xi:include href="xml/eog-plugin-engine.xml"/>
</chapter>-->
<chapter>
<title>Utilities</title>
<xi:include href="xml/eog-debug.xml"/>
<xi:include href="xml/eog-uri-converter.xml"/>
<xi:include href="xml/eog-util.xml"/>
<!--
<xi:include href="xml/eog-exif-util.xml"/>
-->
<xi:include href="xml/eog-pixbuf-util.xml"/>
<xi:include href="xml/zoom.xml"/>
</chapter>
<chapter>
<title>Asynchronous jobs</title>
<xi:include href="xml/eog-jobs.xml"/>
<xi:include href="xml/eog-job-scheduler.xml"/>
</chapter>
</reference>
<part>
<title>Appendix</title>
<index id="api-index">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</part>
</book>
private_headers = [
'eog-application-service.h',
'eog-close-confirmation-dialog.h',
'eog-enum-types.h',
'eog-image-private.h',
'eog-image-jpeg.h',
'eog-marshal.h',
'eog-metadata-details.h',
'eog-metadata-reader.h',
'eog-metadata-reader-jpg.h',
'eog-metadata-reader-png.h',
'eog-metadata-sidebar.h',
'eog-module.h',
'eog-plugin-engine.h',
'eog-preferences-dialog.h',
'eog-print-image-setup.h',
'eog-print-preview.h'
]
if not have_exif
private_headers += 'eog-exif-util.h'
endif
version_conf = configuration_data()
version_conf.set('VERSION', eog_version)
version_xml = 'version.xml'
configure_file(
input: version_xml + '.in',
output: version_xml,
configuration: version_conf
)
# FIXME: gtkdoc is not able to get a configure_object as main_xml file.
# https://github.com/mesonbuild/meson/issues/2271
# https://github.com/mesonbuild/meson/issues/1875
# https://github.com/mesonbuild/meson/issues/550
'''
# Build EXIF-related documentation if we really have support for it
doc_conf = configuration_data()
if have_exif or have_exempi
doc_conf.set('EOG_DOC_EXIF_START', '')
doc_conf.set('EOG_DOC_EXIF_STOP', '')
else
doc_conf.set('EOG_DOC_EXIF_START', '<!--')
doc_conf.set('EOG_DOC_EXIF_STOP', '-->')
endif
docs_xml = meson.project_name() + '-docs.xml'
main_xml = configure_file(
input: docs_xml + '.in',
output: docs_xml,
configuration: doc_conf
)
'''
doc_path = join_paths(eog_datadir, 'gtk-doc', 'html', meson.project_name())
gnome.gtkdoc(
meson.project_name(),
main_xml: meson.project_name() + '-docs.xml',
src_dir: src_inc,
dependencies: libeog_dep,
scan_args: [
'--rebuild-types',
'--ignore-headers=' + ' '.join(private_headers),
],
gobject_typesfile: meson.project_name() + '.types',
install: true,
install_dir: doc_path
)
# please keep this list sorted alphabetically
ar
ca
cs
da
de
el
en_GB
es
eu
fi
fr
gl
hu
it
ja
ko
lv
oc
pa
pl
pt_BR
ro
ru
sl
sv
te
th
uk
zh_CN
zh_TW
EXTRA_DIST = meson.build
@YELP_HELP_RULES@
HELP_ID = eog
......
sources = [
'bug-filing.page',
'commandline.page',
'copy-paste.page',
'default.page',
'desktop-background.page',
'develop.page',
'documentation.page',
'edit.page',
'flip-rotate.page',
'format-change.page',
'formats-save.page',
'formats-view.page',
'index.page',
'introduction.page',
'legal.xml',
'license.page',
'open.page',
'plugin-exif-digital.page',
'plugin-fullscreen-background.page',
'plugin-fullscreen-double-click.page',
'plugin-picasa.page',
'plugin-python-console.page',
'plugin-send-by-mail.page',
'plugin-slideshow-shuffle.page',
'plugins.page',
'plugin-zoom-width.page',
'preferences.page',
'print.page',
'rename-multiple.page',
'shortcuts.page',
'slideshow.page',
'translate.page',
'view.page',
'zoom.page'
]
media = [
'figures/eog-logo.png',
'figures/eog-trail.png',
'figures/image-view-prefs.png',
'figures/multiple-convert.png',
'figures/multiple-rename-count.png',
'figures/plugins-all.png',
'figures/plugin-send-by-mail.png',
'figures/prefs-plugins-date.png',
'figures/prefs-plugins-fullscreen.png',
'figures/prefs-plugins.png',
'figures/slideshow-prefs.png'
]
gnome.yelp(
meson.project_name(),
sources: sources,
media: media,
symlink_media: true
)
......@@ -18,6 +18,9 @@ libeog_jpegutils_la_SOURCES += \
transupp-6b.h
endif
EXTRA_DIST = README.6b README.8a
EXTRA_DIST = \
README.6b \
README.8a \
meson.build
-include $(top_srcdir)/git.mk
if have_jpeg_80
sources = files('transupp-8a.c')
else
sources = files('transupp-6b.c')
endif
libjpegutils = static_library(
'eog-jpegutils',
sources: sources,
include_directories: top_inc
)
jpeg_deps += declare_dependency(
link_with: libjpegutils,
include_directories: include_directories('.')
)
project(
'eog', 'c',
version: '3.27.1',
license: 'GPL2+',
default_options: 'buildtype=debugoptimized',
meson_version: '>= 0.43.0'
)
eog_version = meson.project_version()
version_array = eog_version.split('.')
eog_major_version = version_array[0].to_int()
eog_minor_version = version_array[1].to_int()
eog_micro_version = version_array[2].to_int()
eog_api_version = '@0@.0'.format(eog_major_version)
eog_api_name = '@0@-@1@'.format(meson.project_name(), eog_api_version)
eog_gir_ns = 'Eog'
eog_gir_version = '1.0'
eog_prefix = get_option('prefix')
eog_bindir = join_paths(eog_prefix, get_option('bindir'))
eog_datadir = join_paths(eog_prefix, get_option('datadir'))
eog_includedir = join_paths(eog_prefix, get_option('includedir'))
eog_libdir = join_paths(eog_prefix, get_option('libdir'))
eog_libexecdir = join_paths(eog_prefix, get_option('libexecdir'))
eog_localedir = join_paths(eog_prefix, get_option('localedir'))
eog_pkgdatadir = join_paths(eog_datadir, meson.project_name())
eog_pkglibdir = join_paths(eog_libdir, meson.project_name())
eog_pkglibexecdir = join_paths(eog_libexecdir, meson.project_name())
eog_pluginsdir = join_paths(eog_pkglibdir, 'plugins')
eog_schemadir = join_paths(eog_datadir, 'glib-2.0', 'schemas')
eog_debug = get_option('buildtype').contains('debug')
cc = meson.get_compiler('c')
config_h = configuration_data()
# defines
set_defines = [
# package
['PACKAGE', meson.project_name()],
['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + meson.project_name()],
['PACKAGE_URL', 'https://wiki.gnome.org/Apps/EyeOfGnome'],
['VERSION', eog_version],
# i18n
['GETTEXT_PACKAGE', meson.project_name()]
]
foreach define: set_defines
config_h.set_quoted(define[0], define[1])
endforeach
# support for nl_langinfo (_NL_MEASUREMENT_MEASUREMENT) (optional)
langinfo_measurement_src = '''
#include <langinfo.h>
int main() {
char c;
c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
};
'''
config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', cc.compiles(langinfo_measurement_src),
description: 'Define if _NL_MEASUREMENT_MEASUREMENT is available')
# support for strptime
config_h.set('HAVE_STRPTIME', cc.has_function('strptime'))
# compiler flags
common_flags = ['-DHAVE_CONFIG_H']
compiler_flags = []
if eog_debug
test_cflags = [
'-Werror=format=2',
'-Werror=implicit-function-declaration',
'-Werror=init-self',
'-Werror=missing-include-dirs',
'-Werror=missing-prototypes',
'-Werror=pointer-arith',
'-Werror=return-type',
'-Wnested-externs',
'-Wstrict-prototypes'
]
compiler_flags += cc.get_supported_arguments(test_cflags)
endif
add_project_arguments(common_flags + compiler_flags, language: 'c')
ldflag = '-Wl,--version-script'
have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag)
glib_req_version = '>= 2.53.4'
peas_req_version = '>= 0.7.4'
eog_deps = [
dependency('gtk+-3.0', version: '>= 3.22.0'),
dependency('glib-2.0', version: glib_req_version),
dependency('gio-2.0', version: glib_req_version),
dependency('gio-unix-2.0', version: glib_req_version),
dependency('gnome-desktop-3.0', version: '>= 2.91.2'),
dependency('gdk-pixbuf-2.0', version: '>= 2.36.5'),
dependency('gtk+-unix-print-3.0', version: '>= 3.5.4'),
dependency('shared-mime-info', version: '>= 0.20'),
dependency('gsettings-desktop-schemas', version: '>= 2.91.92'),
dependency('libpeas-1.0', version: peas_req_version),
dependency('libpeas-gtk-1.0', version: peas_req_version),
cc.find_library('m')
]
# ZLIB support (required)
have_zlib = false
if cc.has_header('zlib.h')
zlib_dep = cc.find_library('z', required: false)
have_zlib = zlib_dep.found() and (cc.has_function('inflate', dependencies: zlib_dep) or cc.has_function('crc32', dependencies: zlib_dep))
if have_zlib
eog_deps += zlib_dep
endif
endif
assert(have_zlib, 'No sufficient zlib library found on your system')
# EXIF (optional)
have_exif = false
if get_option('libexif')
libexif_dep = dependency('libexif', version: '>= 0.6.14', required: false)
have_exif = libexif_dep.found() and cc.has_header('libexif/exif-data.h', dependencies: libexif_dep)
if have_exif
eog_deps += libexif_dep
config_h.set10('HAVE_EXIF', true,
description: 'EXIF Support.')
endif
endif
# Little CMS (optional)
have_lcms = false
if get_option('cms')
libcms_dep = dependency('lcms2', required: false)
have_lcms = libcms_dep.found()
if have_lcms
eog_deps += libcms_dep
config_h.set10('HAVE_LCMS', true,
description: 'Little CMS Support.')
endif
endif
# Exempi (optional)
have_exempi = false
if get_option('xmp')
libexempi_dep = dependency('exempi-2.0', version: '>= 1.99.5', required: false)
have_exempi = libexempi_dep.found()
if have_exempi
eog_deps += libexempi_dep
config_h.set10('HAVE_EXEMPI', true,
description: 'XMP Support.')
endif
endif
# Jpeg (semi-optional)
jpeg_deps = []
have_jpeg = false
have_jpeg_80 = false
if get_option('libjpeg')
libjpeg_dep = dependency('libjpeg', required: false)
if libjpeg_dep.found()
have_jpeg = cc.has_function('jpeg_destroy_decompress', dependencies: libjpeg_dep) and cc.has_header('jpeglib.h', dependencies: libjpeg_dep)
if have_jpeg
jpeg_deps += libjpeg_dep
have_progressive = cc.has_function('jpeg_simple_progression', dependencies: libjpeg_dep)
if not have_progressive
message('JPEG library does not support progressive saving.')
endif
message('Checking libjpeg version is 8 or greater')
jpeg_80_check_src = '''
#include <stdio.h>
#include <jpeglib.h>
#if JPEG_LIB_VERSION < 80
#error "wrong version"
#endif
'''
have_jpeg_80 = cc.compiles(jpeg_80_check_src, dependencies: libjpeg_dep)
else
error_msg = '*** JPEG loader will not be built (JPEG header file not found) ***\n'
endif
else
error_msg = '*** JPEG loader will not be built (JPEG library not found) ***\n'
endif
if not have_jpeg
error_msg += '*** You can build without it by passing -Dlibjpeg=false to\n'
error_msg += '*** meson but some programs using GTK+ may not work properly\n'
error(error_msg)
endif
config_h.set10('HAVE_JPEG', true,
description: 'Jpeg Support.')
endif
config_h.set('HAVE_LIBJPEG', have_jpeg,
description: 'libjpeg is Present.')
# introspection support
have_gir = false
if get_option('introspection')
gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
have_gir = gir_dep.found()
if have_gir
eog_deps += gir_dep
endif
endif
config_h.set('HAVE_INTROSPECTION', have_gir)
# RSVG (optional for scaling svg image)
have_rsvg = false
if get_option('librsvg')
librsvg_dep = dependency('librsvg-2.0', version: '>= 2.36.2', required: false)
have_rsvg = librsvg_dep.found()
if have_rsvg
eog_deps += librsvg_dep
endif
endif
config_h.set('HAVE_RSVG', have_rsvg,
description: 'RSVG Support.')