Ejemplo n.º 1
0
    void
    get_library_path (std::string& name, std::string& path)
    {
      rld::process::arg_container args;

      make_cc_command (args);
      append_flags (ft_cppflags, args);
      append_flags (ft_cflags, args);
      args.push_back ("-print-file-name=" + name);

      rld::process::tempfile out;
      rld::process::tempfile err;
      rld::process::status   status;

      status = rld::process::execute (cc_name, args, out.name (), err.name ());

      if ((status.type == rld::process::status::normal) &&
          (status.code == 0))
      {
        if (rld::verbose () >= RLD_VERBOSE_DETAILS)
          out.output ("cc", std::cout, true);
        out.open ();
        out.read (path);
        out.close ();
        if (rld::verbose () >= RLD_VERBOSE_DETAILS)
          std::cout << "cc::libpath: " << name << " -> " << path << std::endl;
      }
      else
      {
        err.output ("cc", std::cout);
      }
    }
Ejemplo n.º 2
0
    static void
    search_dirs ()
    {
      rld::process::arg_container args;

      make_cc_command (args);
      append_flags (ft_cppflags, args);
      append_flags (ft_cflags, args);
      args.push_back ("-print-search-dirs");

      rld::process::tempfile out;
      rld::process::tempfile err;
      rld::process::status   status;

      status = rld::process::execute (cc_name, args, out.name (), err.name ());

      if ((status.type == rld::process::status::normal) &&
          (status.code == 0))
      {
        if (rld::verbose () >= RLD_VERBOSE_DETAILS)
          out.output (cc_name, std::cout, true);
        out.open ();
        while (true)
        {
          std::string line;
          out.read_line (line);
          if (line.size () == 0)
            break;
          if (match_and_trim ("install: ", line, install_path))
            continue;
          if (match_and_trim ("programs: ", line, programs_path))
            continue;
          if (match_and_trim ("libraries: ", line, libraries_path))
            continue;
        }
        out.close ();
        if (rld::verbose () >= RLD_VERBOSE_DETAILS)
        {
          std::cout << "cc::install: " << install_path << std::endl
                    << "cc::programs: " << programs_path << std::endl
                    << "cc::libraries: " << libraries_path << std::endl;
        }
      }
      else
      {
        err.output (cc_name, std::cout);
      }
    }
Ejemplo n.º 3
0
 void
 append_flags (const std::string& flags, flag_type type)
 {
   std::string arch;
   std::string path;
   append_flags (flags, arch, path, type);
 }
Ejemplo n.º 4
0
char *get_reflagged_filename(const char *fn, struct imapflags *newflags)
{
	char *p=malloc(strlen(fn)+20);
	char *q;

	if (!p)	write_error_exit(0);
	strcpy(p, fn);
	if ((q=strrchr(p, MDIRSEP[0])) != 0)	*q=0;
	strcat(p, MDIRSEP "2,");
	append_flags(p, newflags);
	return p;
}