jbsrc/lib/src/extras/jb-evolution-plugin.c (1944B) - raw
1 /*
2 * JB, the Jean-Yves Lefort's Build System
3 * Copyright (C) 2008 Jean-Yves Lefort <jylefort@brutele.be>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include <string.h>
21 #include "jb-tests.h"
22 #include "jb-util.h"
23 #include "jb-variable.h"
24
25 void
26 jb_evolution_plugin_init (void)
27 {
28 jb_variable_add_string("evolution-plugin-dir",
29 "Evolution plugin installation directory",
30 jb_variable_group_installation_options,
31 0,
32 "autodetect");
33 }
34
35 gboolean
36 jb_evolution_plugin_check (const char *minversion)
37 {
38 char *packages;
39 gboolean result;
40
41 if (! minversion)
42 minversion = "2.12";
43
44 packages = g_strdup_printf("evolution-plugin >= %s", minversion);
45 result = jb_check_packages("Evolution", "evolution-plugin", packages);
46 g_free(packages);
47
48 if (! result)
49 return FALSE;
50
51 if (! strcmp(jb_variable_get_string("evolution-plugin-dir"), "autodetect"))
52 {
53 char *plugindir;
54
55 jb_message_checking("for the Evolution plugin directory");
56 plugindir = jb_get_package_variable("evolution-plugin", "plugindir");
57 jb_message_result_string(plugindir ? plugindir : "not found");
58
59 if (! plugindir)
60 return FALSE;
61
62 jb_variable_set_string("evolution-plugin-dir", plugindir);
63 g_free(plugindir);
64 }
65
66 return TRUE;
67 }