Commit 63943648 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

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.
parent 75d05cb0
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
"--filesystem=~/.config/dconf:ro", "--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf", "--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--env=FRACTAL_ID=org.gnome.Fractal.nightly",
"--share=network", "--share=network",
"--share=ipc", "--share=ipc",
"--socket=x11", "--socket=x11",
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
], ],
"env" : { "env" : {
"CARGO_HOME" : "/run/build/Fractal/cargo", "CARGO_HOME" : "/run/build/Fractal/cargo",
"DEBUG" : "true",
"RUST_BACKTRACE" : "1" "RUST_BACKTRACE" : "1"
} }
}, },
......
...@@ -15,15 +15,26 @@ fn main() { ...@@ -15,15 +15,26 @@ fn main() {
// Generating build globals // Generating build globals
let default_locales = "./fractal-gtk/po".to_string(); 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 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 dest_path = Path::new(&out_dir).join("build_globals.rs");
let mut f = File::create(&dest_path).unwrap(); let mut f = File::create(&dest_path).unwrap();
let globals = format!(" let globals = format!("
pub static LOCALEDIR: &'static str = \"{}\"; 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(); f.write_all(&globals.into_bytes()[..]).unwrap();
} }
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)
)
subdir('icons') subdir('icons')
desktop_conf = configuration_data()
desktop_conf.set('icon', application_id)
i18n.merge_file ('desktop-file', i18n.merge_file ('desktop-file',
type: 'desktop', type: 'desktop',
input: 'org.gnome.Fractal.desktop.in', input: configure_file(
output: 'org.gnome.Fractal.desktop', 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, po_dir: podir,
install: true, install: true,
install_dir: join_paths (datadir, 'applications') install_dir: join_paths (datadir, 'applications')
) )
appdata_conf = configuration_data()
appdata_conf.set('appid', application_id)
i18n.merge_file ('appdata-file', i18n.merge_file ('appdata-file',
input: 'org.gnome.Fractal.appdata.xml.in', input: configure_file(
output: 'org.gnome.Fractal.appdata.xml', 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, po_dir: podir,
install: true, 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')) install_data('org.gnome.Fractal.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<component type="desktop"> <component type="desktop">
<id>org.gnome.Fractal.desktop</id> <id>@appid@.desktop</id>
<name>Fractal</name> <name>Fractal</name>
<project_license>GPL-3.0</project_license> <project_license>GPL-3.0</project_license>
<metadata_license>CC0-1.0</metadata_license> <metadata_license>CC0-1.0</metadata_license>
......
...@@ -4,7 +4,7 @@ Comment=Fractal is a decentralized, secure messaging client for collaborative gr ...@@ -4,7 +4,7 @@ Comment=Fractal is a decentralized, secure messaging client for collaborative gr
GenericName=Fractal group messaging GenericName=Fractal group messaging
Exec=fractal Exec=fractal
# Translators: Do NOT translate or transliterate this text (this is an icon file name)! # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=org.gnome.Fractal Icon=@icon@
Type=Application Type=Application
StartupNotify=true StartupNotify=true
X-GNOME-UsesNotifications=true X-GNOME-UsesNotifications=true
......
...@@ -62,16 +62,16 @@ pub struct App { ...@@ -62,16 +62,16 @@ pub struct App {
impl App { impl App {
/// Create an App instance /// Create an App instance
pub fn new() { pub fn new() {
let appid = match env::var("FRACTAL_ID") { let appid = globals::APP_ID.to_string();
Ok(id) => id,
Err(_) => globals::APP_ID.to_string(),
};
let gtk_app = gtk::Application::new(Some(&appid[..]), gio::ApplicationFlags::empty()) let gtk_app = gtk::Application::new(Some(&appid[..]), gio::ApplicationFlags::empty())
.expect("Failed to initialize GtkApplication"); .expect("Failed to initialize GtkApplication");
gtk_app.set_accels_for_action("app.quit", &["<Ctrl>Q"]); 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| { gtk_app.connect_startup(move |gtk_app| {
let (tx, rx): (Sender<BKResponse>, Receiver<BKResponse>) = channel(); let (tx, rx): (Sender<BKResponse>, Receiver<BKResponse>) = channel();
let (itx, irx): (Sender<InternalCommand>, Receiver<InternalCommand>) = channel(); let (itx, irx): (Sender<InternalCommand>, Receiver<InternalCommand>) = channel();
......
...@@ -14,14 +14,16 @@ impl AppOp { ...@@ -14,14 +14,16 @@ impl AppOp {
.get_object("main_window") .get_object("main_window")
.expect("Can't find main_window in ui file."); .expect("Can't find main_window in ui file.");
let program_name = format!("Fractal{}", globals::NAME_SUFFIX);
let dialog = gtk::AboutDialog::new(); let dialog = gtk::AboutDialog::new();
dialog.set_logo_icon_name(globals::APP_ID); dialog.set_logo_icon_name(globals::APP_ID);
dialog.set_comments(i18n("A Matrix.org client for GNOME").as_str()); 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_copyright(i18n("© 2017–2018 Daniel García Moreno, et al.").as_str());
dialog.set_license_type(gtk::License::Gpl30); dialog.set_license_type(gtk::License::Gpl30);
dialog.set_modal(true); dialog.set_modal(true);
dialog.set_version(env!("CARGO_PKG_VERSION")); dialog.set_version(globals::VERSION);
dialog.set_program_name("Fractal"); dialog.set_program_name(&program_name);
dialog.set_website("https://wiki.gnome.org/Fractal"); dialog.set_website("https://wiki.gnome.org/Fractal");
dialog.set_website_label(i18n("Learn more about Fractal").as_str()); dialog.set_website_label(i18n("Learn more about Fractal").as_str());
dialog.set_translator_credits(i18n("translator-credits").as_str()); dialog.set_translator_credits(i18n("translator-credits").as_str());
......
...@@ -3,7 +3,6 @@ pub static CACHE_SIZE: usize = 40; ...@@ -3,7 +3,6 @@ pub static CACHE_SIZE: usize = 40;
pub static MSG_ICON_SIZE: i32 = 40; pub static MSG_ICON_SIZE: i32 = 40;
pub static USERLIST_ICON_SIZE: i32 = 30; pub static USERLIST_ICON_SIZE: i32 = 30;
pub static MINUTES_TO_SPLIT_MSGS: i64 = 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_HOMESERVER: &'static str = "https://matrix.org";
pub static DEFAULT_IDENTITYSERVER: &'static str = "https://vector.im"; pub static DEFAULT_IDENTITYSERVER: &'static str = "https://vector.im";
......
...@@ -4,6 +4,23 @@ project( ...@@ -4,6 +4,23 @@ project(
license: 'GPLv3', 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() fractal_version = meson.project_version()
version_array = fractal_version.split('.') version_array = fractal_version.split('.')
fractal_major_version = version_array[0].to_int() fractal_major_version = version_array[0].to_int()
...@@ -15,7 +32,6 @@ fractal_bindir = join_paths(fractal_prefix, get_option('bindir')) ...@@ -15,7 +32,6 @@ fractal_bindir = join_paths(fractal_prefix, get_option('bindir'))
fractal_localedir = join_paths(fractal_prefix, get_option('localedir')) fractal_localedir = join_paths(fractal_prefix, get_option('localedir'))
datadir = get_option('datadir') datadir = get_option('datadir')
icondir = join_paths(datadir, 'icons')
i18n = import('i18n') i18n = import('i18n')
...@@ -40,7 +56,15 @@ cargo_release = custom_target('cargo-build', ...@@ -40,7 +56,15 @@ cargo_release = custom_target('cargo-build',
output: ['fractal'], output: ['fractal'],
install: true, install: true,
install_dir: fractal_bindir, 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', run_target('release', command: ['scripts/release.sh',
meson.project_name() + '-' + fractal_version meson.project_name() + '-' + fractal_version
......
option (
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default'
)
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
export CARGO_HOME=$1/target/cargo-home export CARGO_HOME=$1/target/cargo-home
export FRACTAL_LOCALEDIR="$3" 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 then
echo "DEBUG MODE" echo "DEBUG MODE"
cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp $1/target/debug/fractal-gtk $2 cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp $1/target/debug/fractal-gtk $2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment