X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuildinfo.cpp;h=af4865498c5fd61c2105d987f783ff23d21d5466;hb=32d6218afe58969f2b18dfa6e262bb9509829abe;hp=114a368ecc96feabec39807621d1dc0d1a363e85;hpb=5c8e939372ae18bef52a2961826f8467d29f12f3;p=builder.git diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp index 114a368..af48654 100644 --- a/source/buildinfo.cpp +++ b/source/buildinfo.cpp @@ -28,6 +28,7 @@ void unique(list &l) BuildInfo::BuildInfo(): libmode(DYNAMIC), + rpath_mode(NO_RPATH), threads(false), debug(false), optimize(0), @@ -50,8 +51,20 @@ void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level) defines[i->first] = i->second; incpath.insert(incpath.begin(), bi.incpath.begin(), bi.incpath.end()); threads = bi.threads; + for(StandardMap::const_iterator i=bi.standards.begin(); i!=bi.standards.end(); ++i) - standards[i->first] = i->second; + { + StandardMap::iterator j = standards.find(i->first); + if(j==standards.end()) + standards.insert(*i); + else if(i->second.type!=j->second.type || i->second.year!=j->second.year) + { + if(!i->second.type.compare(0, 3, "gnu")) + j->second.type = i->second.type; + if(i->second.year>j->second.year) + j->second.year = i->second.year; + } + } if(level!=CHAINED) { @@ -64,6 +77,7 @@ void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level) sysroot = bi.sysroot; local_incpath.insert(local_incpath.begin(), bi.local_incpath.begin(), bi.local_incpath.end()); libmode = bi.libmode; + rpath_mode = bi.rpath_mode; for(LibModeMap::const_iterator i=bi.libmodes.begin(); i!=bi.libmodes.end(); ++i) libmodes[i->first] = i->second; keep_symbols.insert(keep_symbols.end(), bi.keep_symbols.begin(), bi.keep_symbols.end()); @@ -82,6 +96,23 @@ void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level) } +BuildInfo::LanguageStandard::LanguageStandard(const string &std) +{ + string::size_type num = string::npos; + for(string::size_type i=0; (num==string::npos && i(std[i]))) + num = i; + type = std.substr(0, num); + year = lexical_cast(std.substr(num)); + year += (year<70 ? 2000 : 1900); +} + +string BuildInfo::LanguageStandard::str() const +{ + return format("%s%02d", type, year%100); +} + + BuildInfo::Loader::Loader(BuildInfo &bi): DataFile::ObjectLoader(bi) { @@ -95,6 +126,7 @@ BuildInfo::Loader::Loader(BuildInfo &bi): add("libmode", &Loader::libmode_for_lib); add("local_incpath", &Loader::local_incpath); add("optimize", &BuildInfo::optimize); + add("runtime_path_mode", &BuildInfo::rpath_mode); add("standard", &Loader::standard); add("strip", &BuildInfo::strip); add("sysroot", &Loader::sysroot); @@ -162,3 +194,16 @@ void operator>>(const LexicalConverter &conv, BuildInfo::LibraryMode &libmode) else throw lexical_error(format("Conversion of '%s' to LibraryMode", conv.get())); } + + +void operator>>(const LexicalConverter &conv, BuildInfo::RuntimePathMode &rpath_mode) +{ + if(conv.get()=="NONE") + rpath_mode = BuildInfo::NO_RPATH; + else if(conv.get()=="RELATIVE") + rpath_mode = BuildInfo::RELATIVE; + else if(conv.get()=="ABSOLUTE") + rpath_mode = BuildInfo::ABSOLUTE; + else + throw lexical_error(format("Conversion of '%s' to RuntimePathMode", conv.get())); +}