From bbcbca9eb1240c3493895dbdcf03a4b2c2803d29 Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Mon, 14 Nov 2022 01:35:12 +0700 Subject: Add meson build support --- cut-n-paste/meson.build | 1 + cut-n-paste/toolbar-editor/meson.build | 27 +++++ data/icons/meson.build | 30 +++++ data/meson.build | 44 +++++++ doc/meson.build | 1 + doc/reference/meson.build | 30 +++++ help/LINGUAS | 1 + help/meson.build | 8 ++ jpegutils/meson.build | 26 +++++ man/meson.build | 1 + meson.build | 207 +++++++++++++++++++++++++++++++++ meson_options.txt | 9 ++ po/meson.build | 3 + src/meson.build | 175 ++++++++++++++++++++++++++++ 14 files changed, 563 insertions(+) create mode 100644 cut-n-paste/meson.build create mode 100644 cut-n-paste/toolbar-editor/meson.build create mode 100644 data/icons/meson.build create mode 100644 data/meson.build create mode 100644 doc/meson.build create mode 100644 doc/reference/meson.build create mode 100644 help/LINGUAS create mode 100644 help/meson.build create mode 100644 jpegutils/meson.build create mode 100644 man/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 po/meson.build create mode 100644 src/meson.build diff --git a/cut-n-paste/meson.build b/cut-n-paste/meson.build new file mode 100644 index 0000000..db067e9 --- /dev/null +++ b/cut-n-paste/meson.build @@ -0,0 +1 @@ +subdir('toolbar-editor') diff --git a/cut-n-paste/toolbar-editor/meson.build b/cut-n-paste/toolbar-editor/meson.build new file mode 100644 index 0000000..3295507 --- /dev/null +++ b/cut-n-paste/toolbar-editor/meson.build @@ -0,0 +1,27 @@ +eggheaders = [ + 'egg-editable-toolbar.h', + 'egg-toolbars-model.h', + 'egg-toolbar-editor.h', +] + +eggmarshalers = gnome.genmarshal('eggmarshalers', sources: ['eggmarshalers.list'], prefix: '_egg_marshal') +eggtypebuiltins = gnome.mkenums_simple('eggtypebuiltins', sources: eggheaders) + +src = [ + eggmarshalers, + eggtypebuiltins, + 'egg-editable-toolbar.c', + 'egg-toolbars-model.c', + 'egg-toolbar-editor.c', + eggheaders, +] + +toolbareditor = static_library( + 'toolbareditor', + src, + dependencies: all_deps, + include_directories: top_inc, + c_args: ['-DCURSOR_DIR="' + pkgdatadir + '"'], +) + +toolbareditor_inc = include_directories('.') diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..c037657 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,30 @@ +actioniconsdir = pkgdatadir / 'icons' / 'hicolor' +appiconsdir = datadir / 'icons' / 'hicolor' + +install_data([ + '16x16/actions/eom-image-collection.png', + '16x16/actions/eom-plugin.png', + '16x16/actions/slideshow-play.png', + '22x22/actions/eom-image-collection.png', + '22x22/actions/eom-plugin.png', + '22x22/actions/slideshow-play.png', + '24x24/actions/eom-image-collection.png', + '24x24/actions/slideshow-play.png', + '32x32/actions/eom-image-collection.png', + '32x32/actions/eom-plugin.png', + '32x32/actions/slideshow-play.png', + '48x48/actions/slideshow-play.png', + 'scalable/actions/eom-image-collection.svg', + 'scalable/actions/eom-plugin.svg', + 'scalable/actions/slideshow-play.svg', +], install_dir: actioniconsdir, preserve_path: true) + +install_data([ + '16x16/apps/eom.png', + '22x22/apps/eom.png', + '24x24/apps/eom.png', + '32x32/apps/eom.png', + 'scalable/apps/eom.svg', +], install_dir: appiconsdir, preserve_path: true) + +meson.add_install_script(find_program('gtk-update-icon-cache'), '-f', '-t', appiconsdir, skip_if_destdir: true) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..468fa88 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,44 @@ +subdir('icons') + +desktopdir = datadir / 'applications' +desktopfile = configure_file(input: 'eom.desktop.in.in', configuration: pkg_info, output: 'eom.desktop.in') + +if get_option('nls') + i18n.merge_file( + input: desktopfile, + output: 'eom.desktop', + install: true, + install_dir: desktopdir, + type: 'desktop', + po_dir: po_dir, + ) +else + install_data(desktopfile, install_dir: desktopdir) +endif +gnome.post_install(update_desktop_database: true) + +appdatadir = join_paths(datadir, 'metainfo') +appdatafile = configure_file(input: 'eom.appdata.xml.in.in', configuration: pkg_info, output: 'eom.appdata.xml.in') + +if get_option('nls') + i18n.merge_file( + input: appdatafile, + output: 'eom.appdata.xml', + install: true, + install_dir: appdatadir, + type: 'xml', + po_dir: po_dir, + ) +else + install_data(appdatafile, install_dir: appdatadir) +endif + +gsettings_schema = configure_file(input: 'org.mate.eom.gschema.xml.in', configuration: pkg_info, output: 'org.mate.eom.gschema.xml') +install_data(gsettings_schema, install_dir: schemadir) +gnome.post_install(glib_compile_schemas: true) + +eom_pc = configure_file(input: 'eom.pc.in', configuration: pkg_info, output: 'eom.pc') +install_data(eom_pc, install_dir: libdir / 'pkgconfig') + +uidir = pkgdatadir +install_data('eom-toolbar.xml', install_dir: uidir) diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 0000000..ead14c4 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1 @@ +subdir('reference') diff --git a/doc/reference/meson.build b/doc/reference/meson.build new file mode 100644 index 0000000..6805b3c --- /dev/null +++ b/doc/reference/meson.build @@ -0,0 +1,30 @@ +ignore_headers = [ + 'eom-image-private.h', + 'eom-image-jpeg.h', + 'eom-marshal.h', + 'eom-application-service.h', + 'eom-enum-types.h', +] + +if not exif.found() + ignore_headers += [ + 'eom-exif-util.h', + 'eom-metadata-details.h', + ] +endif + +sgml = configure_file(input: 'eom-docs.sgml.in', configuration: pkg_info, output: 'eom-docs.sgml') +versionsxml = configure_file(input: 'version.xml.in', configuration: pkg_info, output: 'version.xml') + +gnome.gtkdoc( + 'eom', + src_dir: src_inc, + include_directories: include_dirs, + main_sgml: 'eom-docs.sgml.in', + scan_args: ['--rebuild-types'], + mkdb_args: ['--sgml-mode', '--output-format=xml'], + ignore_headers: ignore_headers, + content_files: [versionsxml], + dependencies: [all_deps, libeom], + install: true, +) diff --git a/help/LINGUAS b/help/LINGUAS new file mode 100644 index 0000000..5a8b5f2 --- /dev/null +++ b/help/LINGUAS @@ -0,0 +1 @@ +af am ar as ast be bg bn bn_IN br ca ca@valencia cmn cs da de dz el en_AU en_CA en_GB eo es_AR es et eu fi fr fur ga gl gu he hi hr hu hy id ie is it ja kab ka kk kn ko ku ky lt lv mai mk ml mr ms nb ne nl nn oc or pa pl ps pt_BR pt ro ru si sk sl sq sr@latin sr sv ta te th tr uk uz vi zh_CN zh_HK zh_TW diff --git a/help/meson.build b/help/meson.build new file mode 100644 index 0000000..c9123d2 --- /dev/null +++ b/help/meson.build @@ -0,0 +1,8 @@ +gnome.yelp('eom', + sources: ['index.docbook', 'legal.xml'], + media: [ + 'figures/eom_save_as_window.png', + 'figures/eom_start_window.png', + 'figures/eom_toolbar_editor_window.png', + ], +) diff --git a/jpegutils/meson.build b/jpegutils/meson.build new file mode 100644 index 0000000..7260e8c --- /dev/null +++ b/jpegutils/meson.build @@ -0,0 +1,26 @@ +src = [ + 'jpegint.h', + 'transupp.h', +] + +if jpeg_80 + src += [ + 'jpegint-8a.h', + 'transupp-8a.c', + 'transupp-8a.h', + ] +else + src += [ + 'transupp-6b.c', + 'transupp-6b.h', + ] +endif + +jpegutils = static_library( + 'eom-jpegutils', + src, + dependencies: all_deps, + include_directories: top_inc, +) + +jpegutils_inc = include_directories('.') diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 0000000..f83d595 --- /dev/null +++ b/man/meson.build @@ -0,0 +1 @@ +install_man('eom.1') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..bbb0f92 --- /dev/null +++ b/meson.build @@ -0,0 +1,207 @@ +project('eom','c', + version: '1.27.0', + meson_version: '>=0.64.0', + license: 'GPLv2+', +) + +eom_api_version = '2.20' + +cc = meson.get_compiler('c') + +i18n = import('i18n') +gnome = import('gnome') + +top_inc = include_directories('.') +po_dir = meson.project_source_root() / 'po' +datadir = join_paths(get_option('prefix'), get_option('datadir')) +pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'eom') +bindir = get_option('prefix') / 'bin' +libdir = join_paths(get_option('prefix'), get_option('libdir')) +schemadir = datadir / 'glib-2.0' / 'schemas' +localedir = join_paths(get_option('prefix'), get_option('localedir')) +includedir = join_paths(get_option('prefix'), get_option('includedir')) + +# Dependencies +glib_required = '2.52.0' +gtk_required = '3.22.0' +libpeas_required = '1.8.0' + +gio = dependency('gio-2.0', version: '>= ' + glib_required) +gio_unix = dependency('gio-unix-2.0', version: '>= ' + glib_required) +gthread = dependency('gthread-2.0', version: '>= ' + glib_required) +gdk = dependency('gdk-3.0') +gdk_pixbuf = dependency('gdk-pixbuf-2.0', version : '>=2.36.5') +glib = dependency('glib-2.0', version: '>= 2.52.0') +gtk = dependency('gtk+-3.0', version : '>= ' + gtk_required) +gtk_unix_print = dependency('gtk+-unix-print-3.0', version : '>= ' + gtk_required) +gmodule = dependency('gmodule-2.0', required : false) +mate_desktop = dependency('mate-desktop-2.0', version : '>=1.17.0') +shared_mime_info = dependency('shared-mime-info', version : '>= 0.20') +libpeas = dependency('libpeas-1.0', version : '>= ' + libpeas_required) +libpeas_gtk = dependency('libpeas-gtk-1.0', version : '>= ' + libpeas_required) +xml = dependency('libxml-2.0', version: '>=2.0') +gobject_introspection = dependency('gobject-introspection-1.0', version : '>= 0.9.3', required : false) +xmp = dependency('exempi-2.0', version: '>= 1.99.5', required : get_option('xmp')) +exif = dependency('libexif', version: '>= 0.6.14', required : get_option('libexif')) +rsvg = dependency('librsvg-2.0', version: '>= 2.36.2', required : get_option('librsvg'), not_found_message : 'LIBRSVG support disabled, svg files will not scale') + +all_deps = [ + gio, gio_unix, gthread, gdk, glib, + gtk, gtk_unix_print, gmodule, mate_desktop, + gdk_pixbuf, shared_mime_info, libpeas, libpeas_gtk, + xml, gobject_introspection, xmp, exif, rsvg, +] + +z = dependency('zlib') +assert(cc.has_function('crc32', dependencies: [z]), 'zlib do not have crc32') +all_deps += [z] + +jpeg = dependency('libjpeg', required : get_option('jpeg')) +if jpeg.found() and ( + not cc.has_function('jpeg_destroy_decompress', dependencies: [jpeg]) + or not cc.has_header('jpeglib.h', dependencies: [jpeg]) +) + jpeg = disabler() + warn('JPEG loader will not be built (JPEG library not found)') +endif +jpeg_has_progressive = false +if jpeg.found() + if cc.has_function('jpeg_simple_progression', dependencies: [jpeg]) + jpeg_has_progressive = true + else + warn('JPEG library does not support progressive saving') + endif + + jpeg_lib_version = cc.get_define('JPEG_LIB_VERSION', dependencies: [jpeg], prefix: '#include ').to_int() + jpeg_80 = jpeg_lib_version >= 80 +endif + +assert(jpeg.found() or get_option('jpeg').disabled(), 'Checks for JPEG loader failed. You can build without it by passing -D jpeg=disabled but some programs using GTK+ may not work properly') +all_deps += [jpeg] + +cms = dependency('lcms2', required : get_option('cms')) +all_deps += [cms] +gdk_target_has_x11 = gdk.get_variable('targets').split(' ').contains('x11') +if cms.found() or gdk_target_has_x11 + x11 = dependency('x11') + all_deps += [x11] +endif + +package_url = 'https://mate-desktop.org' +pkg_info = configuration_data({ + 'PACKAGE_URL': package_url, + 'VERSION': meson.project_version(), + 'GETTEXT_PACKAGE': meson.project_name(), + 'prefix': get_option('prefix'), + 'exec_prefix': get_option('prefix'), + 'libdir': libdir, + 'includedir': includedir, + 'pluginsdir': includedir / 'eom' / 'plugins', + 'EOM_API_VERSION': eom_api_version, +}) + +if exif.found() or xmp.found() + pkg_info.set('EOM_DOC_EXIF_START', '') + pkg_info.set('EOM_DOC_EXIF_STOP', '') +else + pkg_info.set('EOM_DOC_EXIF_START', '') +endif + +conf = configuration_data() + +conf.set_quoted('PACKAGE', meson.project_name()) +conf.set_quoted('PACKAGE_URL', package_url) +conf.set_quoted('VERSION', meson.project_version()) +version_parts = meson.project_version().split('.') +conf.set('EOM_MAJOR_VERSION', version_parts[0]) +conf.set('EOM_MINOR_VERSION', version_parts[1]) +conf.set('EOM_MICRO_VERSION', version_parts[2]) + +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +if get_option('nls') + conf.set('ENABLE_NLS', 1) +endif +if cc.has_function('strptime') + conf.set('HAVE_STRPTIME', 1) +endif +if cc.has_header_symbol('langinfo.h', '_NL_MEASUREMENT_MEASUREMENT', required: false) + conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1) +endif + +if get_option('thumbnailer') + if get_option('gdk-pixbuf-thumbnailer') + eom_thumbnailer = find_program('gdk-pixbuf-thumbnailer') + else + magick = dependency('MagickWand', version : '>= 6.2.6') + if magick.version().version_compare('>= 7') + conf.set('HAVE_IMAGEMAGICK7', 1) + else + conf.set('HAVE_IMAGEMAGICK6', 1) + endif + #all_deps += [magick] + eom_thumbnailer = 'eom-thumbnailer' + endif +endif + +# XMP support +if xmp.found() + conf.set('HAVE_EXEMPI', 1) +endif +# EXIF support +if exif.found() + conf.set('HAVE_EXIF', 1) +endif +# JPEG support +if jpeg.found() + conf.set('HAVE_JPEG', 1) + conf.set('HAVE_LIBJPEG', 1) +endif +# Jpeg Progressive Saving Support +if jpeg_has_progressive + conf.set('HAVE_PROGRESSIVE_JPEG', 1) +endif +# Little CMS support +if cms.found() + conf.set('HAVE_LCMS', 1) +endif +# RSVG Support +if rsvg.found() + conf.set('HAVE_RSVG', 1) +endif +# Enable GObject Introspection +if gobject_introspection.found() + conf.set('HAVE_INTROSPECTION', 1) +endif + +conf_file = configure_file(output : 'config.h', configuration : conf) +add_project_arguments('-DHAVE_CONFIG_H', language : 'c') + +summary({ + 'EXIF support': exif.found(), + 'XMP support': xmp.found(), + 'JPEG support': jpeg.found(), + 'RSVG support': rsvg.found(), + 'Colour management support': cms.found(), + 'GObject Introspection': gobject_introspection.found(), + 'Native Language support': get_option('nls'), + 'Thumbnailer': eom_thumbnailer, +}) + +if get_option('nls') + subdir('po') +endif + +if jpeg.found() + subdir('jpegutils') +endif + +subdir('cut-n-paste') +subdir('src') +subdir('man') +#subdir('plugins') +subdir('help') +subdir('data') +subdir('doc') + +# TODO: Changelog diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..254cb66 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,9 @@ +option('nls', type : 'boolean', value : true, description : 'Native language support') +option('thumbnailer', type : 'boolean', value: true) +option('gdk-pixbuf-thumbnailer', type : 'boolean', value: true, description: 'Use gdk-pixbuf-thumbnailer') + +option('xmp', type : 'feature', description : 'Special XMP support') +option('libexif', type : 'feature', description : 'EXIF support') +option('cms', type : 'feature', description : 'Colour management support') +option('jpeg', type : 'feature', description : 'Special JPEG support') +option('librsvg', type : 'feature', description : 'RSVG support') diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..f904cde --- /dev/null +++ b/po/meson.build @@ -0,0 +1,3 @@ +i18n.gettext(meson.project_name(), + preset: 'glib' +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..8c81e39 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,175 @@ +resources = gnome.compile_resources( + 'eom', + 'eom.gresource.xml', + c_name: '_eom', + source_dir: '../data', +) + +marshal = gnome.genmarshal('eom-marshal', sources: ['eom-marshal.list'], prefix: 'eom_marshal') + +inst_headers = [ + 'eom-application.h', + 'eom-application-activatable.h', + 'eom-debug.h', + 'eom-window.h', + 'eom-window-activatable.h', + 'eom-sidebar.h', + 'eom-properties-dialog.h', + 'eom-error-message-area.h', + 'eom-file-chooser.h', + 'eom-statusbar.h', + 'eom-thumb-nav.h', + 'eom-transform.h', + 'eom-image.h', + 'eom-enums.h', + 'eom-image-save-info.h', + 'eom-scroll-view.h', + 'eom-thumb-view.h', + 'eom-list-store.h', + 'eom-thumbnail.h', + 'eom-job-queue.h', + 'eom-clipboard-handler.h', + 'eom-jobs.h', +] + +noinst_headers = [ + 'eom-application-internal.h', + 'eom-session.h', + 'eom-util.h', + 'eom-pixbuf-util.h', + 'eom-preferences-dialog.h', + 'eom-config-keys.h', + 'eom-image-jpeg.h', + 'eom-image-private.h', + 'eom-metadata-sidebar.h', + 'eom-uri-converter.h', + 'eom-metadata-reader.h', + 'eom-metadata-reader-jpg.h', + 'eom-metadata-reader-png.h', + 'eom-save-as-dialog-helper.h', + 'eom-print-image-setup.h', + 'eom-print-preview.h', + 'eom-print.h', + 'eom-plugin-engine.h', + 'eom-close-confirmation-dialog.h', + 'zoom.h', +] + +enum = gnome.mkenums('eom-enum-types', c_template: 'eom-enum-types.c.template', h_template: 'eom-enum-types.h.template', sources: inst_headers) + +c_sources = [ + 'eom-application.c', + 'eom-application-activatable.c', + 'eom-session.c', + 'eom-debug.c', + 'eom-util.c', + 'eom-pixbuf-util.c', + 'eom-window.c', + 'eom-window-activatable.c', + 'eom-sidebar.c', + 'eom-preferences-dialog.c', + 'eom-properties-dialog.c', + 'eom-error-message-area.c', + 'eom-file-chooser.c', + 'eom-statusbar.c', + 'eom-thumb-nav.c', + 'eom-transform.c', + 'eom-image.c', + 'eom-image-jpeg.c', + 'eom-image-save-info.c', + 'eom-scroll-view.c', + 'eom-thumb-view.c', + 'eom-list-store.c', + 'eom-metadata-sidebar.c', + 'eom-thumbnail.c', + 'eom-job-queue.c', + 'eom-jobs.c', + 'eom-uri-converter.c', + 'eom-metadata-reader.c', + 'eom-metadata-reader-jpg.c', + 'eom-metadata-reader-png.c', + 'eom-save-as-dialog-helper.c', + 'eom-print-image-setup.c', + 'eom-print-preview.c', + 'eom-print.c', + 'eom-close-confirmation-dialog.c', + 'eom-plugin-engine.c', + 'eom-clipboard-handler.c', + 'zoom.c', +] + +libeom_src = [ + c_sources, + enum, + resources, + marshal, + noinst_headers, + inst_headers, +] + +if exif.found() + inst_headers += ['eom-exif-util.h'] + noinst_headers += ['eom-metadata-details.h'] + libeom_src += [ + 'eom-metadata-details.c', + 'eom-exif-util.c', + ] +endif + +if xmp.found() + noinst_headers += ['eom-metadata-details.h'] + libeom_src += ['eom-metadata-details.c'] +endif + +cflags = [ + '-DG_LOG_DOMAIN="EOM"', + '-DEOM_DATA_DIR="' + pkgdatadir + '"', + '-DEOM_LOCALE_DIR="' + localedir + '"', + '-DEOM_PLUGIN_DIR="' + (libdir / 'eom' / 'plugins') + '"', + '-DLIBDIR="' + libdir + '"', +] + +include_dirs = [top_inc, toolbareditor_inc] + +if jpeg.found() + include_dirs += [jpegutils_inc] +endif + +libeom = static_library( + 'eom', + libeom_src, + c_args: cflags, + dependencies: all_deps, + include_directories: include_dirs, +) + +src_inc = include_directories('.') + +install_headers(inst_headers, install_dir: join_paths(includedir, 'eom-' + eom_api_version, 'eom')) + +eom_links = [libeom, toolbareditor] + +if jpeg.found() + eom_links += [jpegutils] +endif + +bin = executable( + 'eom', ['main.c', resources], + install: true, + c_args: cflags, + dependencies: all_deps, + link_with: eom_links, + include_directories: include_dirs, +) + +if gobject_introspection.found() + gir = gnome.generate_gir( + bin, + includes: ['Gtk-3.0'], + sources: [inst_headers, c_sources, enum, resources, marshal], + include_directories: include_dirs, + install: true, + namespace: 'Eom', + nsversion: '1.0', + ) +endif -- cgit v1.2.1