Commit cc558432 authored by Iñigo Martínez's avatar Iñigo Martínez Committed by Debarshi Ray
Browse files

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.

Some changes by Debarshi Ray.

!48
!51
parent 382d4e31
......@@ -36,16 +36,6 @@ GITIGNOREFILES = \
$(NULL)
update-authors:
@if test -d "$(srcdir)/.git"; \
then \
echo Updating AUTHORS && \
( cd "$(top_srcdir)" && \
echo '# Generated — do not edit.'; echo; \
git log --no-merges --pretty=format:"%an" src \
| sort | uniq ) > AUTHORS.tmp \
&& mv -f AUTHORS.tmp AUTHORS \
|| ( rm -f AUTHORS.tmp ; \
echo Failed to generate AUTHORS >&2 ); \
fi
$(top_srcdir)/update-authors.sh $(top_srcdir)
-include $(top_srcdir)/git.mk
icon_sizes = [
'16x16',
'22x22',
'24x24',
'32x32',
'48x48',
'256x256',
]
foreach icon_size: icon_sizes
install_data(
'_'.join(['hicolor', 'apps', icon_size, photos_namespace + '.png']),
install_dir: join_paths(photos_datadir, 'icons', 'hicolor', icon_size, 'apps'),
)
endforeach
install_data(
'_'.join(['hicolor', 'apps', 'scalable', photos_namespace + '-symbolic.svg']),
install_dir: join_paths(photos_datadir, 'icons', 'hicolor', 'scalable', 'apps'),
)
subdir('icons')
appdata = photos_namespace + '.appdata.xml'
i18n.merge_file(
appdata,
input: appdata + '.in',
output: appdata,
po_dir: po_dir,
install: true,
install_dir: join_paths(photos_datadir, 'metainfo'),
)
desktop_conf = configuration_data()
desktop_conf.set('PACKAGE_TARNAME', meson.project_name())
desktop = photos_namespace + '.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(photos_datadir, 'applications'),
)
service_conf = configuration_data()
service_conf.set('bindir', photos_bindir)
service = photos_namespace + '.service'
configure_file(
input: service + '.in',
output: service,
configuration: service_conf,
install: true,
install_dir: dbus_service_dir,
)
install_data(
photos_namespace + '.search-provider.ini',
install_dir: join_paths(photos_datadir, 'gnome-shell', 'search-providers'),
)
install_data(
photos_namespace.to_lower() + '.gschema.xml',
install_dir: join_paths(photos_datadir, 'glib-2.0', 'schemas'),
)
# Please keep this list sorted alphabetically.
ca
cs
da
de
el
es
fr
fur
gl
hu
ko
pl
pt_BR
ro
sv
sources = [
'favorites.page',
'favorites-set.page',
'index.page',
'legal.xml',
'view-album.page',
'view-favorites.page',
'view-photos.page',
'view.page',
]
media = 'media/logo1.png'
gnome.yelp(
meson.project_name(),
sources: sources,
media: media,
symlink_media: true,
)
project(
'gnome-photos', 'c',
version: '3.29.91',
license: 'GPL3+',
default_options: 'buildtype=debugoptimized',
meson_version: '>= 0.47.0',
)
photos_prefix = get_option('prefix')
photos_bindir = join_paths(photos_prefix, get_option('bindir'))
photos_datadir = join_paths(photos_prefix, get_option('datadir'))
photos_libexecdir = join_paths(photos_prefix, get_option('libexecdir'))
photos_localedir = join_paths(photos_prefix, get_option('localedir'))
photos_docdir = join_paths(photos_datadir, 'doc', meson.project_name())
photos_installed_test_metadir = join_paths(photos_datadir, 'installed-tests', meson.project_name())
photos_installed_test_execdir = join_paths(photos_libexecdir, 'installed-tests', meson.project_name())
photos_namespace = 'org.gnome.Photos'
photos_buildtype = get_option('buildtype')
gnome = import('gnome')
i18n = import('i18n')
source_root = meson.current_source_dir()
po_dir = join_paths(source_root, 'po')
top_inc = include_directories('.')
cc = meson.get_compiler('c')
config_h = configuration_data()
config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Photos')
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
git = find_program('git')
if git.found()
res = run_command(git, '-C', source_root, 'describe')
if res.returncode() == 0
config_h.set_quoted('PACKAGE_COMMIT_ID', res.stdout().strip())
endif
endif
config_h.set_quoted('G_LOG_DOMAIN', meson.project_name())
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set('PHOTOS_EPSILON', '1e-5')
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, name: '_NL_MEASUREMENT_MEASUREMENT'),
)
common_flags = []
if photos_buildtype.contains('plain')
common_flags += cc.get_supported_arguments([
'-Wall',
'-Winvalid-pch',
])
endif
common_flags += cc.get_supported_arguments([
'-fno-strict-aliasing',
'-Wcast-align',
'-Wdeclaration-after-statement',
'-Wformat=2',
'-Winit-self',
'-Winline',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wold-style-definition',
'-Wpacked',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wsign-compare',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wswitch-enum',
'-Wundef',
'-Wwrite-strings',
])
common_flags += cc.get_supported_arguments([
'-Wno-cast-function-type',
'-Wno-error=cast-function-type',
'-Wno-missing-field-initializers',
'-Wno-error=missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-error=unused-parameter',
])
add_project_arguments(common_flags, language: 'c')
m_dep = cc.find_library('m')
libgd = subproject(
'libgd',
default_options: [
'static=true',
'with-gtk-hacks=true',
'with-main-box=true',
'with-main-icon-view=true',
'with-tagged-entry=true',
]
)
libgd_dep = libgd.get_variable('libgd_dep')
babl_dep = dependency('babl')
cairo_dep = dependency('cairo', version: '>= 1.14.0')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.32')
gegl_dep = dependency('gegl-0.4', version: '>= 0.4.0')
geocode_glib_dep = dependency('geocode-glib-1.0')
gexiv_dep = dependency('gexiv2', version: '>= 0.10.8')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
glib_dep = dependency('glib-2.0', version: '>= 2.44.0')
goa_dep = dependency('goa-1.0', version: '>= 3.8.0')
config_h.set('GOA_API_IS_SUBJECT_TO_CHANGE', true)
grilo_dep = dependency('grilo-0.3', version: '>= 0.3.5')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.16')
gtk_unix_print_dep = dependency('gtk+-unix-print-3.0')
libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.26.0')
libgdata_dep = dependency('libgdata', version: '>= 0.15.2')
libgfgraph_dep = dependency('libgfbgraph-0.2', version: '>= 0.2.1')
libjpeg_dep = dependency('libjpeg')
libpng_dep = dependency('libpng16')
tracker_control_dep = dependency('tracker-control-2.0')
tracker_sparql_dep = dependency('tracker-sparql-2.0')
dbus_dep = dependency('dbus-1')
dbus_service_dir = dbus_dep.get_pkgconfig_variable(
'session_bus_services_dir',
define_variable: ['datadir', photos_datadir],
)
configure_file(
output: 'config.h',
configuration: config_h,
)
artists = files('ARTISTS')
authors = files('AUTHORS')
doc_data = artists + authors + files(
'COPYING',
'NEWS',
'README',
)
install_data(
doc_data,
install_dir: photos_docdir,
)
subdir('data')
subdir('src')
subdir('po')
subdir('tests')
subdir('help')
script_name = 'update-authors'
run_target(script_name, command: [find_program(script_name + '.sh'), source_root])
meson.add_install_script(
'meson_post_install.py',
photos_datadir,
)
option('dogtail', type: 'boolean', value: true, description: 'test using dogtail')
option('installed_tests', type: 'boolean', value: false, description: 'Enable installation of some test cases')
#!/usr/bin/env python3
import glob
import os
import re
import subprocess
import sys
destdir = os.environ.get('DESTDIR', '')
if destdir:
datadir = os.path.normpath(destdir + os.sep + sys.argv[1])
else:
datadir = sys.argv[1]
icondir = os.path.join(datadir, 'icons', 'hicolor')
name_pattern = re.compile('hicolor_(?:apps)_(?:\d+x\d+|scalable)_(.*)')
search_pattern = '/**/hicolor_*'
for file in glob.glob(icondir + search_pattern, recursive=True):
os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
if not destdir:
print('Updating icon cache...')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
schemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
i18n.gettext(meson.project_name(), preset: 'glib')
common_sources = files(
'photos-debug.c',
'photos-error.c',
'photos-gegl.c',
'photos-glib.c',
'photos-jpeg-count.c',
'photos-operation-insta-curve.c',
'photos-operation-insta-filter.c',
'photos-operation-insta-hefe.c',
'photos-operation-insta-hefe-curve.c',
'photos-operation-insta-hefe-vignette.c',
'photos-operation-jpg-guess-sizes.c',
'photos-operation-png-guess-sizes.c',
'photos-operation-saturation.c',
'photos-operation-svg-multiply.c',
'photos-pipeline.c',
'photos-png-count.c',
'photos-quarks.c',
)
enum_headers = files(
'photos-gesture-zoom.h',
'photos-item-manager.h',
'photos-operation-insta-common.h',
'photos-utils.h',
)
enum = 'photos-enums'
common_sources += gnome.mkenums(
enum,
sources: enum_headers,
c_template: enum + '.c.template',
h_template: enum + '.h.template',
)
resource_data = files('../data/vignette.png')
common_sources += gnome.compile_resources(
'photos-resources-gegl',
'photos-gegl.gresource.xml',
source_dir: '.',
c_name: 'photos_gegl',
dependencies: resource_data,
export: true,
)
thumbnailer_dbus = 'photos-thumbnailer-dbus'
common_sources += gnome.gdbus_codegen(
thumbnailer_dbus,
thumbnailer_dbus + '.xml',
interface_prefix: photos_namespace + '.',
namespace: 'Photos',
annotations: [
[photos_namespace + '.Thumbnailer', 'org.gtk.GDBus.C.Name', 'ThumbnailerDBus'],
[photos_namespace + '.Thumbnailer.GenerateThumbnail()[pipeline_uris]', 'org.gtk.GDBus.C.ForceGVariant', 'true'],
],
autocleanup: 'all',
)
common_deps = [
babl_dep,
gdk_pixbuf_dep,
gegl_dep,
gio_dep,
gio_unix_dep,
glib_dep,
goa_dep,
libdazzle_dep,
libjpeg_dep,
libpng_dep,
m_dep,
tracker_sparql_dep,
]
sources = common_sources + files(
'photos-application.c',
'photos-base-manager.c',
'photos-base-model.c',
'photos-base-item.c',
'photos-camera-cache.c',
'photos-collection-icon-watcher.c',
'photos-create-collection-icon-job.c',
'photos-create-collection-job.c',
'photos-delete-item-job.c',
'photos-delete-notification.c',
'photos-device-item.c',
'photos-dlna-renderer.c',
'photos-dlna-renderers-dialog.c',
'photos-dlna-renderers-manager.c',
'photos-done-notification.c',
'photos-dropdown.c',
'photos-export-dialog.c',
'photos-export-notification.c',
'photos-edit-palette.c',
'photos-edit-palette-row.c',
'photos-embed.c',
'photos-empty-results-box.c',
'photos-error-box.c',
'photos-facebook-item.c',
'photos-fetch-collection-state-job.c',
'photos-fetch-collections-job.c',
'photos-fetch-ids-job.c',
'photos-fetch-metas-job.c',
'photos-filterable.c',
'photos-flickr-item.c',
'photos-gesture-zoom.c',
'photos-google-item.c',
'photos-image-view.c',
'photos-image-view-helper.c',
'photos-import-dialog.c',
'photos-indexing-notification.c',
'photos-item-manager.c',
'photos-local-item.c',
'photos-main-toolbar.c',
'photos-main-window.c',
'photos-media-server-item.c',
'photos-model-button.c',
'photos-notification-manager.c',
'photos-offset-collection-view-controller.c',
'photos-offset-collections-controller.c',
'photos-offset-controller.c',
'photos-offset-favorites-controller.c',
'photos-offset-import-controller.c',
'photos-offset-overview-controller.c',
'photos-offset-search-controller.c',
'photos-organize-collection-dialog.c',
'photos-organize-collection-model.c',
'photos-organize-collection-view.c',
'photos-overview-searchbar.c',
'photos-preview-nav-buttons.c',
'photos-preview-view.c',
'photos-print-notification.c',
'photos-print-operation.c',
'photos-print-preview.c',
'photos-print-setup.c',
'photos-properties-dialog.c',
'photos-query.c',
'photos-query-builder.c',
'photos-remote-display-manager.c',
'photos-removable-device-widget.c',
'photos-removable-devices-button.c',
'photos-search-context.c',
'photos-search-controller.c',
'photos-search-match.c',
'photos-search-match-manager.c',
'photos-search-provider.c',
'photos-search-type.c',
'photos-search-type-manager.c',
'photos-searchbar.c',
'photos-selection-controller.c',
'photos-selection-toolbar.c',
'photos-set-collection-job.c',
'photos-share-dialog.c',
'photos-share-notification.c',
'photos-share-point.c',
'photos-share-point-email.c',
'photos-share-point-google.c',
'photos-share-point-manager.c',
'photos-share-point-online.c',
'photos-single-item-job.c',
'photos-source.c',
'photos-source-manager.c',
'photos-source-notification.c',
'photos-spinner-box.c',
'photos-thumbnail-factory.c',
'photos-tool.c',
'photos-tool-colors.c',
'photos-tool-crop.c',
'photos-tool-crop-helper.c',
'photos-tool-enhance.c',
'photos-tool-filter-button.c',
'photos-tool-filters.c',
'photos-tracker-change-event.c',
'photos-tracker-change-monitor.c',
'photos-tracker-collection-view-controller.c',
'photos-tracker-collections-controller.c',
'photos-tracker-controller.c',
'photos-tracker-favorites-controller.c',
'photos-tracker-import-controller.c',
'photos-tracker-overview-controller.c',
'photos-tracker-search-controller.c',
'photos-tracker-queue.c',
'photos-update-mtime-job.c',
'photos-utils.c',
'photos-view-container.c',
'photos-widget-shader.c',
'photos-zoom-controls.c',
'photos-main.c',
)
photos_generate_about = find_program('photos-generate-about')
about_header = 'photos-about-data.h'
sources += custom_target(
about_header,
output: about_header,
capture: true,
command: [photos_generate_about, '--header'],
)
about_source = 'photos-about-data.c'
sources += custom_target(
about_source,
output: about_source,
capture: true,
command: [photos_generate_about, '--body', artists, authors],
)
marshal = 'photos-marshalers'
sources += gnome.genmarshal(
marshal,
sources: marshal + '.list',
prefix: '_photos_marshal',
)
resource_data = files(
'../data/Adwaita.css',
'../data/dnd-counter.svg',
'../data/icons/image-adjust-color-symbolic.svg',
'../data/icons/image-auto-adjust-symbolic.svg',
'../data/icons/image-crop-symbolic.svg',
'../data/icons/image-denoise-symbolic.svg',
'../data/icons/image-edit-symbolic.svg',
'../data/icons/image-filter-symbolic.svg',
'../data/icons/image-sharpen-symbolic.svg',
'photos-dlna-renderers-dialog.ui',
'photos-dropdown.ui',
'photos-embed.ui',
'photos-export-dialog.ui',
'photos-help-overlay.ui',
'photos-import-dialog.ui',
'photos-main-toolbar.ui',
'photos-main-window.ui',
'photos-menus.ui',
'photos-preview-menu.ui',
'photos-removable-devices-button.ui',
'photos-removable-device-widget.ui',
'photos-selection-menu.ui',
'photos-selection-toolbar.ui',
'photos-share-dialog.ui',
'photos-zoom-controls.ui',
)
sources += gnome.compile_resources(
'photos-resources',
'photos.gresource.xml',
source_dir: '.',
c_name: 'photos',
dependencies: resource_data,
export: true,
)
dleyna_device = 'photos-dleyna-renderer-device'
sources += gnome.gdbus_codegen(
dleyna_device,
dleyna_device + '.xml',
interface_prefix: 'com.intel.dLeynaRenderer.',
namespace: 'Dleyna',
annotations: [
'com.intel.dLeynaRenderer.RendererDevice.GetIcon()[Bytes]', 'org.gtk.GDBus.C.ForceGVariant', 'true'
],
autocleanup: 'all',
)
dleyna_manager = 'photos-dleyna-renderer-manager'
sources += gnome.gdbus_codegen(
dleyna_manager,
dleyna_manager + '.xml',
interface_prefix: 'com.intel.dLeynaRenderer.',
namespace: 'DleynaRenderer',
autocleanup: 'all',
)
dleyna_push_host = 'photos-dleyna-renderer-push-host'
sources += gnome.gdbus_codegen(
dleyna_push_host,
dleyna_push_host + '.xml',
interface_prefix: 'com.intel.dLeynaRenderer.',
namespace: 'DleynaRenderer',
autocleanup: 'all',
)
gom_miner = 'photos-gom-miner'
sources += gnome.gdbus_codegen(
gom_miner,
gom_miner + '.xml',
interface_prefix: 'org.gnome.OnlineMiners.',