- string optimize=config.get_option("optimize").value;
- if(strtol(optimize))
- {
- build_info.cflags.push_back("-O"+optimize);
- string cpu=config.get_option("cpu").value;
- if(cpu!="auto")
- build_info.cflags.push_back("-march="+cpu);
- }
-
- if(strtobool(config.get_option("debug").value))
- build_info.cflags.push_back("-ggdb");
-
- build_info.unique();
- export_binfo.unique();
-
- for(list<Component>::iterator i=components.begin(); i!=components.end(); ++i)
- {
- i->create_build_info();
- if(i->get_type()==Component::LIBRARY)
- export_binfo.libs.push_back(i->get_name());
- }
-
- build_info_ready=true;
-}
-
-void Package::process_options(const RawOptionMap &opts)
-{
- if(config.process(opts))
- config.save(source/".options.cache");
-}
-
-Package *Package::create(Builder &b, const string &name)
-{
- list<string> argv;
- argv.push_back("pkg-config");
- argv.push_back("--silence-errors");
- argv.push_back("--cflags");
- argv.push_back("--libs");
- argv.push_back(name);
- vector<string> info=split(run_command(argv));
-
- if(info.empty())
- {
- if(name=="opengl")
- info.push_back("-lGL");
- else if(name=="pthread")
- info.push_back("-lpthread");
- else if(name=="gmpxx")
- info.push_back("-lgmpxx");
- else
- return 0;
- }
-
- Package *pkg=new Package(b, name, info);
- return pkg;
-}