From aaa2934acfb53243d21a4a68ac6486951ae4b045 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 3 Oct 2020 21:06:43 +1000 Subject: [PATCH 1/5] meson_options.txt: Update to use meson best practices and clean up Convert to use meson features for features. Reorganise and rename options for consistency. Make descriptions a bit less redundant. --- desktop/meson.build | 2 +- meson.build | 27 +++++++--------- meson_options.txt | 73 ++++++++++++++++++++++++------------------ src/engine/meson.build | 2 +- src/meson.build | 4 +-- test/meson.build | 2 +- 6 files changed, 58 insertions(+), 52 deletions(-) diff --git a/desktop/meson.build b/desktop/meson.build index f0c8a660..712db358 100644 --- a/desktop/meson.build +++ b/desktop/meson.build @@ -77,7 +77,7 @@ endif # Contractor file (Elementary OS) # -if install_contractor_file +if get_option('contractor').enabled() # Call msgfmt manually since gettext won't otherwise translate the # Description field. See merge req !50. msgfmt = find_program('msgfmt') diff --git a/meson.build b/meson.build index 240eacaa..82f0439d 100644 --- a/meson.build +++ b/meson.build @@ -4,13 +4,6 @@ project('geary', [ 'vala', 'c' ], meson_version: '>= 0.50', ) -# Build-time configuration options -enable_valadoc = get_option('valadoc') -install_contractor_file = get_option('contractor') -iso_3166_xml = get_option('iso_3166_xml') -iso_639_xml = get_option('iso_639_xml') -reference_tracking = get_option('ref_tracking') - # Build type if get_option('profile') == 'development' profile = '.Devel' @@ -92,13 +85,13 @@ libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.24.0') libsecret = dependency('libsecret-1', version: '>= 0.11') libsoup = dependency('libsoup-2.4', version: '>= 2.48') libunwind_dep = dependency( - 'libunwind', version: '>= 1.1', required: not get_option('libunwind_optional') + 'libunwind', version: '>= 1.1', required: get_option('libunwind') ) libunwind_generic_dep = dependency( - 'libunwind-generic', version: '>= 1.1', required: not get_option('libunwind_optional') + 'libunwind-generic', version: '>= 1.1', required: get_option('libunwind') ) libxml = dependency('libxml-2.0', version: '>= 2.7.8') -libytnef = dependency('libytnef', version: '>= 1.9.3', required: get_option('tnef-support')) +libytnef = dependency('libytnef', version: '>= 1.9.3', required: get_option('tnef')) posix = valac.find_library('posix') webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '>=' + target_webkit) @@ -153,27 +146,31 @@ endif # Build glue # +valadoc = find_program('valadoc', required: get_option('valadoc')) + vala_unit_proj = subproject( 'vala-unit', default_options: [ 'install=false', - 'valadoc=@0@'.format(enable_valadoc) + 'valadoc=@0@'.format(valadoc.found()) ] ) vala_unit_dep = vala_unit_proj.get_variable('vala_unit_dep') -if enable_valadoc - valadoc = find_program('valadoc') -endif - # Language detection + iso_codes_dir = iso_codes.get_pkgconfig_variable('prefix')/'share'/'xml'/'iso-codes' + +iso_639_xml = get_option('iso_639_xml') if iso_639_xml == '' iso_639_xml = iso_codes_dir / 'iso_639.xml' endif + +iso_3166_xml = get_option('iso_3166_xml') if iso_3166_xml == '' iso_3166_xml = iso_codes_dir / 'iso_3166.xml' endif + files(iso_639_xml, iso_3166_xml) # Check to make sure these exist # Post-install scripts diff --git a/meson_options.txt b/meson_options.txt index a18438d4..968c2541 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,11 +1,18 @@ # # General build options # + option( - 'contractor', - type: 'boolean', - value: false, - description: 'Whether to install the contractor file (Elementary OS-specific).' + 'profile', + type: 'combo', + value: 'default', + choices: ['default','development','beta'], + description: 'Specifies the application type to be built' +) +option( + 'revno', + type: 'string', + description: 'Custom revision string (default extracted from "git describe")' ) option( 'iso_639_xml', @@ -19,41 +26,43 @@ option( value: '', description: 'Full path to the ISO 3166 XML file.' ) -option( - 'libunwind_optional', - type: 'boolean', - value: false, - description: 'Determines if libunwind is required.' -) -option( - 'tnef-support', - type: 'boolean', - value: true, - description: 'Whether to support TNEF attachments (requires libytnef).' -) option( 'valadoc', - type: 'boolean', - value: false, - description: 'Whether to build the documentation (requires valadoc).' + type: 'feature', + value: 'auto', + description: 'Build API documentation' ) +# # Development options -option( - 'profile', - type: 'combo', - value: 'default', - choices: ['default','development','beta'], - description: 'Specifies the application type to be built' -) +# + option( 'ref_tracking', - type: 'boolean', - value: false, - description: 'Whether to use explicit reference tracking.' + type: 'feature', + value: 'disabled', + description: 'Enable Geary.BaseObject reference tracking' +) + +# +# Optional features +# + +option( + 'contractor', + type: 'feature', + value: 'disabled', + description: 'Install an Elementary OS a contractor file' ) option( - 'revno', - type: 'string', - description: 'Custom revision string (default extracted from "git describe")' + 'libunwind', + type: 'feature', + value: 'enabled', + description: 'Use libunwind for back traces in problem reports.' +) +option( + 'tnef', + type: 'feature', + value: 'enabled', + description: 'Support Microsoft-proprietary TNEF attachments.' ) diff --git a/src/engine/meson.build b/src/engine/meson.build index 0efd773e..1133f7b8 100644 --- a/src/engine/meson.build +++ b/src/engine/meson.build @@ -349,7 +349,7 @@ if libunwind_dep.found() ] endif -if get_option('tnef-support') +if libytnef.found() engine_dependencies += libytnef engine_vala_args += [ '-D', 'WITH_TNEF_SUPPORT' diff --git a/src/meson.build b/src/meson.build index 225777e8..14f08c18 100644 --- a/src/meson.build +++ b/src/meson.build @@ -33,7 +33,7 @@ endif # Symbols for valac's preprocessor must be defined as compiler args, # not in the code or in config.h -if reference_tracking +if get_option('ref_tracking').enabled() geary_vala_args += [ '--define=REF_TRACKING' ] endif @@ -157,7 +157,7 @@ foreach dir : valadoc_vapi_dirs valadoc_vapidir_args += '--vapidir=@0@'.format(dir) endforeach -if enable_valadoc +if valadoc.found() docs = custom_target('valadoc', build_by_default: true, depends: [client_lib, engine_lib], diff --git a/test/meson.build b/test/meson.build index fe3040dd..a32b2a82 100644 --- a/test/meson.build +++ b/test/meson.build @@ -118,7 +118,7 @@ test_engine_dependencies += engine_dependencies test_engine_vala_args = geary_vala_args -if get_option('tnef-support') +if libytnef.found() test_engine_dependencies += libytnef test_engine_vala_args += [ '-D', 'WITH_TNEF_SUPPORT' From 23bd2507a7512664802db41b88ad375298d6b7d0 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 3 Oct 2020 21:59:01 +1000 Subject: [PATCH 2/5] build: Update how build profiles are handled Default to development build profile if a `.git` directory exists, else error out of build configuration. This make `auto` the default build profile and if set and a `.git` directory is present default to `development`, else raise an error. Add some docs to INSTALL describing build profiles and update how they are used in the source to match. --- INSTALL | 26 +++++++++++++++-- meson.build | 28 +++++++++++++------ meson_options.txt | 8 ++++-- .../application/application-main-window.vala | 2 +- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/INSTALL b/INSTALL index 6572303f..e445a409 100644 --- a/INSTALL +++ b/INSTALL @@ -15,6 +15,28 @@ repository: A convenience Makefile for development only is also provided. To use it, simply invoke make from the top-level directory. +Build profiles +-------------- + +Geary can be built using a number of different build profiles, which +determine things like the application id, the location of stored data, +the name of the application and other visual elements that distinguish +release builds from other types. + +These can be set at build configuration time using the Meson `setup` +and `configure` commands, using the standard `-Dprofile=…` option. See +the `profile` option in `meson_options.txt` for the current list of +supported types. + +Maintainers must select the `release` build profile when packaging +non-test release builds, otherwise Geary will using branding and data +locations intended for development only. + +Note that setting the profile does not alter such things as cmopiler +options, use the standard Meson `--buildtype` argument for that. + +If built from + Dependencies ------------ @@ -94,5 +116,5 @@ the initial configuration step: meson --prefix=/usr -C build --- -Copyright 2016 Software Freedom Conservancy Inc. -Copyright 2018 Michael Gratton +Copyright © 2016 Software Freedom Conservancy Inc. +Copyright © 2018-2020 Michael Gratton diff --git a/meson.build b/meson.build index 82f0439d..1dc9e3aa 100644 --- a/meson.build +++ b/meson.build @@ -4,16 +4,26 @@ project('geary', [ 'vala', 'c' ], meson_version: '>= 0.50', ) -# Build type -if get_option('profile') == 'development' - profile = '.Devel' +# Determine the type of build +profile = get_option('profile') +appid_suffix = '' +name_suffix = '' +if profile == 'auto' + if run_command('[', '-d', '.git', ']').returncode() == 0 + profile = 'development' + else + error('No build profile specified, see INSTALL') + endif +endif + +if profile == 'development' + appid_suffix = '.Devel' name_suffix = ' (Development)' -elif get_option('profile') == 'beta' - profile = '.Beta' +elif profile == 'beta' + appid_suffix = '.Beta' name_suffix = ' (Beta)' -else - profile = '' - name_suffix = '' +elif profile != 'release' + error('Unknown build profile specified, see INSTALL') endif # Configurable install dirs @@ -120,7 +130,7 @@ libmessagingmenu_dep = dependency('messaging-menu', version: '>= 12.10', require # # Build variables -geary_id = 'org.gnome.Geary@0@'.format(profile) +geary_id = 'org.gnome.Geary@0@'.format(appid_suffix) geary_version = meson.project_version() revno = get_option('revno') if revno == '' diff --git a/meson_options.txt b/meson_options.txt index 968c2541..fcb8b9bf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,8 +5,12 @@ option( 'profile', type: 'combo', - value: 'default', - choices: ['default','development','beta'], + choices: [ + 'auto', + 'development', + 'beta', + 'release' + ], description: 'Specifies the application type to be built' ) option( diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index 47749019..aba5fa26 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -487,7 +487,7 @@ public class Application.MainWindow : load_config(application.config); restore_saved_window_state(); - if (_PROFILE != "") { + if (_PROFILE != "release") { this.get_style_context().add_class("devel"); } From 456b6cd55ab4feb5c4c079df2b6aacbcfb69f246 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 3 Oct 2020 22:04:12 +1000 Subject: [PATCH 3/5] Application.Client: Sort external const alphabetically --- src/client/application/application-client.vala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala index 2bf4e094..7a450fa2 100644 --- a/src/client/application/application-client.vala +++ b/src/client/application/application-client.vala @@ -7,18 +7,18 @@ */ // Defined by CMake build script. -extern const string _INSTALL_PREFIX; -extern const string _GSETTINGS_DIR; -extern const string _WEB_EXTENSIONS_DIR; -extern const string _PLUGINS_DIR; -extern const string _SOURCE_ROOT_DIR; -extern const string _BUILD_ROOT_DIR; extern const string GETTEXT_PACKAGE; extern const string _APP_ID; +extern const string _BUILD_ROOT_DIR; +extern const string _GSETTINGS_DIR; +extern const string _INSTALL_PREFIX; extern const string _NAME_SUFFIX; +extern const string _PLUGINS_DIR; extern const string _PROFILE; -extern const string _VERSION; extern const string _REVNO; +extern const string _SOURCE_ROOT_DIR; +extern const string _VERSION; +extern const string _WEB_EXTENSIONS_DIR; /** From c240884f521da7356d9c5792a7568abc2dba5b38 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 3 Oct 2020 23:31:35 +1000 Subject: [PATCH 4/5] Rename INSTALLING to BUILDING.md Renamed since most people want to know how to build Geary when they get its source, not install it. Use MD extension to get formatting in gitlab. --- BUILDING.md | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ INSTALL | 120 --------------------------------------------------- README.md | 9 ++-- meson.build | 4 +- 4 files changed, 129 insertions(+), 126 deletions(-) create mode 100644 BUILDING.md delete mode 100644 INSTALL diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 00000000..c00b1901 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,122 @@ +Building and running Geary +========================== + +Geary uses the [Meson](http://mesonbuild.com) and +[Ninja](https://ninja-build.org) build systems. You will need these +and a number of other development libraries installed to build +Geary. See the Dependencies section below for a list of packages to +install. + +Building, running, tests and documentation +------------------------------------------ + +To build Geary, run the following commands from the top-level +directory of the source code repository: + +``` +meson build +ninja -C build +``` + +Once built, Geary can be run directly from the build directory without +being installed: + +``` +./build/src/geary +``` + +Note that certain desktop integration (such as being listed in an +application menu) requires full installation to work correctly. + +To run the unit tests, use the Meson `test` command: + +``` +meson test -C build +``` + +API documentation will be built if `valadoc` is installed. + +Consult the Meson documentation for information about configuring the +build, installing, and so on. + +Build profiles +-------------- + +Geary can be built using a number of different build profiles, which +determine things like the application id, the location of stored data, +the name of the application, icon and other visual elements. + +These can be set at build configuration time using the Meson `setup` +and `configure` commands, using the standard `-Dprofile=…` option. See +the `profile` option in `meson_options.txt` for the current list of +supported types. + +Maintainers must use the `release` build profile when packaging Geary, +otherwise when run it will use branding and data locations intended +for development only. + +Note that setting the profile does not alter such things as compiler +options, use the standard Meson `--buildtype` argument for that. + +Consult the Meson documentation for more information about configuring +options. + +Dependencies +------------ + +Building Geary requires the following major libraries and tools: + + * GTK+ 3 + * WebKitGTK+ 2 + * SQLite 3 + * Vala + +See the `meson.build` file in the top-level directory for the complete +list of required dependencies and minimum versions. + +Geary also requires SQLite to be built with the compiler flag +`-DSQLITE_ENABLE_FTS3`. + +All required libraries and tools are available from major Linux +distribution's package repositories: + +Installing dependencies on Fedora +--------------------------------- + +Install them by running this command: + +``` +sudo dnf install meson vala desktop-file-utils enchant2-devel \ + folks-devel gcr-devel glib2-devel gmime30-devel \ + gnome-online-accounts-devel gspell-devel gsound-devel \ + gtk3-devel iso-codes-devel itstool json-glib-devel \ + libappstream-glib-devel libgee-devel libhandy1-devel \ + libpeas-devel libsecret-devel libunwind-devel libxml2-devel \ + libytnef-devel sqlite-devel webkitgtk4-devel +``` + +Installing dependencies on Ubuntu/Debian +---------------------------------------- + +Install them by running this command: + +``` +sudo apt-get install meson build-essential valac \ + desktop-file-utils iso-codes gettext itstool \ + libappstream-glib-dev libenchant-2-dev libfolks-dev \ + libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-3.0-dev \ + libgoa-1.0-dev libgspell-1-dev libgsound-dev libgtk-3-dev \ + libjson-glib-dev libhandy-1-dev libpeas-dev libsecret-1-dev \ + libsqlite3-dev libunwind-dev libwebkit2gtk-4.0-dev libxml2-dev \ + libytnef0-dev +``` + +And for Ubuntu Messaging Menu integration: + +``` +sudo apt-get install libmessaging-menu-dev +``` + +--- +Copyright © 2016 Software Freedom Conservancy Inc. +Copyright © 2018-2020 Michael Gratton diff --git a/INSTALL b/INSTALL deleted file mode 100644 index e445a409..00000000 --- a/INSTALL +++ /dev/null @@ -1,120 +0,0 @@ -Building & Installing Geary -=========================== - -Building --------- - -Geary uses the Meson and Ninja - build systems. To build Geary, run the -following commands from the top-level directory of the source code -repository: - - meson build - ninja -C build - -A convenience Makefile for development only is also provided. To use -it, simply invoke make from the top-level directory. - -Build profiles --------------- - -Geary can be built using a number of different build profiles, which -determine things like the application id, the location of stored data, -the name of the application and other visual elements that distinguish -release builds from other types. - -These can be set at build configuration time using the Meson `setup` -and `configure` commands, using the standard `-Dprofile=…` option. See -the `profile` option in `meson_options.txt` for the current list of -supported types. - -Maintainers must select the `release` build profile when packaging -non-test release builds, otherwise Geary will using branding and data -locations intended for development only. - -Note that setting the profile does not alter such things as cmopiler -options, use the standard Meson `--buildtype` argument for that. - -If built from - -Dependencies ------------- - -Building Geary requires the following major libraries and tools: - - * GTK+ 3 - * WebKitGTK+ 2 - * SQLite 3 - * Vala - -See the `meson.build` file in the top-level directory for the complete -list of required dependencies and minimum versions. - -Geary also requires SQLite to be built with the compiler flag -`-DSQLITE_ENABLE_FTS3`. - -All required libraries and tools are available from major Linux -distribution's package repositories: - -Installing dependencies on Fedora ---------------------------------- - -Install them by running this command: - - sudo dnf install meson vala desktop-file-utils enchant2-devel \ - folks-devel gcr-devel glib2-devel gmime30-devel \ - gnome-online-accounts-devel gspell-devel gsound-devel \ - gtk3-devel iso-codes-devel itstool json-glib-devel \ - libappstream-glib-devel libgee-devel libhandy1-devel \ - libpeas-devel libsecret-devel libunwind-devel libxml2-devel \ - libytnef-devel sqlite-devel webkitgtk4-devel - -Installing dependencies on Ubuntu/Debian ----------------------------------------- - -Install them by running this command: - - sudo apt-get install meson build-essential valac \ - desktop-file-utils iso-codes gettext itstool \ - libappstream-glib-dev libenchant-2-dev libfolks-dev \ - libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-3.0-dev \ - libgoa-1.0-dev libgspell-1-dev libgsound-dev libgtk-3-dev \ - libjson-glib-dev libhandy-1-dev libpeas-dev libsecret-1-dev \ - libsqlite3-dev libunwind-dev libwebkit2gtk-4.0-dev libxml2-dev \ - libytnef0-dev - -And for Ubuntu Messaging Menu integration: - - sudo apt-get install libmessaging-menu-dev - -Running -------- - -If you wish to try Geary before installing it, you may execute it directly -from its build directory: - - ./build/src/geary - -Note that certain desktop integration (such as being listed in an -application menu) requires full installation. - -Installation ------------- - -After Geary has built, install it by invoking the install target: - - ninja -C build install - -After installation, it can be uninstalled in the same way: - - ninja -C build uninstall - -By default, Geary will install under /usr/local. To install to a -different directory, set pass the --prefix to meson when performing -the initial configuration step: - - meson --prefix=/usr -C build - ---- -Copyright © 2016 Software Freedom Conservancy Inc. -Copyright © 2018-2020 Michael Gratton diff --git a/README.md b/README.md index d99cd8aa..73c4e595 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,12 @@ for more information. ![Geary displaying a conversation](https://wiki.gnome.org/Apps/Geary?action=AttachFile&do=get&target=geary-3-32-main-window.png) -Installation & Licensing ------------------------- +Building & Licensing +-------------------- -Please consult the [INSTALL](./INSTALL) and [COPYING](./COPYING) files -for more information. +Please consult the [BUILDING.md](./BUILDING.md) and +[COPYING](./COPYING) files for more information about building Geary +and the licence granted by its copyright holders for redistribution. Getting in Touch ---------------- diff --git a/meson.build b/meson.build index 1dc9e3aa..54bccfec 100644 --- a/meson.build +++ b/meson.build @@ -12,7 +12,7 @@ if profile == 'auto' if run_command('[', '-d', '.git', ']').returncode() == 0 profile = 'development' else - error('No build profile specified, see INSTALL') + error('No build profile specified, see BUILDING.md') endif endif @@ -23,7 +23,7 @@ elif profile == 'beta' appid_suffix = '.Beta' name_suffix = ' (Beta)' elif profile != 'release' - error('Unknown build profile specified, see INSTALL') + error('Unknown build profile specified, see BUILDING.md') endif # Configurable install dirs From 436c22a4ada3538f7a624c654557471ef0099530 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 3 Oct 2020 23:33:41 +1000 Subject: [PATCH 5/5] README.md: Minor improvements --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 73c4e595..6ffcb86b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Geary: Send and receive email Geary is an email application built around conversations, for the GNOME 3 desktop. It allows you to read, find and send email with a -straightforward, modern interface. +straight-forward, modern interface. Visit https://wiki.gnome.org/Apps/Geary for more information. @@ -31,7 +31,8 @@ Getting in Touch * Support and discussion: See the `geary` tag on [GNOME Discourse](https://discourse.gnome.org/tags/c/applications/7/geary) * Matrix channel: [#geary:gnome.org](https://gnome.element.io/#/room/#geary:gnome.org) -**Code Of Conduct** +Code Of Conduct +--------------- We follow the [Contributor Covenant](./code-of-conduct.md) as our Code of Conduct. All communications in project spaces are expected to @@ -48,5 +49,5 @@ Want to help improve Geary? Here are some ways to contribute: * Donate: https://wiki.gnome.org/Apps/Geary/Donate --- -Copyright 2016 Software Freedom Conservancy Inc. -Copyright 2017-2020 Michael Gratton +Copyright © 2016 Software Freedom Conservancy Inc. +Copyright © 2017-2020 Michael Gratton