3 This file is part of builder
4 Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef SOURCEPACKAGE_H_
9 #define SOURCEPACKAGE_H_
12 #include "buildinfo.h"
13 #include "component.h"
14 #include "condition.h"
16 #include "dependencycache.h"
23 A package that can be built by Builder.
25 class SourcePackage: public Package
36 class Loader: public Package::Loader
40 SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
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 tarball(const std::string &);
49 void tar_file(const std::string &);
54 std::string description;
59 ConditionList conditions;
60 ComponentList components;
62 mutable DependencyCache deps_cache;
65 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
66 const std::string &get_name() const { return name; }
67 const std::string &get_version() const { return version; }
68 const std::string &get_description() const { return description; }
69 const Msp::FS::Path &get_source() const { return source; }
70 Msp::FS::Path get_temp_dir() const;
71 Msp::FS::Path get_out_dir() const;
72 const ComponentList &get_components() const { return components; }
73 const Config &get_config() const { return config; }
74 const BuildInfo &get_build_info() const { return build_info; }
75 const BuildInfo &get_exported_binfo() const { return export_binfo; }
76 Builder &get_builder() const { return builder; }
78 /** Returns a bitmask indicating which kinds of things the components of
79 this package install. */
80 unsigned get_install_flags();
82 LibMode get_library_mode() const;
83 DependencyCache &get_deps_cache() const { return deps_cache; }
84 std::string expand_string(const std::string &) const;
86 virtual void do_configure(const StringMap &, unsigned);
88 /** Initializes configuration options. */
91 /** Fills in build info based on configuration. All required packages must be
92 configured when this is called. */
93 virtual void create_build_info();