[gnome-control-center/gbsneto/build-system-improvements: 8/10] build: Add build profiles



commit 70a3ebf7062ff1483dbc79bdef48551854795b22
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri May 11 22:45:51 2018 -0300

    build: Add build profiles
    
    This commit adds three build profiles:
    
     * default: a regular, stable build.
     * development: for master branch builds with an odd version.
     * flatpak: development build running with flatpak
    
    Next patches will make GNOME Settings show slight
    visual differences on development builds, and show
    a warning on Flatpak ones.

 meson.build       | 16 ++++++++++++++++
 meson_options.txt |  1 +
 2 files changed, 17 insertions(+)
---
diff --git a/meson.build b/meson.build
index 340e2004e..eb2f3ccdf 100644
--- a/meson.build
+++ b/meson.build
@@ -28,6 +28,15 @@ cc = meson.get_compiler('c')
 # Tracing
 enable_tracing = get_option('tracing')
 
+# Build profile (the 'development' profile is guessed of nothing is set)
+gnome_control_center_minor_version = meson.project_version().split('.')[1].to_int()
+
+build_profile = get_option('profile')
+
+if build_profile == 'default' and gnome_control_center_minor_version.is_odd()
+  build_profile = 'development'
+endif
+
 config_h = configuration_data()
 
 py3 = import('python3')
@@ -49,6 +58,12 @@ foreach define: set_defines
   config_h.set_quoted(define[0], define[1])
 endforeach
 
+config_h.set('DEVELOPMENT_BUILD', build_profile != 'default',
+             description: 'Defined if this build is a development build (from the master branch)')
+
+config_h.set('FLATPAK_BUILD', build_profile == 'flatpak',
+             description: 'Defined if this build is a flatpak build')
+
 # meson does not support octal values, so it must be handled as a
 # string. See: https://github.com/mesonbuild/meson/issues/2047
 config_h.set('USER_DIR_MODE', '0700',
@@ -274,6 +289,7 @@ output += '     Documentation .............................. ' + get_option('doc
 output += '     Tracing .................................... ' + enable_tracing.to_string() + '\n'
 output += '     gnome-session libexecdir ................... ' + gnome_session_libexecdir + '\n'
 output += '     Optimized .................................. ' + control_center_optimized.to_string() + '\n'
+output += '     Profile .................................... ' + build_profile + '\n'
 output += ' Panels \n'
 output += '     GNOME Bluetooth (Bluetooth panel) .......... ' + host_is_linux_not_s390.to_string() + '\n'
 output += '     Cheese (Users panel webcam support) ........ ' + enable_cheese.to_string() + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index a01c11553..3077f71c2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,5 +2,6 @@ option('cheese', type: 'boolean', value: true, description: 'build with cheese w
 option('documentation', type: 'boolean', value: false, description: 'build documentation')
 option('gnome_session_libexecdir', type: 'string', value: '', description: 'Directory for gnome-session\'s 
libexecdir')
 option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
+option('profile', type: 'combo', choices: ['default', 'development', 'flatpak'], value: 'default', 
description: 'Profile of the current build')
 option('tracing', type: 'boolean', value: false, description: 'add extra debugging information')
 option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]