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 std::map<std::string, std::string> install_map;
36 Loader(SourcePackage &);
38 virtual void finish();
39 void feature(const std::string &, const std::string &);
40 template<Component::Type>
41 void component(const std::string &);
42 void condition(const std::string &);
44 void headers(const std::string &);
45 void tarball(const std::string &);
46 void tar_file(const std::string &);
51 std::string description;
54 const BuildType *build_type;
57 ConditionList conditions;
58 ComponentList components;
60 mutable DependencyCache deps_cache;
63 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
64 const std::string &get_version() const { return version; }
65 const std::string &get_description() const { return description; }
66 const Msp::FS::Path &get_source() const { return source; }
67 Msp::FS::Path get_temp_dir() const;
68 Msp::FS::Path get_out_dir() const;
69 const ComponentList &get_components() const { return components; }
70 const Config &get_config() const { return config; }
71 void set_build_type(const BuildType &);
72 const BuildInfo &get_build_info() const { return build_info; }
73 Builder &get_builder() const { return builder; }
75 DependencyCache &get_deps_cache() const { return deps_cache; }
76 std::string expand_string(const std::string &) const;
78 virtual void do_configure(const StringMap &, unsigned);
80 /** Initializes configuration options. */
83 /** Fills in build info based on configuration. All required packages must be
84 configured when this is called. */
85 virtual void create_build_info();
87 virtual void create_targets();
89 virtual void save_caches();