build: Allow parallel installation
Use 'org.gnome.FractalDevel' appid for development versions. This is specified at build time by passing '-Dprofile=development' option to Meson.
This commit is contained in:
parent
75d05cb09c
commit
63943648cd
12 changed files with 99 additions and 22 deletions
|
@ -16,7 +16,6 @@
|
|||
"--filesystem=~/.config/dconf:ro",
|
||||
"--talk-name=ca.desrt.dconf",
|
||||
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
|
||||
"--env=FRACTAL_ID=org.gnome.Fractal.nightly",
|
||||
"--share=network",
|
||||
"--share=ipc",
|
||||
"--socket=x11",
|
||||
|
@ -33,7 +32,6 @@
|
|||
],
|
||||
"env" : {
|
||||
"CARGO_HOME" : "/run/build/Fractal/cargo",
|
||||
"DEBUG" : "true",
|
||||
"RUST_BACKTRACE" : "1"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,15 +15,26 @@ fn main() {
|
|||
|
||||
// Generating build globals
|
||||
let default_locales = "./fractal-gtk/po".to_string();
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let default_app_id = "org.gnome.Fractal".to_string();
|
||||
let default_name_suffix = "".to_string();
|
||||
let default_version = "".to_string();
|
||||
|
||||
let localedir = env::var("FRACTAL_LOCALEDIR").unwrap_or(default_locales);
|
||||
let app_id = env::var("FRACTAL_APP_ID").unwrap_or(default_app_id);
|
||||
let name_suffix = env::var("FRACTAL_NAME_SUFFIX").unwrap_or(default_name_suffix);
|
||||
let version = env::var("FRACTAL_VERSION").unwrap_or(default_version);
|
||||
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("build_globals.rs");
|
||||
let mut f = File::create(&dest_path).unwrap();
|
||||
|
||||
let globals = format!("
|
||||
pub static LOCALEDIR: &'static str = \"{}\";
|
||||
pub static APP_ID: &'static str = \"{}\";
|
||||
pub static NAME_SUFFIX: &'static str = \"{}\";
|
||||
pub static VERSION: &'static str = \"{}\";
|
||||
",
|
||||
localedir);
|
||||
localedir, app_id, name_suffix, version);
|
||||
|
||||
f.write_all(&globals.into_bytes()[..]).unwrap();
|
||||
}
|
||||
|
|
|
@ -1 +1,19 @@
|
|||
install_subdir('hicolor', install_dir: icondir)
|
||||
icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '512x512']
|
||||
|
||||
foreach icon_size: icon_sizes
|
||||
hicolor_dir = join_paths('hicolor', icon_size, 'apps')
|
||||
|
||||
install_data(
|
||||
join_paths(hicolor_dir, 'org.gnome.Fractal.png'),
|
||||
install_dir: join_paths(datadir, 'icons', hicolor_dir),
|
||||
rename: '@0@.png'.format(application_id)
|
||||
)
|
||||
endforeach
|
||||
|
||||
hicolor_dir = join_paths('hicolor', 'scalable', 'apps')
|
||||
|
||||
install_data(
|
||||
join_paths(hicolor_dir, 'org.gnome.Fractal-symbolic.svg'),
|
||||
install_dir: join_paths(datadir, 'icons', hicolor_dir),
|
||||
rename: '@0@-symbolic.svg'.format(application_id)
|
||||
)
|
||||
|
|
|
@ -1,20 +1,32 @@
|
|||
subdir('icons')
|
||||
|
||||
desktop_conf = configuration_data()
|
||||
desktop_conf.set('icon', application_id)
|
||||
i18n.merge_file ('desktop-file',
|
||||
type: 'desktop',
|
||||
input: 'org.gnome.Fractal.desktop.in',
|
||||
output: 'org.gnome.Fractal.desktop',
|
||||
input: configure_file(
|
||||
input: files('org.gnome.Fractal.desktop.in.in'),
|
||||
output: 'org.gnome.Fractal.desktop.in',
|
||||
configuration: desktop_conf
|
||||
),
|
||||
output: '@0@.desktop'.format(application_id),
|
||||
po_dir: podir,
|
||||
install: true,
|
||||
install_dir: join_paths (datadir, 'applications')
|
||||
)
|
||||
|
||||
appdata_conf = configuration_data()
|
||||
appdata_conf.set('appid', application_id)
|
||||
i18n.merge_file ('appdata-file',
|
||||
input: 'org.gnome.Fractal.appdata.xml.in',
|
||||
output: 'org.gnome.Fractal.appdata.xml',
|
||||
input: configure_file(
|
||||
input: files('org.gnome.Fractal.appdata.xml.in.in'),
|
||||
output: 'org.gnome.Fractal.appdata.xml.in',
|
||||
configuration: appdata_conf
|
||||
),
|
||||
output: '@0@.appdata.xml'.format(application_id),
|
||||
po_dir: podir,
|
||||
install: true,
|
||||
install_dir: join_paths (datadir, 'appdata')
|
||||
install_dir: join_paths (datadir, 'metainfo')
|
||||
)
|
||||
|
||||
install_data('org.gnome.Fractal.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.gnome.Fractal.desktop</id>
|
||||
<id>@appid@.desktop</id>
|
||||
<name>Fractal</name>
|
||||
<project_license>GPL-3.0</project_license>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
|
@ -4,7 +4,7 @@ Comment=Fractal is a decentralized, secure messaging client for collaborative gr
|
|||
GenericName=Fractal group messaging
|
||||
Exec=fractal
|
||||
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||
Icon=org.gnome.Fractal
|
||||
Icon=@icon@
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
X-GNOME-UsesNotifications=true
|
|
@ -62,16 +62,16 @@ pub struct App {
|
|||
impl App {
|
||||
/// Create an App instance
|
||||
pub fn new() {
|
||||
let appid = match env::var("FRACTAL_ID") {
|
||||
Ok(id) => id,
|
||||
Err(_) => globals::APP_ID.to_string(),
|
||||
};
|
||||
let appid = globals::APP_ID.to_string();
|
||||
|
||||
let gtk_app = gtk::Application::new(Some(&appid[..]), gio::ApplicationFlags::empty())
|
||||
.expect("Failed to initialize GtkApplication");
|
||||
|
||||
gtk_app.set_accels_for_action("app.quit", &["<Ctrl>Q"]);
|
||||
|
||||
let path = "/org/gnome/Fractal".to_string();
|
||||
gtk_app.set_property_resource_base_path(Some(&path));
|
||||
|
||||
gtk_app.connect_startup(move |gtk_app| {
|
||||
let (tx, rx): (Sender<BKResponse>, Receiver<BKResponse>) = channel();
|
||||
let (itx, irx): (Sender<InternalCommand>, Receiver<InternalCommand>) = channel();
|
||||
|
|
|
@ -14,14 +14,16 @@ impl AppOp {
|
|||
.get_object("main_window")
|
||||
.expect("Can't find main_window in ui file.");
|
||||
|
||||
let program_name = format!("Fractal{}", globals::NAME_SUFFIX);
|
||||
|
||||
let dialog = gtk::AboutDialog::new();
|
||||
dialog.set_logo_icon_name(globals::APP_ID);
|
||||
dialog.set_comments(i18n("A Matrix.org client for GNOME").as_str());
|
||||
dialog.set_copyright(i18n("© 2017–2018 Daniel García Moreno, et al.").as_str());
|
||||
dialog.set_license_type(gtk::License::Gpl30);
|
||||
dialog.set_modal(true);
|
||||
dialog.set_version(env!("CARGO_PKG_VERSION"));
|
||||
dialog.set_program_name("Fractal");
|
||||
dialog.set_version(globals::VERSION);
|
||||
dialog.set_program_name(&program_name);
|
||||
dialog.set_website("https://wiki.gnome.org/Fractal");
|
||||
dialog.set_website_label(i18n("Learn more about Fractal").as_str());
|
||||
dialog.set_translator_credits(i18n("translator-credits").as_str());
|
||||
|
|
|
@ -3,7 +3,6 @@ pub static CACHE_SIZE: usize = 40;
|
|||
pub static MSG_ICON_SIZE: i32 = 40;
|
||||
pub static USERLIST_ICON_SIZE: i32 = 30;
|
||||
pub static MINUTES_TO_SPLIT_MSGS: i64 = 30;
|
||||
pub static APP_ID: &'static str = "org.gnome.Fractal";
|
||||
pub static DEFAULT_HOMESERVER: &'static str = "https://matrix.org";
|
||||
pub static DEFAULT_IDENTITYSERVER: &'static str = "https://vector.im";
|
||||
|
||||
|
|
28
meson.build
28
meson.build
|
@ -4,6 +4,23 @@ project(
|
|||
license: 'GPLv3',
|
||||
)
|
||||
|
||||
if get_option('profile') == 'development'
|
||||
profile = 'Devel'
|
||||
name_suffix = ' (Development)'
|
||||
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
|
||||
if vcs_tag == ''
|
||||
version_suffix = '-devel'
|
||||
else
|
||||
version_suffix = '-@0@'.format (vcs_tag)
|
||||
endif
|
||||
else
|
||||
profile = ''
|
||||
name_suffix = ''
|
||||
version_suffix = ''
|
||||
endif
|
||||
|
||||
application_id = 'org.gnome.Fractal@0@'.format(profile)
|
||||
|
||||
fractal_version = meson.project_version()
|
||||
version_array = fractal_version.split('.')
|
||||
fractal_major_version = version_array[0].to_int()
|
||||
|
@ -15,7 +32,6 @@ fractal_bindir = join_paths(fractal_prefix, get_option('bindir'))
|
|||
fractal_localedir = join_paths(fractal_prefix, get_option('localedir'))
|
||||
|
||||
datadir = get_option('datadir')
|
||||
icondir = join_paths(datadir, 'icons')
|
||||
|
||||
i18n = import('i18n')
|
||||
|
||||
|
@ -40,7 +56,15 @@ cargo_release = custom_target('cargo-build',
|
|||
output: ['fractal'],
|
||||
install: true,
|
||||
install_dir: fractal_bindir,
|
||||
command: [cargo_script, '@CURRENT_SOURCE_DIR@', '@OUTPUT@', fractal_localedir])
|
||||
command: [cargo_script,
|
||||
'@CURRENT_SOURCE_DIR@',
|
||||
'@OUTPUT@',
|
||||
fractal_localedir,
|
||||
application_id,
|
||||
name_suffix,
|
||||
fractal_version + version_suffix,
|
||||
profile
|
||||
])
|
||||
|
||||
run_target('release', command: ['scripts/release.sh',
|
||||
meson.project_name() + '-' + fractal_version
|
||||
|
|
9
meson_options.txt
Normal file
9
meson_options.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
option (
|
||||
'profile',
|
||||
type: 'combo',
|
||||
choices: [
|
||||
'default',
|
||||
'development'
|
||||
],
|
||||
value: 'default'
|
||||
)
|
|
@ -2,8 +2,12 @@
|
|||
|
||||
export CARGO_HOME=$1/target/cargo-home
|
||||
export FRACTAL_LOCALEDIR="$3"
|
||||
export FRACTAL_APP_ID="$4"
|
||||
export FRACTAL_NAME_SUFFIX="$5"
|
||||
export FRACTAL_VERSION="$6"
|
||||
export FRACTAL_PROFILE="$7"
|
||||
|
||||
if [[ $DEBUG = true ]]
|
||||
if [[ "$FRACTAL_PROFILE" == "Devel" ]]
|
||||
then
|
||||
echo "DEBUG MODE"
|
||||
cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp $1/target/debug/fractal-gtk $2
|
||||
|
|
Loading…
Reference in a new issue