X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuilder.cpp;h=7ba6be89a55fd03ccc5d570f4a325ff2c0b29300;hb=683301f94f4a3c5b7e2a7f21087f4185b07c4858;hp=e6f036b7028f409ec0851615d068152dd1547966;hpb=b0eb979b0dc79269cb3bb5bb2e67ef4e80689cfe;p=builder.git diff --git a/source/builder.cpp b/source/builder.cpp index e6f036b..7ba6be8 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -132,7 +132,8 @@ Package *Builder::get_package(const string &n) Package *pkg=Package::create(*this, n); packages.insert(PackageMap::value_type(n, pkg)); - new_pkgs.push_back(pkg); + if(pkg) + new_pkgs.push_back(pkg); return pkg; } @@ -216,17 +217,12 @@ int Builder::main() std::list missing; for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i) - { - const list &requires=i->second->get_requires(); - for(list::const_iterator j=requires.begin(); j!=requires.end(); ++j) - if(!j->get_package()) - missing.push_back(j->get_name()); - } + if(!i->second) + missing.push_back(i->first); if(!missing.empty()) { missing.sort(); - missing.unique(); cerr<<"The following packages were not found on the system:\n"; for(list::iterator i=missing.begin(); i!=missing.end(); ++i) cerr<<" "<<*i<<'\n'; @@ -305,6 +301,10 @@ int Builder::create_targets() if(!i->second->get_buildable()) continue; + Path::Path inst_base; + if(i->second->get_config().is_option("prefix")) + inst_base=i->second->get_config().get_option("prefix").value; + const ComponentList &components=i->second->get_components(); for(ComponentList::const_iterator j=components.begin(); j!=components.end(); ++j) { @@ -312,13 +312,18 @@ int Builder::create_targets() const PathList &sources=j->get_sources(); for(PathList::const_iterator k=sources.begin(); k!=sources.end(); ++k) { - list sfiles=list_files(*k); - for(list::iterator l=sfiles.begin(); l!=sfiles.end(); ++l) - files.push_back(*k / *l); + struct stat st; + stat(*k, st); + if(S_ISDIR(st.st_mode)) + { + list sfiles=list_files(*k); + for(list::iterator l=sfiles.begin(); l!=sfiles.end(); ++l) + files.push_back(*k / *l); + } + else + files.push_back(*k); } - Path::Path inst_base=i->second->get_config().get_option("prefix").value; - bool build_exe=j->get_type()!=Component::HEADERS; list objs; @@ -446,12 +451,8 @@ int Builder::build() vector actions; - //ProgressBar *progress=0; if(chrome) - { - //progress=new ProgressBar(cout, total); cout<<"0 targets built\n"; - } unsigned count=0; bool fail=false; @@ -464,12 +465,6 @@ int Builder::build() Target *tgt=cmdline->get_buildable_target(); if(tgt) { - /*if(chrome) - { - cout<<"\e["<set(count); - cout<<"\e["<build(); if(action) actions.push_back(action); @@ -509,8 +504,6 @@ int Builder::build() } } - //delete progress; - return fail?-1:0; }