X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinary.cpp;h=448292cf051a5899412ba89329888053312276cc;hb=8f8f10fe41bbb68866e8fb05f8cbab0b325dc7da;hp=b3b882d314427f6bf8efdd73b50210edd50d1112;hpb=f182274c67f6e22cef57df560d33cd180a72f167;p=builder.git diff --git a/source/binary.cpp b/source/binary.cpp index b3b882d..448292c 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -24,6 +24,20 @@ Binary::Binary(Builder &b, const Component &c, const string &p, const list::const_iterator i=objects.begin(); i!=objects.end(); ++i) add_dependency(**i); + + nested_build_sig = true; + arch_in_build_sig = true; +} + +void Binary::collect_build_info(BuildInfo &binfo) const +{ + for(list::const_iterator i=objects.begin(); i!=objects.end(); ++i) + if(const Tool *obj_tool = (*i)->get_tool()) + binfo.update_from(obj_tool->get_build_info()); + + Target::collect_build_info(binfo); + + binfo.update_from(static_binfo); } void Binary::find_dependencies() @@ -31,16 +45,24 @@ void Binary::find_dependencies() if(!component) return; - list queue; + list queue; list dep_libs; set missing_libs; - queue.push_back(component); - while(!queue.empty()) + queue.push_back(this); + for(list::iterator j=queue.begin(); j!=queue.end(); ++j) { - const Component *c = queue.front(); - queue.erase(queue.begin()); + Target *tgt = *j; - const BuildInfo &binfo = c->get_build_info(); + BuildInfo binfo; + tgt->collect_build_info(binfo); + if(tgt!=this) + { + static_binfo.libpath.insert(static_binfo.libpath.end(), binfo.libpath.begin(), binfo.libpath.end()); + static_binfo.keep_symbols.insert(static_binfo.keep_symbols.end(), binfo.keep_symbols.begin(), binfo.keep_symbols.end()); + } + + list::iterator insert_pos = j; + ++insert_pos; for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i) { if(i->size()>10 && !i->compare(i->size()-10, 10, ".framework")) @@ -52,11 +74,7 @@ void Binary::find_dependencies() { Target *real = lib->get_real_target(); if(StaticLibrary *stlib = dynamic_cast(real)) - { - dep_libs.push_back(stlib); - if(stlib->get_component()) - queue.push_back(stlib->get_component()); - } + queue.insert(insert_pos, stlib); else dep_libs.push_back(lib); } @@ -65,6 +83,9 @@ void Binary::find_dependencies() } } + queue.pop_front(); + dep_libs.splice(dep_libs.begin(), queue); + /* Add only the last occurrence of each library to the actual dependencies. This ensures that static library ordering is correct. */ for(list::iterator i=dep_libs.begin(); i!=dep_libs.end(); ++i) @@ -76,20 +97,3 @@ void Binary::find_dependencies() add_dependency(**i); } } - -string Binary::create_build_signature() const -{ - set object_tools; - for(list::const_iterator i=objects.begin(); i!=objects.end(); ++i) - object_tools.insert((*i)->get_tool()); - - list sigs; - for(set::const_iterator i=object_tools.begin(); i!=object_tools.end(); ++i) - sigs.push_back((*i)->create_build_signature(component->get_build_info())); - sigs.sort(); - sigs.push_front(tool->create_build_signature(component->get_build_info())); - if(const Architecture *arch = tool->get_architecture()) - sigs.push_front(arch->get_name()); - - return join(sigs.begin(), sigs.end(), ";"); -}