void parse_specification(const std::string &);
};
-typedef std::map<std::string, Architecture> ArchMap;
-
#endif
string work_dir;
bool full_paths = false;
unsigned max_depth = 4;
- StringList cmdline_warn;
string prfx;
string temp_str;
string arch;
{
string::size_type equal = i->find('=');
if(equal!=string::npos)
- cmdline_options.insert(StringMap::value_type(i->substr(0, equal), i->substr(equal+1)));
+ cmdline_options.insert(Config::InputOptions::value_type(i->substr(0, equal), i->substr(equal+1)));
else
cmdline_targets.push_back(*i);
}
// Make the cmdline target depend on all targets mentioned on the command line
Target *cmdline = new VirtualTarget(*this, "cmdline");
- for(list<string>::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
+ for(NameList::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
{
Target *tgt = get_target(*i);
if(!tgt)
cmdline->prepare();
// Apply what-ifs
- for(StringList::iterator i=what_if.begin(); i!=what_if.end(); ++i)
+ for(NameList::iterator i=what_if.begin(); i!=what_if.end(); ++i)
{
FileTarget *tgt = vfs.get_target(cwd/ *i);
if(!tgt)
const Config::OptionMap &options = config.get_options();
IO::print("Required packages:\n ");
- const PackageList &requires = main_pkg->get_required_packages();
- for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
+ const Package::Requirements &requires = main_pkg->get_required_packages();
+ for(Package::Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i)
{
if(i!=requires.begin())
IO::print(", ");
#include "buildtype.h"
#include "config.h"
#include "logger.h"
-#include "misc.h"
#include "packagemanager.h"
#include "problem.h"
#include "target.h"
typedef std::map<std::string, Target *> TargetMap;
private:
+ typedef std::list<std::string> NameList;
typedef std::map<std::string, BuildType> BuildTypeMap;
+ typedef std::list<Problem> ProblemList;
- StringList cmdline_targets;
+ NameList cmdline_targets;
Config::InputOptions cmdline_options;
Msp::FS::Path cwd;
bool show_progress;
std::string build_file;
unsigned jobs;
- StringList what_if;
+ NameList what_if;
bool conf_all;
bool conf_only;
bool build_all;
#include <list>
#include <string>
#include <msp/datafile/objectloader.h>
-#include "misc.h"
+#include <msp/fs/path.h>
/**
Stores information about compiler command line parameters in a more abstract
#define CACHE_H_
#include <msp/time/timestamp.h>
-#include "misc.h"
class SourcePackage;
class Target;
void Component::prepare()
{
- for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
+ for(Package::Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i)
(*i)->prepare();
}
{
BuildInfo final_build_info;
- const PackageList &pkg_reqs = package.get_required_packages();
- PackageList direct_reqs = requires;
+ const Package::Requirements &pkg_reqs = package.get_required_packages();
+ Package::Requirements direct_reqs = requires;
direct_reqs.insert(direct_reqs.end(), pkg_reqs.begin(), pkg_reqs.end());
- PackageList all_reqs = direct_reqs;
- for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
+ Package::Requirements all_reqs = direct_reqs;
+ for(Package::Requirements::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
{
BuildInfo::UpdateLevel level = BuildInfo::CHAINED;
if(find(direct_reqs.begin(), direct_reqs.end(), *i)!=direct_reqs.end())
level = BuildInfo::DEPENDENCY;
final_build_info.update_from((*i)->get_exported_build_info(), level);
- const PackageList &reqs = (*i)->get_required_packages();
- for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j)
+ const Package::Requirements &reqs = (*i)->get_required_packages();
+ for(Package::Requirements::const_iterator j=reqs.begin(); j!=reqs.end(); ++j)
if(find(all_reqs.begin(), all_reqs.end(), *j)==all_reqs.end())
all_reqs.push_back(*j);
}
if(build_info.libmode<BuildInfo::DYNAMIC)
{
- for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
+ for(Package::Requirements::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
{
const BuildInfo &ebi = (*i)->get_exported_build_info();
build_info.libpath.insert(build_info.libpath.end(), ebi.libpath.begin(), ebi.libpath.end());
Builder &builder = package.get_builder();
const Toolchain &toolchain = builder.get_toolchain();
- PathList source_filenames = collect_source_files();
+ SourceList source_filenames = collect_source_files();
list<Target *> inst_list;
string inst_loc;
const Tool &tar = toolchain.get_tool("TAR");
list<Target *> files;
- for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+ for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
FileTarget *file = builder.get_vfs().get_target(*i);
if(!file)
else if(type==INSTALL)
{
inst_loc = name;
- for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+ for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
FileTarget *ft;
if(Target *tgt = builder.get_vfs().get_target(*i))
if(type==PROGRAM || type==LIBRARY || type==MODULE)
{
list<Target *> objs;
- for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+ for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
string ext = FS::extpart(FS::basename(*i));
const Tool *tool = toolchain.get_tool_for_suffix(ext, true);
}
}
-PathList Component::collect_source_files() const
+Component::SourceList Component::collect_source_files() const
{
- PathList files;
- for(StringList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ SourceList files;
+ for(SourceList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
{
FS::Path path(*i);
if(FS::is_dir(path))
#include <msp/fs/path.h>
#include "buildinfo.h"
#include "installmap.h"
-#include "misc.h"
#include "package.h"
class SourcePackage;
TARBALL
};
+ typedef std::list<Msp::FS::Path> SourceList;
+
protected:
SourcePackage &package;
Type type;
std::string name;
- StringList sources;
+ SourceList sources;
bool install;
BuildInfo build_info;
- PackageList requires;
+ Package::Requirements requires;
bool deflt;
InstallMap install_map;
/** Returns a list of sources for the component. They may refer to
directories or individual files. */
- const StringList &get_sources() const { return sources; }
+ const SourceList &get_sources() const { return sources; }
protected:
/** Returns a list of all source files for the component. */
- PathList collect_source_files() const;
+ SourceList collect_source_files() const;
public:
bool get_install() const { return install; }
const InstallMap &get_install_map() const { return install_map; }
- const PackageList &get_required_packages() const { return requires; }
+ const Package::Requirements &get_required_packages() const { return requires; }
bool is_default() const { return deflt; }
/** Prepares any required packages. */
string::size_type token = i->find_first_of("=!");
if(token==string::npos)
- expression.insert(StringMap::value_type(*i, "="));
+ expression.insert(Expression::value_type(*i, "="));
else if(token==0 && (*i)[0]=='!')
- expression.insert(StringMap::value_type(i->substr(1), "!"));
+ expression.insert(Expression::value_type(i->substr(1), "!"));
else
- expression.insert(StringMap::value_type(i->substr(0, token), i->substr(token)));
+ expression.insert(Expression::value_type(i->substr(0, token), i->substr(token)));
}
}
const Config &conf = pkg.get_config();
bool result = true;
- for(StringMap::iterator i=expression.begin(); i!=expression.end(); ++i)
+ for(Expression::iterator i=expression.begin(); i!=expression.end(); ++i)
{
bool neg = (i->second[0]=='!');
unsigned start = 1;
#include <msp/datafile/loader.h>
#include "buildinfo.h"
-#include "misc.h"
class Config;
class SourcePackage;
void build_info();
};
+ typedef std::list<std::string> RequireList;
+
private:
+ typedef std::map<std::string, std::string> Expression;
+
SourcePackage &pkg;
- StringMap expression;
- StringList requires;
+ Expression expression;
+ RequireList requires;
BuildInfo build_info;
public:
Condition(SourcePackage &, const std::string &);
- const StringList &get_requires() const { return requires; }
+ const RequireList &get_requires() const { return requires; }
const BuildInfo &get_build_info() const { return build_info; }
bool eval();
};
-typedef std::list<Condition> ConditionList;
#endif
#include <msp/datafile/loader.h>
#include <msp/fs/path.h>
#include <msp/time/timestamp.h>
-#include "misc.h"
class SourcePackage;
BuildInfo::PathList local_incpath = incpath;
local_incpath.push_front(FS::dirname(path).str());
- for(list<string>::iterator i=includes.begin(); i!=includes.end(); ++i)
+ for(IncludeList::iterator i=includes.begin(); i!=includes.end(); ++i)
{
Target *hdr = builder.get_vfs().find_header(i->substr(1), ((*i)[0]=='"' ? local_incpath : incpath));
if(hdr)
#ifndef CSOURCEFILE_H_
#define CSOURCEFILE_H_
-#include "misc.h"
#include "sourcefile.h"
/**
*/
class CSourceFile: public SourceFile
{
+public:
+ typedef std::list<std::string> IncludeList;
+
private:
- StringList includes;
+ IncludeList includes;
public:
CSourceFile(Builder &, const Msp::FS::Path &);
CSourceFile(Builder &, const Component &, const Msp::FS::Path &);
virtual const char *get_type() const { return "CSourceFile"; }
- const StringList &get_includes() const { return includes; }
+ const IncludeList &get_includes() const { return includes; }
private:
virtual void find_dependencies();
};
Feature(const std::string &n): name(n) { }
};
-typedef std::list<Feature> FeatureList;
-
#endif
+++ /dev/null
-#ifndef MISC_H_
-#define MISC_H_
-
-#include <list>
-#include <map>
-#include <string>
-#include <msp/fs/path.h>
-
-typedef std::list<std::string> StringList;
-typedef std::list<Msp::FS::Path> PathList;
-typedef std::map<std::string, std::string> StringMap;
-
-#endif
#include <msp/strings/lexicalcast.h>
#include <msp/strings/utils.h>
#include "builder.h"
-#include "misc.h"
#include "package.h"
using namespace std;
if(prepared)
return;
- for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
+ for(Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i)
(*i)->prepare();
do_prepare();
class Builder;
class Package;
-typedef std::list<Package *> PackageList;
-
/**
A package is a distributable piece of software. Package information may be
obtained in several ways: Build files of source packages, pkg-config for binary
void require(const std::string &);
};
+ typedef std::list<Package *> Requirements;
+
protected:
Builder &builder;
std::string name;
- PackageList requires;
+ Requirements requires;
BuildInfo export_binfo;
bool prepared;
const std::string &get_name() const { return name; }
Builder &get_builder() const { return builder; }
- const PackageList &get_required_packages() const { return requires; }
+ const Requirements &get_required_packages() const { return requires; }
const BuildInfo &get_exported_build_info() const { return export_binfo; }
IO::print(out, "Version: %s\n", spkg.get_version());
IO::print(out, "Requires:");
- const PackageList &reqs = spkg.get_required_packages();
- for(PackageList::const_iterator i=reqs.begin(); i!=reqs.end(); ++i)
+ const Package::Requirements &reqs = spkg.get_required_packages();
+ for(Package::Requirements::const_iterator i=reqs.begin(); i!=reqs.end(); ++i)
if((*i)->get_use_pkgconfig())
IO::print(out, " %s", (*i)->get_name());
out.put('\n');
#include <list>
#include <string>
-class Package;
-
struct Problem
{
std::string package;
Problem(const std::string &p, const std::string &d): package(p), descr(d) { }
};
-typedef std::list<Problem> ProblemList;
-
#endif
#include "binarypackage.h"
#include "builder.h"
#include "file.h"
-#include "misc.h"
#include "pkgconfigfile.h"
#include "tool.h"
#include "sourcepackage.h"
{
for(ComponentList::iterator j=obj.components.begin(); j!=obj.components.end(); ++j)
{
- const StringList &sources = j->get_sources();
- for(StringList::const_iterator k=sources.begin(); k!=sources.end(); ++k)
+ const Component::SourceList &sources = j->get_sources();
+ for(Component::SourceList::const_iterator k=sources.begin(); k!=sources.end(); ++k)
{
- if(!i->first.compare(0, k->size(), *k))
+ string k_str = k->str();
+ if(!i->first.compare(0, k_str.size(), k_str))
{
const_cast<InstallMap &>(j->get_install_map()).add_mapping(obj.source_dir/i->first, i->second);
}
IO::print("%s: Note: headers components are deprecated\n", get_source());
Component comp(obj, Component::LIBRARY, n);
load_sub(comp);
- const StringList &sources = comp.get_sources();
- for(StringList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
- install_map[*i] = "include/"+comp.get_name();
+ const Component::SourceList &sources = comp.get_sources();
+ for(Component::SourceList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ install_map[i->str()] = "include/"+comp.get_name();
}
void SourcePackage::Loader::if_feature(const string &cond)
IO::print("%s: Note: tar_file is deprecated\n", get_source());
for(ComponentList::iterator i=obj.components.begin(); i!=obj.components.end(); ++i)
if(i->get_type()==Component::TARBALL && i->get_name()=="@src")
- const_cast<StringList &>(i->get_sources()).push_back((obj.source_dir/f).str());
+ const_cast<Component::SourceList &>(i->get_sources()).push_back((obj.source_dir/f).str());
}
typedef std::list<Component> ComponentList;
private:
+ typedef std::list<Feature> FeatureList;
+
std::string version;
std::string description;
#include "builder.h"
#include "csourcefile.h"
#include "executable.h"
-#include "misc.h"
#include "sharedlibrary.h"
#include "staticlibrary.h"
#include "tool.h"