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.
This commit is contained in:
Michael Gratton 2020-10-03 21:59:01 +10:00 committed by Michael James Gratton
parent aaa2934acf
commit 23bd2507a7
4 changed files with 50 additions and 14 deletions

26
INSTALL
View file

@ -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 <mike@vee.net>
Copyright © 2016 Software Freedom Conservancy Inc.
Copyright © 2018-2020 Michael Gratton <mike@vee.net>

View file

@ -4,16 +4,26 @@ project('geary', [ 'vala', 'c' ],
meson_version: '>= 0.50',
)
# Build type
if get_option('profile') == 'development'
profile = '.Devel'
name_suffix = ' (Development)'
elif get_option('profile') == 'beta'
profile = '.Beta'
name_suffix = ' (Beta)'
else
profile = ''
# 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 profile == 'beta'
appid_suffix = '.Beta'
name_suffix = ' (Beta)'
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 == ''

View file

@ -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(

View file

@ -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");
}