Пример #1
0
/*
 * If one or more options (bool variables) in the provided
 * NULL-terminated list are enabled, checks for the specified
 * packages. If the packages are not found, disable the provided
 * options.
 */
void
jb_check_packages_for_options (const char *group_name,
			       const char *varprefix,
			       const char *packages,
			       ...)
{
  GSList *options = NULL;
  va_list args;
  const char *option;
  gboolean needs_packages = FALSE;

  g_return_if_fail(group_name != NULL);
  g_return_if_fail(varprefix != NULL);
  g_return_if_fail(packages != NULL);
  g_return_if_fail(jb_feature_is_enabled(&jb_pkg_config_feature));

  va_start(args, packages);
  while ((option = va_arg(args, const char *)) != NULL)
    {
      options = g_slist_append(options, (gpointer) option);

      if (jb_variable_get_bool(option))
	needs_packages = TRUE;
    }
  va_end(args);

  if (needs_packages && ! jb_check_packages(group_name, varprefix, packages))
    {
      GSList *l;

      JB_LIST_FOREACH(l, options)
	{
	  option = l->data;

	  if (jb_variable_get_bool(option))
	    {
	      jb_warning("disabling option \"%s\" since %s was not found", option, group_name);
	      jb_variable_set_bool(option, FALSE);
	    }
	}
Пример #2
0
void
jb_package_configure (void)
{
  if (lm_glibc_check())
    {
      /*
       * We need -std=c99 for lround(), ...
       * We need _BSD_SOURCE (which requires -lbsd-compat) for struct icmp, ...
       * We need _POSIX_C_SOURCE for struct addrinfo, clock_gettime(), ...
       */
      jb_variable_set_string("glibc-cflags", "-std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L");
      jb_variable_set_string("glibc-cppflags", "");
      // jb_variable_set_string("glibc-ldflags", "-lbsd-compat");
      jb_variable_set_string("glibc-ldflags", "");
    }
  else
    {
      jb_variable_set_string("glibc-cflags", "");
      jb_variable_set_string("glibc-cppflags", "");
      jb_variable_set_string("glibc-ldflags", "");
    }

  if (jb_check_functions("clock_gettime", "rt"))
    jb_variable_set_string("clock-gettime-ldflags", "-lrt");
  else if (jb_check_functions("clock_gettime", NULL))
    jb_variable_set_string("clock-gettime-ldflags", "");
  else
    jb_error("clock_gettime() found neither in librt nor in libc");

  jb_check_reentrant_dns_resolver();

  jb_require_packages("GNOME", "gnome", "gthread-2.0 gtk+-3.0 libpanelapplet-4.0 gmodule-2.0");

  if (jb_variable_get_bool("geoip"))
    {
      if (lm_geoip_check())
	{
	  if (! lm_gdk_pixbuf_loader_check("art/flags/fr.svg", "image/svg+xml"))
	    jb_warning("GTK+ cannot load image/svg+xml images, country flags will not be displayed");
	}
      else
	{
	  jb_warning("disabling option \"geoip\" since GeoIP was not found");
	  jb_variable_set_bool("geoip", FALSE);
	}
    }

  report_invalid_prefix();
}
Пример #3
0
void
jb_package_add_resources (void)
{
  JBGroup *group;
  JBObject *object;

  if (jb_variable_get_bool("compile-warnings"))
    jb_compile_options_add_cflags(&jb_compile_options, LM_WARNING_CFLAGS " -Werror");

  if (! jb_variable_get_bool("debug"))
    jb_compile_options_add_cflags(&jb_compile_options, "-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS");

  jb_compile_options_add_gob2flags(&jb_compile_options, "--exit-on-warn");

  /*** art *******************************************************************/

  group = jb_group_new("art");

  jb_group_add_data_file(group, "link-monitor-applet.png", "$datadir/pixmaps");

  if (jb_variable_get_bool("geoip"))
    jb_group_add_data_files_pattern(group, "flags/*.svg", "$pkgdatadir/flags");

  jb_group_add(group);

  /*** data ******************************************************************/

  group = jb_group_new("data");

  jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_template_new("LinkMonitorApplet.panel-applet.in.in")));
  jb_group_add_panel_applet(group, "LinkMonitorApplet.panel-applet.in");
  jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_template_new("LinkMonitorApplet.service.in.in")));
  jb_group_add_dbus_service(group, "LinkMonitorApplet.service.in");

  jb_group_add_gconf_schemas(group, "link-monitor-applet.schemas.in");

  jb_group_add(group);

  /*** help ******************************************************************/

  group = jb_group_new("help");

  jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_gnome_help_new("C", "documentation-license.xml software-license.xml")));

  jb_group_add(group);

  /*** jbsrc *****************************************************************/

  group = jb_group_new("jbsrc");

  jb_group_add_dist_files(group,
			  "lm-gdk-pixbuf-loader-test.c",
			  "lm-glibc-test.c",
			  NULL);

  jb_group_add(group);

  /*** po ********************************************************************/

  group = jb_group_new("po");

  jb_group_add_translations(group, "bg fr it");

  jb_group_add(group);

  /*** src *******************************************************************/

  group = jb_group_new("src");

  object = JB_OBJECT(jb_program_new("link-monitor-applet"));

  jb_install_options_set_installdir(&object->install_options, "$libexecdir");

  if (jb_variable_get_bool("suid-root"))
    {
      jb_install_options_set_owner(&object->install_options, "root");
      jb_install_options_set_extra_mode(&object->install_options, S_ISUID);
    }

  jb_compile_options_add_string_defines(&object->compile_options,
					"PACKAGE", "$package", 
					"VERSION", "$version",
					"GETTEXT_PACKAGE", "$package",
					"PREFIX", "$prefix",
					"SYSCONFDIR", "$sysconfdir",
					"DATADIR", "$datadir",
					"PKGDATADIR", "$pkgdatadir",
					"LIBDIR", "$libdir",
					"GNOMELOCALEDIR", "$datadir/locale",
					"GNOMEPIXMAPSDIR", "$datadir/pixmaps",
					NULL);

  /*
   * We need --export-dynamic because because libglade needs to
   * resolve symbols from our own binary in order to autoconnect
   * signal handlers.
   */
  jb_compile_options_add_ldflags(&object->compile_options, "-Wl,--export-dynamic");
    
  jb_compile_options_add_ldflags(&object->compile_options, "-lm");

  jb_compile_options_add_package(&object->compile_options, "glibc");
  jb_compile_options_add_ldflags(&object->compile_options, "$clock-gettime-ldflags");
  jb_compile_options_add_package(&object->compile_options, "gettext");
  jb_compile_options_add_package(&object->compile_options, "gnome");

  if (jb_variable_get_bool("geoip"))
    jb_compile_options_add_package(&object->compile_options, "geoip");

  jb_object_add_sources(object,
			"LM:About:Dialog",
			"LM:Applet",
			"LM:Bar:Graph",
			"LM:Cell:Renderer:Color",
			"LM:Data:Set",
			"LM:Dialog",
			"LM:Framed:Image",
			"LM:Host",
			"LM:Host:Frontend",
			"LM:Host:View",
			"LM:Line:Graph",
			"LM:Line:Graph:Icon",
			"LM:Preferences:Dialog",
			"LM:Shell",
			"LM:Tooltips",
			"lm-color-generator",
			"lm-decls.h",
			"lm-icmp",
			"lm-main.c",
			"lm-non-linear-range",
			"lm-util",
			NULL);

  jb_group_add_resource(group, JB_GROUP_RESOURCE(object));

  jb_group_add(group);

  /*** ui ********************************************************************/

  group = jb_group_new("ui");

  jb_group_add_data_files(group,
			  "preferences-dialog.ui", "$pkgdatadir",
			  "lm-style.css", "$pkgdatadir",
			  "GNOME_LinkMonitorApplet.xml", "$datadir/gnome-2.0/ui",
			  NULL);

  jb_group_add(group);
}