3
* Copyright (C) 2004-2008 Jean-Yves Lefort <jylefort@brutele.be>
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.
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.
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.
23
#jb_include "lm-gdk-pixbuf-loader"
24
#jb_include "lm-geoip"
25
#jb_include "lm-glibc"
27
#define LM_WARNING_CFLAGS \
30
"-Wformat-security " \
31
"-Wno-unused-parameter " \
32
"-Wdeclaration-after-statement " \
36
"-Waggregate-return " \
37
"-Wmissing-noreturn " \
38
"-Wmissing-format-attribute " \
40
"-Wredundant-decls " \
43
"-Wno-pointer-sign " \
46
static const JBFeature *jb_features[] = {
47
&jb_pkg_config_feature,
51
&jb_gnome_help_feature,
56
jb_package_init (void)
58
JBVariableGroup *lm_features_group;
60
/* by default, use the GNOME prefix */
61
jb_set_prefix_from_program("gnome-open");
64
* At the time of this writing, gob2 2.0.16 is not yet
65
* released. What is required is gob2 2.0.15 + my patches (see the
66
* gob mailing list), which should eventually become gob2 2.0.16.
68
jb_variable_set_string("gob2-minversion", "2.0.16");
70
lm_features_group = jb_variable_add_group("Link Monitor Applet features");
72
jb_variable_add_bool("ipv6",
73
"enable IPv6 support",
77
jb_variable_add_bool("geoip",
78
"enable GeoIP support",
83
jb_variable_add_bool("compile-warnings", NULL, NULL, 0, FALSE);
84
jb_variable_add_bool("debug", NULL, NULL, 0, TRUE);
85
jb_variable_add_bool("suid-root", NULL, NULL, 0, TRUE);
89
report_invalid_prefix (void)
91
const char *gnome_prefix;
93
jb_check_gnome_prefix();
95
gnome_prefix = jb_variable_get_string("gnome-prefix");
96
if (*gnome_prefix == '\0')
97
jb_warning_expand("$human-package must be installed in the same prefix as GNOME, but the GNOME prefix could not be found. $human-package might be inoperable.", NULL);
102
prefix = jb_variable_expand("$prefix", NULL);
103
if (strcmp(prefix, gnome_prefix))
104
jb_warning_expand("the $human-package prefix ($prefix) is different from the GNOME prefix ($gnome-prefix). $human-package will be inoperable. Unless you know what you are doing, please run \"./jb configure prefix=$gnome-prefix\".", NULL);
110
jb_package_configure (void)
112
if (lm_glibc_check())
115
* We need -std=c99 for lround(), ...
116
* We need _BSD_SOURCE (which requires -lbsd-compat) for struct icmp, ...
117
* We need _POSIX_C_SOURCE for struct addrinfo, clock_gettime(), ...
119
jb_variable_set_string("glibc-cflags", "-std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L");
120
jb_variable_set_string("glibc-cppflags", "");
121
jb_variable_set_string("glibc-ldflags", "-lbsd-compat");
125
jb_variable_set_string("glibc-cflags", "");
126
jb_variable_set_string("glibc-cppflags", "");
127
jb_variable_set_string("glibc-ldflags", "");
130
if (jb_check_functions("clock_gettime", "rt"))
131
jb_variable_set_string("clock-gettime-ldflags", "-lrt");
132
else if (jb_check_functions("clock_gettime", NULL))
133
jb_variable_set_string("clock-gettime-ldflags", "");
135
jb_error("clock_gettime() found neither in librt nor in libc");
137
jb_check_reentrant_dns_resolver();
139
jb_require_packages("GNOME", "gnome", "gthread-2.0 gtk+-2.0 >= 2.12 libgnomeui-2.0 libpanelapplet-2.0 libglade-2.0");
141
if (jb_variable_get_bool("geoip"))
143
if (lm_geoip_check())
145
if (! lm_gdk_pixbuf_loader_check("art/flags/fr.svg", "image/svg+xml"))
146
jb_warning("GTK+ cannot load image/svg+xml images, country flags will not be displayed");
150
jb_warning("disabling option \"geoip\" since GeoIP was not found");
151
jb_variable_set_bool("geoip", FALSE);
155
report_invalid_prefix();
159
jb_package_add_resources (void)
164
if (jb_variable_get_bool("compile-warnings"))
165
jb_compile_options_add_cflags(&jb_compile_options, LM_WARNING_CFLAGS " -Werror");
167
if (! jb_variable_get_bool("debug"))
168
jb_compile_options_add_cflags(&jb_compile_options, "-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS");
170
jb_compile_options_add_gob2flags(&jb_compile_options, "--exit-on-warn");
172
/*** art *******************************************************************/
174
group = jb_group_new("art");
176
jb_group_add_data_file(group, "link-monitor-applet.png", "$datadir/pixmaps");
178
if (jb_variable_get_bool("geoip"))
179
jb_group_add_data_files_pattern(group, "flags/*.svg", "$pkgdatadir/flags");
183
/*** data ******************************************************************/
185
group = jb_group_new("data");
187
jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_template_new("GNOME_LinkMonitorApplet.server.in.in")));
188
jb_group_add_bonobo_server(group, "GNOME_LinkMonitorApplet.server.in");
190
jb_group_add_gconf_schemas(group, "link-monitor-applet.schemas.in");
194
/*** help ******************************************************************/
196
group = jb_group_new("help");
198
jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_gnome_help_new("C", "documentation-license.xml software-license.xml")));
202
/*** jbsrc *****************************************************************/
204
group = jb_group_new("jbsrc");
206
jb_group_add_dist_files(group,
207
"lm-gdk-pixbuf-loader-test.c",
213
/*** po ********************************************************************/
215
group = jb_group_new("po");
217
jb_group_add_translations(group, "bg fr it");
221
/*** src *******************************************************************/
223
group = jb_group_new("src");
225
object = JB_OBJECT(jb_program_new("link-monitor-applet"));
227
jb_install_options_set_installdir(&object->install_options, "$libexecdir");
229
if (jb_variable_get_bool("suid-root"))
231
jb_install_options_set_owner(&object->install_options, "root");
232
jb_install_options_set_extra_mode(&object->install_options, S_ISUID);
235
jb_compile_options_add_string_defines(&object->compile_options,
236
"PACKAGE", "$package",
237
"VERSION", "$version",
238
"GETTEXT_PACKAGE", "$package",
240
"SYSCONFDIR", "$sysconfdir",
241
"DATADIR", "$datadir",
242
"PKGDATADIR", "$pkgdatadir",
244
"GNOMELOCALEDIR", "$datadir/locale",
245
"GNOMEPIXMAPSDIR", "$datadir/pixmaps",
249
* We need --export-dynamic because because libglade needs to
250
* resolve symbols from our own binary in order to autoconnect
253
jb_compile_options_add_ldflags(&object->compile_options, "-Wl,--export-dynamic");
255
jb_compile_options_add_ldflags(&object->compile_options, "-lm");
257
jb_compile_options_add_package(&object->compile_options, "glibc");
258
jb_compile_options_add_ldflags(&object->compile_options, "$clock-gettime-ldflags");
259
jb_compile_options_add_package(&object->compile_options, "gettext");
260
jb_compile_options_add_package(&object->compile_options, "gnome");
262
if (jb_variable_get_bool("geoip"))
263
jb_compile_options_add_package(&object->compile_options, "geoip");
265
jb_object_add_sources(object,
269
"LM:Cell:Renderer:Color",
277
"LM:Line:Graph:Icon",
278
"LM:Preferences:Dialog",
281
"lm-color-generator",
285
"lm-non-linear-range",
289
jb_group_add_resource(group, JB_GROUP_RESOURCE(object));
293
/*** ui ********************************************************************/
295
group = jb_group_new("ui");
297
jb_group_add_data_files(group,
298
"preferences-dialog.glade", "$pkgdatadir",
299
"GNOME_LinkMonitorApplet.xml", "$datadir/gnome-2.0/ui",
305
JB_MAIN("link-monitor-applet", "3.0", "Link Monitor Applet")