6 #include <msp/datafile/objectloader.h>
8 #include "conditionalloader.h"
15 A package is a distributable piece of software. Package information may be
16 obtained in several ways: Build files of source packages, pkg-config for binary
17 packages and the builderrc file for binary packages with no pkg-config support.
22 class Loader: public Msp::DataFile::ObjectLoader<Package>, public ArchitectureConditional
27 void require(const std::string &);
30 using Requirements = std::vector<Package *>;
38 Requirements requires;
39 BuildInfo export_binfo;
40 bool prepared = false;
42 std::vector<std::string> problems;
44 bool use_pkgconfig = true;
46 Package(Builder &, const std::string &);
48 virtual ~Package() { }
50 Builder &get_builder() const { return builder; }
51 const std::string &get_name() const { return name; }
52 const std::string &get_label() const { return label; }
53 const Requirements &get_required_packages() const { return requires; }
55 const BuildInfo &get_exported_build_info() const { return export_binfo; }
57 /// Indicates whether or not this package supports pkg-config
58 bool uses_pkgconfig() const { return use_pkgconfig; }
60 /** Prepares the package for building. Recursively prepares all required
61 packages, populates build info and creates targets. */
65 virtual void do_prepare() { }
68 bool is_prepared() const { return prepared; }
70 bool is_broken() const { return broken; }
71 const std::vector<std::string> &get_problems() const { return problems; }
73 virtual void save_caches() { }