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_
13 #include "buildinfo.h"
14 #include "component.h"
15 #include "condition.h"
17 #include "dependencycache.h"
23 class bad_expansion: public std::runtime_error
26 bad_expansion(const std::string &w): std::runtime_error(w) { }
27 virtual ~bad_expansion() throw() { }
31 A package that can be built by Builder.
33 class SourcePackage: public Package
44 class Loader: public Package::Loader
48 SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
50 virtual void finish();
51 void feature(const std::string &, const std::string &);
52 template<Component::Type>
53 void component(const std::string &);
54 void condition(const std::string &);
56 void tarball(const std::string &);
57 void tar_file(const std::string &);
62 std::string description;
67 ConditionList conditions;
68 ComponentList components;
70 mutable DependencyCache deps_cache;
73 SourcePackage(Builder &, const std::string &, const Msp::FS::Path &);
74 const std::string &get_name() const { return name; }
75 const std::string &get_version() const { return version; }
76 const std::string &get_description() const { return description; }
77 const Msp::FS::Path &get_source() const { return source; }
78 Msp::FS::Path get_temp_dir() const;
79 Msp::FS::Path get_out_dir() const;
80 const ComponentList &get_components() const { return components; }
81 const Config &get_config() const { return config; }
82 const BuildInfo &get_build_info() const { return build_info; }
83 const BuildInfo &get_exported_binfo() const { return export_binfo; }
84 Builder &get_builder() const { return builder; }
86 /** Returns a bitmask indicating which kinds of things the components of
87 this package install. */
88 unsigned get_install_flags();
90 LibMode get_library_mode() const;
91 DependencyCache &get_deps_cache() const { return deps_cache; }
92 std::string expand_string(const std::string &) const;
94 virtual void do_configure(const StringMap &, unsigned);
96 /** Initializes configuration options. */
99 /** Fills in build info based on configuration. All required packages must be
100 configured when this is called. */
101 virtual void create_build_info();