1 #ifndef SOURCEPACKAGE_H_
2 #define SOURCEPACKAGE_H_
10 #include "dependencycache.h"
16 class bad_expansion: public std::runtime_error
19 bad_expansion(const std::string &w): std::runtime_error(w) { }
20 virtual ~bad_expansion() throw() { }
24 A package that can be built by Builder.
26 class SourcePackage: public Package
37 class Loader: public Msp::DataFile::DerivedObjectLoader<SourcePackage, Package>
40 std::map<std::string, std::string> install_map;
43 Loader(SourcePackage &);
45 virtual void finish();
46 void feature(const std::string &, const std::string &);
47 template<Component::Type>
48 void component(const std::string &);
49 void condition(const std::string &);
51 void headers(const std::string &);
52 void tarball(const std::string &);
53 void tar_file(const std::string &);
58 std::string description;
63 ConditionList conditions;
64 ComponentList components;
66 mutable DependencyCache deps_cache;
69 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
70 const std::string &get_name() const { return name; }
71 const std::string &get_version() const { return version; }
72 const std::string &get_description() const { return description; }
73 const Msp::FS::Path &get_source() const { return source; }
74 Msp::FS::Path get_temp_dir() const;
75 Msp::FS::Path get_out_dir() const;
76 const ComponentList &get_components() const { return components; }
77 const Config &get_config() const { return config; }
78 const BuildInfo &get_build_info() const { return build_info; }
79 const BuildInfo &get_exported_binfo() const { return export_binfo; }
80 Builder &get_builder() const { return builder; }
82 /** Returns a bitmask indicating which kinds of things the components of
83 this package install. */
84 unsigned get_install_flags();
86 LibMode get_library_mode() const;
87 DependencyCache &get_deps_cache() const { return deps_cache; }
88 std::string expand_string(const std::string &) const;
90 virtual void do_configure(const StringMap &, unsigned);
92 /** Initializes configuration options. */
95 /** Fills in build info based on configuration. All required packages must be
96 configured when this is called. */
97 virtual void create_build_info();
99 virtual void create_targets();