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 Package::Loader
41 SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
43 virtual void finish();
44 void feature(const std::string &, const std::string &);
45 template<Component::Type>
46 void component(const std::string &);
47 void condition(const std::string &);
49 void tarball(const std::string &);
50 void tar_file(const std::string &);
55 std::string description;
60 ConditionList conditions;
61 ComponentList components;
63 mutable DependencyCache deps_cache;
66 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
67 const std::string &get_name() const { return name; }
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 const BuildInfo &get_build_info() const { return build_info; }
76 const BuildInfo &get_exported_binfo() const { return export_binfo; }
77 Builder &get_builder() const { return builder; }
79 /** Returns a bitmask indicating which kinds of things the components of
80 this package install. */
81 unsigned get_install_flags();
83 LibMode get_library_mode() const;
84 DependencyCache &get_deps_cache() const { return deps_cache; }
85 std::string expand_string(const std::string &) const;
87 virtual void do_configure(const StringMap &, unsigned);
89 /** Initializes configuration options. */
92 /** Fills in build info based on configuration. All required packages must be
93 configured when this is called. */
94 virtual void create_build_info();