return source_dir/arch.get_name();
}
+bool SourcePackage::match_feature(const string &cond) const
+{
+ string::size_type equals = cond.find('=');
+ if(equals!=string::npos)
+ {
+ if(equals==0)
+ throw invalid_argument("SourcePackage::match_feature");
+ bool negate = cond[equals-1]=='!';
+ string feat = cond.substr(0, equals-negate);
+ string value = config.get_option("with_"+feat).value;
+ return (value==cond.substr(equals+1))!=negate;
+ }
+ else
+ {
+ bool negate = (cond[0]=='!');
+ string feat = cond.substr(negate);
+ string value = config.get_option("with_"+feat).value;
+ return lexical_cast<bool>(value)!=negate;
+ }
+}
+
void SourcePackage::do_prepare()
{
BuildInfo final_build_info;
if(pc_needed)
{
PkgConfigFile *pc = new PkgConfigFile(builder, *this);
- builder.get_target("install")->add_dependency(*builder.get_toolchain().get_tool("CP").create_target(*pc));
+ builder.get_build_graph().get_target("install")->add_dependency(*builder.get_toolchain().get_tool("CP").create_target(*pc));
}
}
void SourcePackage::Loader::if_feature(const string &cond)
{
- bool match = false;
- string::size_type equals = cond.find('=');
- if(equals!=string::npos)
- {
- if(equals==0)
- throw invalid_argument("SourcePackage::Loader::if_feature");
- bool negate = cond[equals-1]=='!';
- string name = cond.substr(0, equals-negate);
- string value = obj.config.get_option("with_"+name).value;
- match = (value==cond.substr(equals+1))!=negate;
- value = cond.substr(equals+1);
- }
- else
- {
- bool negate = (cond[0]=='!');
- string name = cond.substr(negate);
- string value = obj.config.get_option("with_"+name).value;
- match = lexical_cast<bool>(value)!=negate;
- }
+ bool match = obj.match_feature(cond);
obj.builder.get_logger().log("configure", format("%s: feature %s %smatched", obj.name, cond, (match ? "" : "not ")));
if(match)
load_sub_with(*this);