1 #ifndef SOURCEPACKAGE_H_
2 #define SOURCEPACKAGE_H_
18 class bad_expansion: public std::runtime_error
21 bad_expansion(const std::string &w): std::runtime_error(w) { }
22 virtual ~bad_expansion() throw() { }
26 A package that can be built by Builder.
28 class SourcePackage: public Package
31 class Loader: public Msp::DataFile::DerivedObjectLoader<SourcePackage, Package::Loader>
34 const Config::InputOptions *options;
35 std::map<std::string, std::string> install_map;
38 Loader(SourcePackage &);
39 Loader(SourcePackage &, const Config::InputOptions &);
41 void init(const Config::InputOptions *);
42 virtual void finish();
43 void feature(const std::string &, const std::string &);
44 template<Component::Type>
45 void component(const std::string &);
46 void condition(const std::string &);
48 void headers(const std::string &);
49 void if_feature(const std::string &);
50 void source_tarball();
51 void tarball(const std::string &);
52 void tar_file(const std::string &);
55 typedef std::list<Component> ComponentList;
58 typedef std::list<Feature> FeatureList;
61 std::string description;
63 FileTarget *build_file;
64 Msp::FS::Path source_dir;
65 const BuildType *build_type;
68 ComponentList components;
69 Component *source_tarball;
74 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
76 const std::string &get_version() const { return version; }
77 const std::string &get_description() const { return description; }
78 FileTarget &get_build_file() const { return *build_file; }
79 const Msp::FS::Path &get_source_directory() const { return source_dir; }
80 Msp::FS::Path get_temp_dir() const;
81 Msp::FS::Path get_out_dir() const;
82 const ComponentList &get_components() const { return components; }
83 const Config &get_config() const { return config; }
84 void set_build_type(const BuildType &);
85 const BuildInfo &get_build_info() const { return build_info; }
86 Builder &get_builder() const { return builder; }
88 Cache &get_cache() const { return cache; }
90 virtual void do_prepare();
92 virtual void save_caches();