]> git.tdb.fi Git - builder.git/blob - source/sourcepackage.h
Adapt to changes in msppath
[builder.git] / source / sourcepackage.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 SOURCEPACKAGE_H_
9 #define SOURCEPACKAGE_H_
10
11 #include <string>
12 #include "buildinfo.h"
13 #include "component.h"
14 #include "condition.h"
15 #include "config.h"
16 #include "dependencycache.h"
17 #include "feature.h"
18 #include "package.h"
19
20 class Builder;
21
22 /**
23 A package that can be built by Builder.
24 */
25 class SourcePackage: public Package
26 {
27 public:
28         enum InstallFlags
29         {
30                 INCLUDE=1,
31                 BIN=2,
32                 LIB=4,
33                 DATA=8
34         };
35
36         /// Loads a package from a file.
37         class Loader: public Package::Loader
38         {
39         public:
40                 Loader(Package &);
41                 SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
42         private:
43                 void feature(const std::string &, const std::string &);
44                 void condition(const std::string &);
45                 void program(const std::string &);
46                 void library(const std::string &);
47                 void module(const std::string &);
48                 void headers(const std::string &);
49                 void build_info();
50                 void tar_file(const std::string &);
51         };
52
53         SourcePackage(Builder &, const std::string &, const Msp::Path &);
54         void                set_path(const Msp::Path &);
55         const std::string   &get_name() const           { return name; }
56         const std::string   &get_version() const        { return version; }
57         const std::string   &get_description() const    { return description; }
58         const Msp::Path &get_source() const       { return source; }
59         Msp::Path     get_temp_dir() const;
60         Msp::Path     get_out_dir() const;
61         Msp::Path     get_prefix() const          { return config.get_option("prefix").value; }
62         const ComponentList &get_components() const     { return components; }
63         const Config        &get_config() const         { return config; }
64         const BuildInfo     &get_build_info() const     { return build_info; }
65         const BuildInfo     &get_exported_binfo() const { return export_binfo; }
66         Builder             &get_builder() const        { return builder; }
67         unsigned            get_install_flags();
68         const std::string   &get_arch() const           { return config.get_option("arch").value; }
69         LibMode             get_library_mode() const;
70         const PathList      &get_tar_files() const      { return tar_files; }
71         DependencyCache     &get_deps_cache() const     { return deps_cache; }
72 private:
73         std::string   version;
74         std::string   description;
75
76         Msp::Path source;
77         PackageList   base_reqs;
78         FeatureList   features;
79         BuildInfo     build_info;
80         ConditionList conditions;
81         ComponentList components;
82         Config        config;
83         bool          conf_done;
84         mutable DependencyCache deps_cache;
85         PathList      tar_files;
86
87         //Package(Builder &, const std::string &, const std::vector<std::string> &);
88         virtual void do_configure(const StringMap &, unsigned);
89         void         init_config();
90         virtual void create_build_info();
91 };
92
93 #endif