]> git.tdb.fi Git - builder.git/blob - source/package.h
Implement help
[builder.git] / source / package.h
1 #ifndef PACKAGE_H_
2 #define PACKAGE_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/parser/loader.h>
7 #include "buildinfo.h"
8 #include "component.h"
9 #include "config.h"
10 #include "packageref.h"
11
12 class Builder;
13
14 class Package
15 {
16 public:
17         class Loader: public Msp::Parser::Loader
18         {
19         public:
20                 Loader(Package &);
21                 Package &get_object() { return pkg; }
22                 ~Loader();
23         private:
24                 Package &pkg;
25                 
26                 void require(const std::string &);
27                 void program(const std::string &);
28                 void library(const std::string &);
29                 void headers(const std::string &);
30                 void build_info();
31         };
32
33         Package(Builder &, const std::string &, const Msp::Path::Path &);
34         Package(Builder &, const std::string &, const std::vector<std::string> &);
35         void                set_path(const Msp::Path::Path &);
36         const std::string   &get_name() const       { return name; }
37         const Msp::Path::Path &get_source() const   { return source; }
38         const ComponentList &get_components() const { return components; }
39         bool                get_buildable() const   { return buildable; }
40         const Config        &get_config() const     { return config; }
41         const std::list<PackageRef> &get_requires() const { return requires; }
42         const BuildInfo     &get_build_info() const { return build_info; }
43         const BuildInfo     &get_exported_binfo() const { return export_binfo; }
44         Builder             &get_builder() const    { return builder; }
45         bool                get_need_path() const   { return need_path; }
46         void                resolve_refs();
47         void                create_build_info();
48         void                process_options(const RawOptionMap &);
49
50         static Package *create(Builder &, const std::string &);
51 private:
52         enum InstallFlags
53         {
54                 INCLUDE=1,
55                 BIN=2,
56                 LIB=4,
57                 DATA=8
58         };
59         
60         Builder       &builder;
61         std::string   name;
62         std::string   version;
63         std::string   description;
64         std::list<PackageRef> requires;
65         BuildInfo     build_info;
66         BuildInfo     export_binfo;
67         Msp::Path::Path source;
68         bool          buildable;
69         ComponentList components;
70         Config        config;
71         bool          build_info_ready;
72         bool          need_path;
73         Msp::Path::Path path;
74
75         void init_buildable();
76         unsigned get_install_flags();
77 };
78
79 #endif