[tracker-miners/wip/carlosg/cli-split: 4/5] tracker: Split into subcommand executables, and hook to build
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/cli-split: 4/5] tracker: Split into subcommand executables, and hook to build
- Date: Mon, 30 Dec 2019 00:24:14 +0000 (UTC)
commit 2457b99fd109b9583fcbcbee8d8806203b1577ad
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Dec 19 17:58:12 2019 +0100
tracker: Split into subcommand executables, and hook to build
Split all subcommands into their own executables, and install those
in $libexecdir/tracker. Now that it's all properly connected, hook
src/tracker to the build.
src/meson.build | 3 +++
src/tracker/meson.build | 56 +++++++++++++++++++------------------------
src/tracker/tracker-daemon.c | 8 ++++++-
src/tracker/tracker-extract.c | 8 ++++++-
src/tracker/tracker-index.c | 8 ++++++-
src/tracker/tracker-reset.c | 8 ++++++-
src/tracker/tracker-search.c | 2 +-
src/tracker/tracker-status.c | 8 ++++++-
src/tracker/tracker-tag.c | 8 ++++++-
9 files changed, 71 insertions(+), 38 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 1717ac1e9..6605cbc0a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -18,6 +18,9 @@ if get_option('writeback')
subdir('tracker-writeback')
endif
+# CLI subcommands
+subdir('tracker')
+
custom_target('tracker-miners-settings-enums',
input: 'libtracker-miners-common/tracker-enums.h',
output: 'org.freedesktop.TrackerMiners.enums.xml',
diff --git a/src/tracker/meson.build b/src/tracker/meson.build
index 75a822a1d..e1afe8c41 100644
--- a/src/tracker/meson.build
+++ b/src/tracker/meson.build
@@ -1,38 +1,32 @@
-sources = [
+modules = [
+ 'daemon',
+ 'extract',
+ 'index',
+ 'reset',
+ 'search',
+ 'status',
+ 'tag',
+]
+
+common_sources = [
'tracker-miner-manager.c',
- 'tracker-main.c',
'tracker-config.c',
- 'tracker-daemon.c',
'tracker-dbus.c',
- 'tracker-extract.c',
- 'tracker-help.c',
- 'tracker-index.c',
- 'tracker-info.c',
'tracker-process.c',
- 'tracker-reset.c',
- 'tracker-search.c',
- 'tracker-sparql.c',
- 'tracker-sql.c',
- 'tracker-status.c',
- 'tracker-tag.c',
]
-executable('tracker', sources,
- c_args: tracker_c_args + [
- '-DLIBEXECDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))),
- '-DMANDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'man')),
- ],
- install: true,
- install_rpath: tracker_install_rpath,
- # This doesn't depend on tracker_common_dep because of
- # https://github.com/mesonbuild/meson/issues/671
- dependencies: [tracker_sparql_dep, tracker_data_dep],
- include_directories: [commoninc, configinc, srcinc],
-)
-
+foreach m: modules
+ sources = common_sources + ['tracker-@0@.c'.format(m)]
-if install_bash_completion
- install_data(
- sources: 'bash-completion/tracker',
- install_dir: bash_completion_dir)
-endif
+ executable(m, sources,
+ c_args: tracker_c_args + [
+ '-DLIBEXECDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))),
+ '-DMANDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'man')),
+ ],
+ install: true,
+ install_rpath: tracker_install_rpath,
+ install_dir: join_paths(get_option('libexecdir'), 'tracker'),
+ dependencies: [tracker_sparql, tracker_miners_common_dep],
+ include_directories: [commoninc, configinc, srcinc],
+ )
+endforeach
diff --git a/src/tracker/tracker-daemon.c b/src/tracker/tracker-daemon.c
index f764e7a0b..5addb50af 100644
--- a/src/tracker/tracker-daemon.c
+++ b/src/tracker/tracker-daemon.c
@@ -1726,11 +1726,17 @@ daemon_options_enabled (void)
}
int
-tracker_daemon (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_summary (context, _("If no arguments are given, the status of the store and data
miners is shown"));
diff --git a/src/tracker/tracker-extract.c b/src/tracker/tracker-extract.c
index 27e00e6f5..b20bf8c33 100644
--- a/src/tracker/tracker-extract.c
+++ b/src/tracker/tracker-extract.c
@@ -132,11 +132,17 @@ extract_options_enabled (void)
}
int
-tracker_extract (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
diff --git a/src/tracker/tracker-index.c b/src/tracker/tracker-index.c
index 133eaa53c..bbb6b27e6 100644
--- a/src/tracker/tracker-index.c
+++ b/src/tracker/tracker-index.c
@@ -395,13 +395,19 @@ index_options_enabled (void)
}
int
-tracker_index (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
const gchar *failed;
gint actions = 0;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
diff --git a/src/tracker/tracker-reset.c b/src/tracker/tracker-reset.c
index 0b4933aca..57a43aef4 100644
--- a/src/tracker/tracker-reset.c
+++ b/src/tracker/tracker-reset.c
@@ -310,11 +310,17 @@ reset_options_enabled (void)
}
int
-tracker_reset (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
diff --git a/src/tracker/tracker-search.c b/src/tracker/tracker-search.c
index d7918d4ea..f7394df2a 100644
--- a/src/tracker/tracker-search.c
+++ b/src/tracker/tracker-search.c
@@ -1763,7 +1763,7 @@ search_options_enabled (void)
}
int
-tracker_search (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
diff --git a/src/tracker/tracker-status.c b/src/tracker/tracker-status.c
index 537d5a356..690725c7b 100644
--- a/src/tracker/tracker-status.c
+++ b/src/tracker/tracker-status.c
@@ -572,11 +572,17 @@ status_options_enabled (void)
}
int
-tracker_status (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
diff --git a/src/tracker/tracker-tag.c b/src/tracker/tracker-tag.c
index 249d1c328..a9428961d 100644
--- a/src/tracker/tracker-tag.c
+++ b/src/tracker/tracker-tag.c
@@ -1062,12 +1062,18 @@ tag_options_enabled (void)
}
int
-tracker_tag (int argc, const char **argv)
+main (int argc, const char **argv)
{
GOptionContext *context;
GError *error = NULL;
const gchar *failed;
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]