[gnome-dictionary/ebassi/for-master] Add a development profile
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-dictionary/ebassi/for-master] Add a development profile
- Date: Mon, 21 Sep 2020 20:33:12 +0000 (UTC)
commit c4f824af711074bba3e7ae54da6b5892459cfa2b
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Sep 21 21:24:59 2020 +0100
Add a development profile
We begin the GNOME 40 development cycle by adding the ability to define
a development build of Dictionary, with its own application identifier.
We use the same application identifier across the binary, so that the
shell can match our desktop file with it; and we use a different label
in the About dialog, depending on whether we are using a development
build or not.
It's possible to enable the development build by using a build option;
otherwise, we're going to check if the current version is one of the
three development stages of a GNOME release.
libgdict/meson.build | 4 ++--
meson.build | 7 ++++++-
meson_options.txt | 1 +
src/gdict-about.c | 8 ++++++--
src/gdict-app.c | 4 ++--
src/gdict-common.c | 10 ++++++++++
src/gdict-common.h | 4 +++-
src/main.c | 2 +-
src/meson.build | 29 +++++++++++++++++++++--------
9 files changed, 52 insertions(+), 17 deletions(-)
---
diff --git a/libgdict/meson.build b/libgdict/meson.build
index ce07079..18bd715 100644
--- a/libgdict/meson.build
+++ b/libgdict/meson.build
@@ -45,8 +45,8 @@ libgdict_marshal = gnome.genmarshal('gdict-marshal',
libgdict_version = meson.project_version().split('.')
libgdict_major = libgdict_version[0].to_int()
-libgdict_minor = libgdict_version[1].to_int()
-libgdict_micro = libgdict_version[2].to_int()
+libgdict_minor = libgdict_version[1] in ['alpha', 'beta', 'rc'] ? 0 : libgdict_version[1].to_int()
+libgdict_micro = 0
libgdict_cflags = [
'-D_GNU_SOURCE',
diff --git a/meson.build b/meson.build
index 9a3d52d..be332b7 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gnome-dictionary', 'c', version: '3.26.2',
+project('gnome-dictionary', 'c', version: '40.alpha',
default_options: [
'buildtype=debugoptimized',
'c_std=c99',
@@ -7,6 +7,10 @@ project('gnome-dictionary', 'c', version: '3.26.2',
license: 'GPLv2+',
meson_version: '>= 0.54.0')
+gdict_version = meson.project_version().split('.')
+gdict_major_version = gdict_version[0].to_int()
+gdict_minor_version = gdict_version[1]
+
# Paths for the pkg-config file
gdict_prefix = get_option('prefix')
gdict_bindir = gdict_prefix / get_option('bindir')
@@ -70,6 +74,7 @@ endif
common_cflags = cc.get_supported_arguments(test_cflags)
+profile = get_option('profile')
debug = get_option('debug')
optimization = get_option('optimization')
buildtype = get_option('buildtype')
diff --git a/meson_options.txt b/meson_options.txt
index 4c1b206..9d1a5dd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
option('use_ipv6', type: 'boolean', value: true, description: 'Enable IPv6 support')
option('build_man', type: 'boolean', value: true, description: 'Generate man page (requires xsltproc)')
+option('profile', type: 'combo', choices: ['stable', 'devel'], value: 'stable', description: 'The build
profile')
diff --git a/src/gdict-about.c b/src/gdict-about.c
index 689ca7c..cef278d 100644
--- a/src/gdict-about.c
+++ b/src/gdict-about.c
@@ -28,6 +28,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdict-about.h"
+#include "gdict-common.h"
void
gdict_show_about_dialog (GtkWidget *parent)
@@ -49,13 +50,16 @@ gdict_show_about_dialog (GtkWidget *parent)
};
const gchar *translator_credits = _("translator-credits");
- const gchar *copyright = "Copyright \xc2\xa9 2005-2006 Emmanuele Bassi";
+ const gchar *copyright = "Copyright \xc2\xa9 2005 Emmanuele Bassi";
const gchar *comments = _("Look up words in dictionaries");
g_return_if_fail (GTK_IS_WIDGET (parent));
gtk_show_about_dialog (GTK_IS_WINDOW (parent) ? GTK_WINDOW (parent) : NULL,
- "program-name", _("Dictionary"),
+ "program-name",
+ gdict_is_devel_build ()
+ ? _("Dictionary (development build)")
+ : _("Dictionary"),
"version", VERSION,
"copyright", copyright,
"comments", comments,
diff --git a/src/gdict-app.c b/src/gdict-app.c
index 4189f88..12021f2 100644
--- a/src/gdict-app.c
+++ b/src/gdict-app.c
@@ -365,14 +365,14 @@ gdict_app_init (GdictApp *app)
g_application_add_main_option_entries (G_APPLICATION (app), gdict_app_goptions);
/* Set main application icon */
- gtk_window_set_default_icon_name ("org.gnome.Dictionary");
+ gtk_window_set_default_icon_name (APPLICATION_ID);
}
GApplication *
gdict_app_new (void)
{
return g_object_new (gdict_app_get_type (),
- "application-id", "org.gnome.Dictionary",
+ "application-id", APPLICATION_ID,
"resource-base-path", "/org/gnome/Dictionary",
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
NULL);
diff --git a/src/gdict-common.c b/src/gdict-common.c
index c9c788f..ad2e77a 100644
--- a/src/gdict-common.c
+++ b/src/gdict-common.c
@@ -241,3 +241,13 @@ gdict_show_gerror_dialog (GtkWindow *parent,
g_error_free (error);
error = NULL;
}
+
+gboolean
+gdict_is_devel_build (void)
+{
+#ifdef DEVELOPMENT_BUILD
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
diff --git a/src/gdict-common.h b/src/gdict-common.h
index 234ab1d..c9a646d 100644
--- a/src/gdict-common.h
+++ b/src/gdict-common.h
@@ -25,7 +25,7 @@
G_BEGIN_DECLS
-gchar * gdict_get_data_dir (void) G_GNUC_MALLOC;
+gchar * gdict_get_data_dir (void) G_GNUC_MALLOC;
gchar * gdict_get_old_data_dir (void) G_GNUC_MALLOC;
gchar * gdict_get_config_dir (void) G_GNUC_MALLOC;
@@ -39,6 +39,8 @@ void gdict_show_gerror_dialog (GtkWindow *parent,
const gchar *message,
GError *error);
+gboolean gdict_is_devel_build (void);
+
G_END_DECLS
#endif /* __GDICT_COMMON_H__ */
diff --git a/src/main.c b/src/main.c
index c7e36e6..da855f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,7 +34,7 @@ main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- g_set_prgname ("gnome-dictionary");
+ g_set_prgname (APPLICATION_ID);
if (!gdict_create_config_dir ())
exit (1);
diff --git a/src/meson.build b/src/meson.build
index 8823968..dbfe7d4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -17,18 +17,31 @@ resources = gnome.compile_resources ('gdict-resources',
c_name: 'gdict',
)
+gdict_cflags = [
+ '-DPREFIX="@0@"'.format(gdict_prefix),
+ '-DSYSCONFDIR="@0@"'.format(gdict_sysconfdir),
+ '-DLIBDIR="@0@"'.format(gdict_libdir),
+ '-DDATADIR="@0@"'.format(gdict_datadir),
+ '-DPKGDATADIR="@0@"'.format(join_paths(gdict_datadir, 'gnome-dictionary')),
+ '-DGNOMELOCALEDIR="@0@"'.format(join_paths(gdict_datadir, 'locale')),
+]
+
mathlib = cc.find_library('m', required: false)
+if profile == 'devel' or gdict_minor_version in ['alpha', 'beta', 'rc']
+ gdict_cflags += [
+ '-DDEVELOPMENT_BUILD',
+ '-DAPPLICATION_ID="org.gnome.Dictionary.Devel"',
+ ]
+else
+ gdict_cflags += [
+ '-DAPPLICATION_ID="org.gnome.Dictionary"',
+ ]
+endif
+
executable('gnome-dictionary',
sources: app_sources + resources,
- c_args: [
- '-DPREFIX="@0@"'.format(gdict_prefix),
- '-DSYSCONFDIR="@0@"'.format(gdict_sysconfdir),
- '-DLIBDIR="@0@"'.format(gdict_libdir),
- '-DDATADIR="@0@"'.format(gdict_datadir),
- '-DPKGDATADIR="@0@"'.format(join_paths(gdict_datadir, 'gnome-dictionary')),
- '-DGNOMELOCALEDIR="@0@"'.format(join_paths(gdict_datadir, 'locale')),
- ],
+ c_args: gdict_cflags,
dependencies: [ libgdict_dep, mathlib ],
include_directories: root_inc,
install: true,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]