1 #ifndef SOURCEPACKAGE_H_
2 #define SOURCEPACKAGE_H_
10 #include "dependencycache.h"
17 class bad_expansion: public std::runtime_error
20 bad_expansion(const std::string &w): std::runtime_error(w) { }
21 virtual ~bad_expansion() throw() { }
25 A package that can be built by Builder.
27 class SourcePackage: public Package
30 class Loader: public Msp::DataFile::DerivedObjectLoader<SourcePackage, Package>
33 const Config::InputOptions *options;
34 std::map<std::string, std::string> install_map;
37 Loader(SourcePackage &);
38 Loader(SourcePackage &, const Config::InputOptions &);
40 void init(const Config::InputOptions *);
41 virtual void finish();
42 void feature(const std::string &, const std::string &);
43 template<Component::Type>
44 void component(const std::string &);
45 void condition(const std::string &);
47 void headers(const std::string &);
48 void if_arch(const std::string &);
49 void if_feature(const std::string &);
50 void tarball(const std::string &);
51 void tar_file(const std::string &);
56 std::string description;
59 const BuildType *build_type;
62 ComponentList components;
64 mutable DependencyCache deps_cache;
67 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
68 const std::string &get_version() const { return version; }
69 const std::string &get_description() const { return description; }
70 const Msp::FS::Path &get_source() const { return source; }
71 Msp::FS::Path get_temp_dir() const;
72 Msp::FS::Path get_out_dir() const;
73 const ComponentList &get_components() const { return components; }
74 const Config &get_config() const { return config; }
75 void set_build_type(const BuildType &);
76 const BuildInfo &get_build_info() const { return build_info; }
77 Builder &get_builder() const { return builder; }
79 DependencyCache &get_deps_cache() const { return deps_cache; }
80 std::string expand_string(const std::string &) const;
82 virtual void do_configure(const StringMap &, unsigned);
84 /** Initializes configuration options. */
87 /** Fills in build info based on configuration. All required packages must be
88 configured when this is called. */
89 virtual void create_build_info();
91 virtual void create_targets();
93 virtual void save_caches();