-/* $Id$ */
-
package "builder"
{
version "2.0";
list<string> tc_archs = list_files(toolchains_dir/use_toolchain/"prebuilt");
string use_arch;
for(list<string>::const_iterator i=tc_archs.begin(); i!=tc_archs.end(); ++i)
- {
- string tca = *i;
- for(string::iterator j=tca.begin(); j!=tca.end(); ++j)
- if(*j=='_')
- *j = '-';
- if(native_arch.match_name(tca))
+ if(native_arch.match_name(*i))
{
use_arch = *i;
break;
}
- }
if(use_arch.empty())
throw runtime_error("No matching toolchain found");
#include "filetarget.h"
/**
-Just an arbitary file. No special meaning attached.
+Just an arbitrary file. No special meaning attached.
*/
class File: public FileTarget
{
Task *GnuCompiler::run(const Target &target) const
{
const ObjectFile &object = dynamic_cast<const ObjectFile &>(target);
- const Component &comp = *object.get_component();
ExternalTask::Arguments argv;
argv.push_back(executable->get_path().str());
FS::Path obj_path = object.get_path();
FS::Path src_path = object.get_source().get_path();
- FS::Path work_dir = comp.get_package().get_source_directory();
+ FS::Path work_dir = object.get_component()->get_package().get_source_directory();
argv.push_back("-o");
argv.push_back(relative(obj_path, work_dir).str());
vector<string> argv;
argv.push_back(executable->get_path().str());
- const Component &comp = *bin.get_component();
-
- FS::Path work_dir = comp.get_package().get_source_directory();
+ FS::Path work_dir = bin.get_component()->get_package().get_source_directory();
if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&bin))
{
SourceList source_filenames = collect_source_files();
for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
- FileTarget *ft;
- if(Target *tgt = builder.get_vfs().get_target(*i))
- ft = dynamic_cast<FileTarget *>(tgt);
- else
- ft = new File(builder, package, *i);
- inst->add_dependency(*copy.create_target(*ft, name));
+ Target *tgt = builder.get_vfs().get_target(*i);
+ if(!tgt)
+ tgt = new File(builder, package, *i);
+ inst->add_dependency(*copy.create_target(*tgt, name));
}
}
public:
PkgConfigFile(Builder &, const SourcePackage &);
- virtual const char *get_type() const { return "PkgConfig"; }
+ virtual const char *get_type() const { return "PkgConfigFile"; }
};
#endif
return primary;
}
-void SourceGenerator::do_prepare()
-{
- FS::Path exe_fn = package.get_source_directory()/command;
- executable = builder.get_vfs().get_target(exe_fn);
- if(!executable)
- executable = new Executable(builder, exe_fn);
-}
-
Task *SourceGenerator::run(const Target &target) const
{
const SourceFile &out_src = dynamic_cast<const SourceFile &>(target);
void SourceGenerator::Loader::command(const string &c)
{
- obj.set_command(c);
+ obj.set_command((obj.package.get_source_directory()/c).str());
}
void SourceGenerator::Loader::in_suffix(const string &s)
virtual Target *create_source(const Component &, const Msp::FS::Path &) const;
virtual Target *create_target(const std::list<Target *> &, const std::string &);
-private:
- virtual void do_prepare();
-
-public:
virtual Task *run(const Target &) const;
};
void SourcePackage::Loader::init(const Config::InputOptions *o)
{
options = o;
- add("description", &SourcePackage::description);
add("build_info", &Loader::build_info);
+ add("datapack", &Loader::component<DataPackComponent>);
+ add("description", &SourcePackage::description);
add("feature", &Loader::feature);
add("generate", &Loader::generate);
add("if_feature", &Loader::if_feature);
- add("program", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::PROGRAM>);
- add("library", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::LIBRARY>);
- add("module", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::MODULE>);
add("install", &Loader::component<InstallComponent>);
add("interface_version", &Loader::interface_version);
- add("datapack", &Loader::component<DataPackComponent>);
+ add("library", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::LIBRARY>);
+ add("module", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::MODULE>);
+ add("program", &Loader::component_arg<BinaryComponent, BinaryComponent::Type, BinaryComponent::PROGRAM>);
add("source_archive", &Loader::source_archive);
add("source_tarball", &Loader::source_archive);
add("tarball", &Loader::tarball);