diff --git a/meson.build b/meson.build index 91d0ff7..f2d729d 100644 --- a/meson.build +++ b/meson.build @@ -1,12 +1,37 @@ -# Adatped from: -# https://gitlab.gnome.org/danigm/fractal/blob/6e2911f9d2353c99a18a6c19fab7f903c4bbb431/meson.build - project( 'gnome-podcasts', 'rust', version: '0.4.6', license: 'GPLv3', ) +# FIXME: look for cargo and optionally cargo-vendor +# dependency('cargo') + +dependency('sqlite3', version: '>= 3.20') +dependency('openssl', version: '>= 1.0') +dependency('dbus-1') + +dependency('glib-2.0', version: '>= 2.56') +dependency('gio-2.0', version: '>= 2.56') +dependency('gdk-pixbuf-2.0') +dependency('gtk+-3.0', version: '>= 3.22') +dependency('libhandy-0.0', version: '>= 0.0.4') + +dependency('gstreamer-1.0', version: '>= 1.12') +dependency('gstreamer-base-1.0', version: '>= 1.12') +dependency('gstreamer-audio-1.0', version: '>= 1.12') +dependency('gstreamer-video-1.0', version: '>= 1.12') +dependency('gstreamer-player-1.0', version: '>= 1.12') +dependency('gstreamer-plugins-base-1.0', version: '>= 1.12') +dependency('gstreamer-plugins-bad-1.0', version: '>= 1.12') +dependency('gstreamer-bad-audio-1.0', version: '>= 1.12') +dependency('gstreamer-bad-video-1.0', version: '>= 1.12') + +cargo = find_program('cargo', required: true) +gresource = find_program('glib-compile-resources', required: true) +gschemas = find_program('glib-compile-schemas', required: true) +cargo_vendor = find_program('cargo-vendor', required: false) + if get_option('profile') == 'development' profile = 'Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() @@ -27,10 +52,6 @@ subdir('podcasts-gtk/po') podir = join_paths (meson.source_root (), 'podcasts-gtk', 'po') podcasts_version = meson.project_version() -version_array = podcasts_version.split('.') -podcasts_major_version = version_array[0].to_int() -podcasts_minor_version = version_array[1].to_int() -podcasts_version_micro = version_array[2].to_int() podcasts_prefix = get_option('prefix') podcasts_bindir = join_paths(podcasts_prefix, get_option('bindir')) @@ -43,9 +64,6 @@ podcasts_conf.set('bindir', podcasts_bindir) datadir = get_option('datadir') subdir('podcasts-gtk/resources') -cargo = find_program('cargo', required: false) -gresource = find_program('glib-compile-resources', required: false) -cargo_vendor = find_program('cargo-vendor', required: false) cargo_script = find_program('scripts/cargo.sh') cargo_release = custom_target('cargo-build', diff --git a/podcasts-gtk/src/app.rs b/podcasts-gtk/src/app.rs index a3757e8..63f4261 100644 --- a/podcasts-gtk/src/app.rs +++ b/podcasts-gtk/src/app.rs @@ -48,8 +48,20 @@ use std::sync::Arc; use crate::i18n::i18n; -pub(crate) const APP_ID: &str = env!("APP_ID"); -pub(crate) const VERSION: &str = env!("VERSION"); +#[rustfmt::skip] +lazy_static! { + pub static ref APP_ID: &'static str = { + option_env!("APP_ID").unwrap_or("org.gnome.Podcasts") + }; + + pub static ref VERSION: &'static str = { + option_env!("VERSION").unwrap_or("0.0.1") + }; + + pub static ref LOCALEDIR: &'static str = { + option_env!("LOCALEDIR").unwrap_or("./podcasts-gtk/po") + }; +} /// Creates an action named `name` in the action map `T with the handler `F` fn action(thing: &T, name: &str, action: F) @@ -404,10 +416,10 @@ impl App { pub(crate) fn run() { // Set up the textdomain for gettext setlocale(LocaleCategory::LcAll, ""); - bindtextdomain("gnome-podcasts", env!("LOCALEDIR")); + bindtextdomain("gnome-podcasts", *LOCALEDIR); textdomain("gnome-podcasts"); - let application = gtk::Application::new(APP_ID, gio::ApplicationFlags::empty()) + let application = gtk::Application::new(*APP_ID, gio::ApplicationFlags::empty()) .expect("Application initialization failed..."); application.set_resource_base_path("/org/gnome/Podcasts"); @@ -438,7 +450,7 @@ impl App { // Weird magic I copy-pasted that sets the Application Name in the Shell. glib::set_application_name(&i18n("Podcasts")); glib::set_prgname(Some("gnome-podcasts")); - gtk::Window::set_default_icon_name(APP_ID); + gtk::Window::set_default_icon_name(*APP_ID); let args: Vec = env::args().collect(); ApplicationExtManual::run(&application, &args); } diff --git a/podcasts-gtk/src/widgets/aboutdialog.rs b/podcasts-gtk/src/widgets/aboutdialog.rs index 0fc6dcf..f29ce06 100644 --- a/podcasts-gtk/src/widgets/aboutdialog.rs +++ b/podcasts-gtk/src/widgets/aboutdialog.rs @@ -47,12 +47,12 @@ pub(crate) fn about_dialog(window: >k::ApplicationWindow) { ]; let dialog = gtk::AboutDialog::new(); - dialog.set_logo_icon_name(APP_ID); + dialog.set_logo_icon_name(*APP_ID); dialog.set_comments(i18n("Podcast Client for the GNOME Desktop.").as_str()); dialog.set_copyright("© 2017, 2018 Jordan Petridis"); dialog.set_license_type(gtk::License::Gpl30); dialog.set_modal(true); - dialog.set_version(VERSION); + dialog.set_version(*VERSION); dialog.set_program_name(&i18n("Podcasts")); dialog.set_website("https://wiki.gnome.org/Apps/Podcasts"); dialog.set_website_label(i18n("Learn more about GNOME Podcasts").as_str()); diff --git a/podcasts-gtk/src/widgets/empty.rs b/podcasts-gtk/src/widgets/empty.rs index 8abd6ce..fcf4d55 100644 --- a/podcasts-gtk/src/widgets/empty.rs +++ b/podcasts-gtk/src/widgets/empty.rs @@ -36,7 +36,7 @@ impl Default for EmptyView { let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/empty_view.ui"); let view: gtk::Box = builder.get_object("empty_view").unwrap(); let image: gtk::Image = builder.get_object("image").unwrap(); - image.set_from_icon_name(format!("{}-symbolic", APP_ID).as_str(), 256); + image.set_from_icon_name(format!("{}-symbolic", *APP_ID).as_str(), 256); EmptyView(view) } } diff --git a/scripts/test.sh b/scripts/test.sh index 5665a36..12c7724 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -23,9 +23,6 @@ flatpak-builder --run \ # Run the tests xvfb-run -a -s "-screen 0 1024x768x24" \ flatpak-builder --run \ - --env=APP_ID="org.gnome.PodcastsDevel" \ - --env=LOCALEDIR="./podcasts-gtk/po" \ - --env=VERSION="0.0.0" \ --env=CARGO_HOME="target/cargo-home" \ --env=CARGO_TARGET_DIR="target_test/" \ app ${MANIFEST_PATH} \