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
40 std::map<std::string, std::string> install_map;
44 SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
46 virtual void finish();
47 void feature(const std::string &, const std::string &);
48 template<Component::Type>
49 void component(const std::string &);
50 void condition(const std::string &);
52 void headers(const std::string &);
53 void tarball(const std::string &);
54 void tar_file(const std::string &);
59 std::string description;
64 ConditionList conditions;
65 ComponentList components;
67 mutable DependencyCache deps_cache;
70 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
71 const std::string &get_name() const { return name; }
72 const std::string &get_version() const { return version; }
73 const std::string &get_description() const { return description; }
74 const Msp::FS::Path &get_source() const { return source; }
75 Msp::FS::Path get_temp_dir() const;
76 Msp::FS::Path get_out_dir() const;
77 const ComponentList &get_components() const { return components; }
78 const Config &get_config() const { return config; }
79 const BuildInfo &get_build_info() const { return build_info; }
80 const BuildInfo &get_exported_binfo() const { return export_binfo; }
81 Builder &get_builder() const { return builder; }
83 /** Returns a bitmask indicating which kinds of things the components of
84 this package install. */
85 unsigned get_install_flags();
87 LibMode get_library_mode() const;
88 DependencyCache &get_deps_cache() const { return deps_cache; }
89 std::string expand_string(const std::string &) const;
91 virtual void do_configure(const StringMap &, unsigned);
93 /** Initializes configuration options. */
96 /** Fills in build info based on configuration. All required packages must be
97 configured when this is called. */
98 virtual void create_build_info();
100 virtual void create_targets();