-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include <msp/strings/lexicalcast.h>
-#include <msp/strings/utils.h>
-#include "builder.h"
-#include "misc.h"
-#include "package.h"
-
-using namespace std;
-using namespace Msp;
-
-#include <iostream>
-
-/**
-Creates a buildable package.
-*/
-Package::Package(Builder &b, const string &n):
- builder(b),
- name(n),
- conf_done(false),
- use_pkgconfig(true)
-{ }
-
-/**
-Tries to resolve all references to dependency packages.
-*/
-void Package::resolve_refs()
-{
- for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i)
- i->resolve();
-}
-
-/**
-Processes configuration options that were most likely obtained from the command
-line.
-*/
-void Package::configure(const StringMap &opts, unsigned flag)
-{
- if(conf_done)
- return;
-
- if(builder.get_verbose()>=3)
- cout<<"Configuring "<<name<<'\n';
-
- do_configure(opts, flag);
-
- for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i)
- i->get_package()->configure(opts, flag&2);
-
- create_build_info();
-
- conf_done=true;
-}
-
-/*** private ***/
-
-Package::Loader::Loader(Package &p):
- pkg(p)
-{
- add("require", &Loader::require);
-}
-
-void Package::Loader::require(const string &n)
-{
- pkg.requires.push_back(PackageRef(pkg.builder, n));
-}