if(!build_file)
build_file = new File(builder, *this, f);
components.push_back(Component(*this, Component::TARBALL, "@src"));
+ source_tarball = &components.back();
}
void SourcePackage::set_build_type(const BuildType &t)
FS::Path SourcePackage::get_out_dir() const
{
const Architecture &arch = builder.get_current_arch();
- string detail = (build_type ? build_type->get_name() : string());
if(arch.is_native())
- return source_dir/detail;
+ return source_dir;
else
- return source_dir/arch.get_name()/detail;
+ return source_dir/arch.get_name();
}
-void SourcePackage::create_build_info()
+void SourcePackage::do_prepare()
{
BuildInfo final_build_info;
export_binfo.incpath.push_back((builder.get_prefix()/"include").str());
export_binfo.libpath.push_back((builder.get_prefix()/"lib").str());
}
-}
-void SourcePackage::create_targets()
-{
cache.load();
bool pc_needed = false;
add("build_info", &Loader::build_info);
add("feature", &Loader::feature);
add("if", &Loader::condition);
- add("if_arch", &Loader::if_arch);
add("if_feat", &Loader::if_feature);
add("program", &Loader::component<Component::PROGRAM>);
add("library", &Loader::component<Component::LIBRARY>);
add("headers", &Loader::headers);
add("install", &Loader::component<Component::INSTALL>);
add("datafile", &Loader::component<Component::DATAFILE>);
+ add("source_tarball", &Loader::source_tarball);
add("tarball", &Loader::tarball);
add("tar_file", &Loader::tar_file);
}
install_map[*i] = "include/"+comp.get_name();
}
-void SourcePackage::Loader::if_arch(const string &cond)
-{
- const Architecture &arch = obj.builder.get_current_arch();
- bool negate = (cond[0]=='!');
- bool match = (arch.match_name(cond.substr(negate))!=negate);
- obj.builder.get_logger().log("configure", format("%s: arch %s %smatched", obj.name, cond, (match ? "" : "not ")));
- if(match)
- load_sub_with(*this);
-}
-
void SourcePackage::Loader::if_feature(const string &cond)
{
bool match = false;
load_sub_with(*this);
}
+void SourcePackage::Loader::source_tarball()
+{
+ load_sub(*obj.source_tarball);
+}
+
void SourcePackage::Loader::tarball(const string &n)
{
if(n=="@src")
{
- for(ComponentList::iterator i=obj.components.begin(); i!=obj.components.end(); ++i)
- if(i->get_type()==Component::TARBALL && i->get_name()==n)
- load_sub(*i);
+ IO::print("%s: Note: Use source_tarball instead of tarball \"@src\"\n", get_source());
+ load_sub(*obj.source_tarball);
}
else
{