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 6572303f..00000000 --- a/INSTALL +++ /dev/null @@ -1,98 +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. - -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 Michael Gratton diff --git a/README.md b/README.md index d99cd8aa..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. @@ -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 ---------------- @@ -30,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 @@ -47,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 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..54bccfec 100644 --- a/meson.build +++ b/meson.build @@ -4,23 +4,26 @@ 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') +# 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 BUILDING.md') + endif +endif -# Build type -if get_option('profile') == 'development' - profile = '.Devel' +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 BUILDING.md') endif # Configurable install dirs @@ -92,13 +95,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) @@ -127,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 == '' @@ -153,27 +156,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..fcb8b9bf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,11 +1,22 @@ # # General build options # + option( - 'contractor', - type: 'boolean', - value: false, - description: 'Whether to install the contractor file (Elementary OS-specific).' + 'profile', + type: 'combo', + choices: [ + 'auto', + 'development', + 'beta', + 'release' + ], + 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 +30,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/client/application/application-client.vala b/src/client/application/application-client.vala index 46469086..e7f980c0 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; /** diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index 0e6a89e1..2b77a6d7 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -507,7 +507,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"); } 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'