gjdwebserver-overlay/mail-client/geary/files/0036-build-Update-how-build-profiles-are-handled.patch
Gerben Jan Dijkman 63f719a806 Added files
2021-03-01 15:30:25 +01:00

144 lines
4.4 KiB
Diff

From 23bd2507a7512664802db41b88ad375298d6b7d0 Mon Sep 17 00:00:00 2001
From: Michael Gratton <mike@vee.net>
Date: Sat, 3 Oct 2020 21:59:01 +1000
Subject: [PATCH 036/124] 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 <mike@vee.net>
+Copyright © 2016 Software Freedom Conservancy Inc.
+Copyright © 2018-2020 Michael Gratton <mike@vee.net>
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");
}
--
2.29.2