+ const Package::Requirements &pkg_reqs = package.get_required_packages();
+ Package::Requirements direct_reqs = requires;
+ direct_reqs.insert(direct_reqs.end(), pkg_reqs.begin(), pkg_reqs.end());
+ for(Package *r: direct_reqs)
+ final_build_info.update_from(r->get_exported_build_info(), BuildInfo::DEPENDENCY);
+
+ Package::Requirements all_reqs = direct_reqs;
+ deque<Package *> queue(direct_reqs.begin(), direct_reqs.end());
+ while(!queue.empty())
+ {
+ Package *req = queue.front();
+ queue.pop_front();
+
+ for(Package *r: req->get_required_packages())
+ if(!any_equals(all_reqs, r))
+ {
+ final_build_info.update_from(r->get_exported_build_info(), BuildInfo::CHAINED);
+ all_reqs.push_back(r);
+ queue.push_back(r);
+ }
+ }
+
+ final_build_info.update_from(package.get_build_info());
+ final_build_info.update_from(build_info);
+ build_info = final_build_info;
+
+ for(FS::Path &p: build_info.incpath)
+ p = (package.get_source_directory()/p).str();
+ for(FS::Path &p: build_info.libpath)
+ p = (package.get_source_directory()/p).str();
+}
+
+BuildInfo Component::get_build_info_for_path(const FS::Path &path) const
+{
+ // XXX Cache these and check that the directories actually exist before adding them
+ BuildInfo binfo = build_info;
+
+ FS::Path gen_dir = package.get_temp_directory()/"generated";
+ if(FS::descendant_depth(path, gen_dir)>=0)
+ {
+ FS::Path subdir = FS::dirname(FS::relative(path, gen_dir));
+ binfo.local_incpath.push_back(package.get_source_directory()/subdir);
+ }
+ else