X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpackage.cpp;h=14ae5f7878ac99781a701eb9fee6ce82052df204;hb=74266a6e650f019063cdcd1c9a7bd26d8f99041b;hp=14d2321e26964229a04d68cc72716b791bc15978;hpb=1a46151c99a406123c4ddfc797a7841baf3e4cc2;p=builder.git diff --git a/source/package.cpp b/source/package.cpp index 14d2321..14ae5f7 100644 --- a/source/package.cpp +++ b/source/package.cpp @@ -9,6 +9,9 @@ using namespace Msp; #include +/** +Creates a buildable package. +*/ Package::Package(Builder &b, const string &n, const Path::Path &s): builder(b), name(n), @@ -17,11 +20,18 @@ Package::Package(Builder &b, const string &n, const Path::Path &s): build_info_ready(false) { } +/** +Sets the path where the package files were installed. This is only useful for +non-buildable packages that don't use pkg-config. +*/ void Package::set_path(const Msp::Path::Path &p) { path=builder.get_cwd()/p; } +/** +Tries to resolve all references to dependency packages. +*/ void Package::resolve_refs() { for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i) @@ -30,6 +40,9 @@ void Package::resolve_refs() i->resolve_refs(); } +/** +Fills in build info based on configuration. +*/ void Package::create_build_info() { if(build_info_ready) @@ -101,12 +114,21 @@ void Package::create_build_info() build_info_ready=true; } +/** +Processes configuration options that were most likely obtained from the command +line. +*/ void Package::process_options(const RawOptionMap &opts) { if(config.process(opts)) config.save(source/".options.cache"); } +/** +Creates a non-buildable package with the given name. Pkg-config is tried first +to get build information. If it fails, a built-in list of known packages is +consulted. +*/ Package *Package::create(Builder &b, const string &name) { list argv; @@ -120,6 +142,7 @@ Package *Package::create(Builder &b, const string &name) bool need_path=false; if(info.empty()) { + //XXX Put these in an external file if(name=="opengl") info.push_back("-lGL"); else if(name=="pthread") @@ -158,6 +181,9 @@ Package::Package(Builder &b, const string &n, const vector &info): } } +/** +Initializes a buildable package. Mostly adds configuration options. +*/ void Package::init_buildable() { buildable=true; @@ -187,6 +213,11 @@ void Package::init_buildable() config.load(source/".options.cache"); } +/** +Checks which kinds of things the components of this package install. + +@return A bitmask of installed things +*/ unsigned Package::get_install_flags() { unsigned flags=0;