6 #include <msp/parser/loader.h>
12 #include "packageref.h"
17 typedef std::list<Package *> PackageList;
20 A package is a distributable piece of software. They consist of one or more
21 Components and may depend on other packages. Packages also have configuration
22 to determine where files are installed and which features to include (features
36 /// Loads a package from a file.
37 class Loader: public Msp::Parser::Loader
41 Package &get_object() { return pkg; }
45 void require(const std::string &);
46 void feature(const std::string &, const std::string &);
47 void condition(const std::string &);
48 void program(const std::string &);
49 void library(const std::string &);
50 void module(const std::string &);
51 void headers(const std::string &);
55 Package(Builder &, const std::string &, const Msp::Path::Path &);
56 void set_path(const Msp::Path::Path &);
57 const std::string &get_name() const { return name; }
58 const std::string &get_version() const { return version; }
59 const std::string &get_description() const { return description; }
60 const Msp::Path::Path &get_source() const { return source; }
61 Msp::Path::Path get_temp_dir() const;
62 Msp::Path::Path get_out_dir() const;
63 Msp::Path::Path get_prefix() const { return config.get_option("prefix").value; }
64 const ComponentList &get_components() const { return components; }
65 bool get_buildable() const { return buildable; }
66 const Config &get_config() const { return config; }
67 const PkgRefList &get_requires() const { return requires; }
68 const BuildInfo &get_build_info() const { return build_info; }
69 const BuildInfo &get_exported_binfo() const { return export_binfo; }
70 Builder &get_builder() const { return builder; }
71 bool get_need_path() const { return need_path; }
72 unsigned get_install_flags();
73 bool get_use_pkgconfig() const { return use_pkgconfig; }
74 const std::string &get_arch() const { return config.get_option("arch").value; }
75 LibMode get_library_mode() const;
77 void configure(const StringMap &, unsigned);
79 static Package *create(Builder &, const std::string &);
85 std::string description;
88 Msp::Path::Path source;
93 BuildInfo export_binfo;
94 ConditionList conditions;
95 ComponentList components;
101 Msp::Path::Path path;
103 Package(Builder &, const std::string &, const std::vector<std::string> &);
105 void create_build_info();