X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcomponent.cpp;h=e48e4f518477ff285d8b2878e8739d0f6b5147ca;hb=f4a10e1dc189f28367eafe3b91723d275928ced7;hp=87252d574f98c67548861757cacbdc931a6bdf1e;hpb=49ee08bb6f63f6b3a8cdd3b7cf032dea9b2cba8a;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index 87252d5..e48e4f5 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -35,11 +35,18 @@ Component::Component(SourcePackage &p, Type t, const string &n): type(t), name(n), install(false), - module_host(0), - modular(false), deflt(true) { } +void Component::configure(const StringMap &opts, unsigned flag) +{ + for(StringList::iterator i=sources.begin(); i!=sources.end(); ++i) + *i = (pkg.get_source()/pkg.expand_string(*i)).str(); + + for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i) + (*i)->configure(opts, flag&2); +} + void Component::create_build_info() { const PackageList &pkg_reqs = pkg.get_requires(); @@ -92,18 +99,6 @@ void Component::create_build_info() build_info.cflags.push_back("-fPIC"); } - if(modular) - { - build_info.ldflags.push_back("-rdynamic"); - build_info.libs.push_back("dl"); - } - else if(module_host) - { - const PathList &host_src = module_host->get_sources(); - for(PathList::const_iterator i=host_src.begin(); i!=host_src.end(); ++i) - build_info.incpath.push_back(i->str()); - } - build_info.unique(); } @@ -237,23 +232,25 @@ void Component::create_targets() const if(type==LIBRARY) if(SharedLibrary *shlib = dynamic_cast(*i)) - inst_tgt->add_depend(new Symlink(builder, pkg, *inst, shlib->get_name())); + if(!shlib->get_soname().empty()) + inst_tgt->add_depend(new Symlink(builder, pkg, *inst, shlib->get_name())); } } PathList Component::collect_source_files() const { PathList files; - for(PathList::const_iterator i=sources.begin(); i!=sources.end(); ++i) + for(StringList::const_iterator i=sources.begin(); i!=sources.end(); ++i) { - if(FS::is_dir(*i)) + FS::Path path(*i); + if(FS::is_dir(path)) { - list sfiles = list_files(*i); + list sfiles = list_files(path); for(list::iterator j=sfiles.begin(); j!=sfiles.end(); ++j) - files.push_back(*i / *j); + files.push_back(path / *j); } else - files.push_back(*i); + files.push_back(path); } return files; @@ -286,7 +283,7 @@ void Component::Loader::finish() void Component::Loader::source(const string &s) { - comp.sources.push_back(comp.pkg.get_source()/s); + comp.sources.push_back(s); } void Component::Loader::require(const string &n) @@ -298,24 +295,14 @@ void Component::Loader::require(const string &n) void Component::Loader::modular() { - if(comp.type!=PROGRAM) - throw Exception("Only programs can be modular"); - comp.modular = true; + IO::print("%s: Note: modular is deprecated\n", get_source()); + comp.build_info.ldflags.push_back("-rdynamic"); + comp.build_info.libs.push_back("dl"); } -void Component::Loader::host(const string &n) +void Component::Loader::host(const string &) { - const ComponentList &comps = comp.pkg.get_components(); - for(ComponentList::const_iterator i=comps.begin(); i!=comps.end(); ++i) - if(i->get_name()==n) - { - if(i->get_type()!=PROGRAM || !i->is_modular()) - throw Exception("Module host must be a modular program"); - comp.module_host = &*i; - return; - } - - throw KeyError("Unknown component", n); + IO::print("%s: Note: host is deprecated\n", get_source()); } void Component::Loader::install_headers(const string &p)