9 Component::Component(Package &p, Type t, const string &n):
19 Tries to resolve all references to packages.
21 void Component::resolve_refs()
23 for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i)
28 Prepares the build information for building.
30 void Component::create_build_info()
32 build_info.add(pkg.get_build_info());
34 for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i)
38 //i->get_package()->create_build_info();
39 build_info.add(i->get_package()->get_exported_binfo());
44 build_info.ldflags.push_back("-rdynamic");
45 build_info.libs.push_back("dl");
49 const PathList &host_src=module_host->get_sources();
50 for(PathList::const_iterator i=host_src.begin(); i!=host_src.end(); ++i)
51 build_info.incpath.push_back(i->str());
57 Component::Loader::Loader(Component &c):
60 add("source", &Loader::source);
61 add("install", &Component::install);
62 add("install_headers", &Component::install_headers);
63 add("build_info", &Loader::build_info);
64 add("require", &Loader::require);
65 add("modular", &Loader::modular);
66 add("host", &Loader::host);
69 void Component::Loader::source(const string &s)
71 comp.sources.push_back(comp.pkg.get_source()/s);
74 void Component::Loader::require(const string &n)
76 comp.requires.push_back(PackageRef(comp.pkg.get_builder(), n));
79 void Component::Loader::modular()
81 if(comp.type!=PROGRAM)
82 throw Msp::Exception("Only programs can be modular");
86 void Component::Loader::host(const string &n)
88 const ComponentList &comps=comp.pkg.get_components();
89 for(ComponentList::const_iterator i=comps.begin(); i!=comps.end(); ++i)
92 if(i->get_type()!=PROGRAM || !i->get_modular())
93 throw Msp::Exception("Module host must be a modular program");
98 throw Msp::Exception("Unknown component");
101 void Component::Loader::build_info()
103 load_sub(comp.build_info);