X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Fcomponent.cpp;h=48675f7e5d7c0148cc2752f39f6946ff163a9f32;hb=65ba6a595dd4a1d74675abcfdf96307062dc43eb;hp=d1849f4027ead3b480af4db82294537fe0d7d124;hpb=373e9bb43c24d38316c5bb0393f4a369563319d3;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index d1849f4..48675f7 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -243,6 +243,8 @@ Component::SourceList Component::collect_source_files() const Component::Loader::Loader(Component &c): DataFile::ObjectLoader(c) { + add("if_arch", &Loader::if_arch); + add("if_feature", &Loader::if_feature); add("source", &Loader::source); add("install", &Component::install); add("install_map", &Loader::install_map); @@ -252,21 +254,27 @@ Component::Loader::Loader(Component &c): add("use", &Loader::use); } -void Component::Loader::source(const string &s) +void Component::Loader::build_info() { - obj.sources.push_back((obj.package.get_source_directory()/s).str()); + load_sub(obj.build_info); } -void Component::Loader::require(const string &n) +void Component::Loader::if_arch(const string &cond) { - Package *req = obj.package.get_builder().get_package_manager().find_package(n); - if(req) - obj.requires.push_back(req); + bool match = obj.package.get_builder().get_current_arch().match_name(cond); + obj.package.get_builder().get_logger().log("configure", + format("%s/%s: arch %s %smatched", obj.package.get_name(), obj.name, cond, (match ? "" : "not "))); + if(match) + load_sub_with(*this); } -void Component::Loader::build_info() +void Component::Loader::if_feature(const string &cond) { - load_sub(obj.build_info); + bool match = obj.package.match_feature(cond); + obj.package.get_builder().get_logger().log("configure", + format("%s/%s: feature %s %smatched", obj.package.get_name(), obj.name, cond, (match ? "" : "not "))); + if(match) + load_sub_with(*this); } void Component::Loader::install_map() @@ -274,6 +282,18 @@ void Component::Loader::install_map() load_sub(obj.install_map, obj.package.get_source_directory()); } +void Component::Loader::require(const string &n) +{ + Package *req = obj.package.get_builder().get_package_manager().find_package(n); + if(req) + obj.requires.push_back(req); +} + +void Component::Loader::source(const string &s) +{ + obj.sources.push_back((obj.package.get_source_directory()/s).str()); +} + void Component::Loader::use(const string &n) { const SourcePackage::ComponentList &components = obj.package.get_components();