]> git.tdb.fi Git - builder.git/blob - source/package.h
Revamp problem reporting system to be more useful
[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
16 class Builder;
17 class Package;
18
19 typedef std::list<Package *> PackageList;
20
21 /**
22 A package is a distributable piece of software.  Package information may be
23 obtained in several ways: Build files of source packages, pkg-config for binary
24 packages and the builderrc file for binary packages with no pkg-config support.
25 */
26 class Package
27 {
28 public:
29         class Loader: public Msp::DataFile::Loader
30         {
31         public:
32                 Loader(Package &);
33                 Package &get_object() { return pkg; }
34         protected:
35                 Package &pkg;
36
37                 void require(const std::string &);
38         };
39
40         const std::string   &get_name() const           { return name; }
41         Builder             &get_builder() const        { return builder; }
42         const PackageList   &get_requires() const       { return requires; }
43         PackageList         collect_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         void                configure(const StringMap &, unsigned);
50         virtual ~Package() { }
51 protected:
52         Builder       &builder;
53
54         std::string   name;
55
56         PackageList   requires;
57         BuildInfo     export_binfo;
58         bool          conf_done;
59
60         bool          use_pkgconfig;
61
62         Package(Builder &, const std::string &);
63         virtual void do_configure(const StringMap &, unsigned) { }
64         virtual void create_build_info() { }
65 };
66
67 #endif