6 #include <msp/parser/loader.h>
10 #include "packageref.h"
15 typedef std::list<Package *> PackageList;
18 A package is a distributable piece of software. They consist of one or more
19 Components and may depend on other packages. Packages also have configuration
20 to determine where files are installed and which features to include (features
34 /// Loads a package from a file.
35 class Loader: public Msp::Parser::Loader
39 Package &get_object() { return pkg; }
43 void require(const std::string &);
44 void program(const std::string &);
45 void library(const std::string &);
46 void headers(const std::string &);
50 Package(Builder &, const std::string &, const Msp::Path::Path &);
51 void set_path(const Msp::Path::Path &);
52 const std::string &get_name() const { return name; }
53 const std::string &get_version() const { return version; }
54 const std::string &get_description() const { return description; }
55 const Msp::Path::Path &get_source() const { return source; }
56 Msp::Path::Path get_temp_dir() const;
57 Msp::Path::Path get_out_dir() const;
58 Msp::Path::Path get_prefix() const { return config.get_option("prefix").value; }
59 const ComponentList &get_components() const { return components; }
60 bool get_buildable() const { return buildable; }
61 const Config &get_config() const { return config; }
62 const PkgRefList &get_requires() const { return requires; }
63 const BuildInfo &get_build_info() const { return build_info; }
64 const BuildInfo &get_exported_binfo() const { return export_binfo; }
65 Builder &get_builder() const { return builder; }
66 bool get_need_path() const { return need_path; }
67 unsigned get_install_flags();
68 bool get_use_pkgconfig() const { return use_pkgconfig; }
69 const std::string &get_arch() const { return config.get_option("arch").value; }
70 LibMode get_library_mode() const;
72 void configure(const RawOptionMap &, unsigned);
74 static Package *create(Builder &, const std::string &);
80 std::string description;
83 Msp::Path::Path source;
87 BuildInfo export_binfo;
88 ComponentList components;
96 Package(Builder &, const std::string &, const std::vector<std::string> &);
98 void create_build_info();