]> git.tdb.fi Git - builder.git/blob - source/package.h
Split class Package into SourcePackage and BinaryPackage
[builder.git] / source / package.h
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef PACKAGE_H_
9 #define PACKAGE_H_
10
11 #include <list>
12 #include <string>
13 #include <msp/datafile/loader.h>
14 #include "buildinfo.h"
15 #include "packageref.h"
16
17 class Builder;
18 class Package;
19
20 typedef std::list<Package *> PackageList;
21
22 /**
23 A package is a distributable piece of software.  They consist of one or more
24 Components and may depend on other packages.  Packages also have configuration
25 to determine where files are installed and which features to include.
26 */
27 class Package
28 {
29 public:
30         class Loader: public Msp::DataFile::Loader
31         {
32         public:
33                 Loader(Package &);
34                 Package &get_object() { return pkg; }
35         protected:
36                 Package &pkg;
37
38                 void require(const std::string &);
39         };
40
41         const std::string   &get_name() const           { return name; }
42         Builder             &get_builder() const        { return builder; }
43         const PkgRefList    &get_requires() const       { return requires; }
44         const BuildInfo     &get_exported_binfo() const { return export_binfo; }
45
46         /// Indicates whether or not this package supports pkg-config
47         bool get_use_pkgconfig() const { return use_pkgconfig; }
48
49         virtual void        resolve_refs();
50         void                configure(const StringMap &, unsigned);
51         virtual ~Package() { }
52 protected:
53         Builder       &builder;
54
55         std::string   name;
56
57         PkgRefList    requires;
58         BuildInfo     export_binfo;
59         bool          conf_done;
60
61         bool          use_pkgconfig;
62
63         Package(Builder &, const std::string &);
64         virtual void do_configure(const StringMap &, unsigned) { }
65         virtual void create_build_info() { }
66 };
67
68 #endif