+/* $Id$
+
+This file is part of builder
+Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
#include <fstream>
#include <iostream>
-#include <msp/path/utils.h>
+#include <msp/fs/utils.h>
#include "package.h"
#include "pkgconfig.h"
#include "pkgconfigaction.h"
PkgConfigAction::PkgConfigAction(Builder &b, const PkgConfig &p):
Action(b)
{
- const Package &pkg=*p.get_package();
-
- announce(pkg.get_name(), "PC", relative(p.get_name(), pkg.get_source()).str());
-
+ const SourcePackage &spkg=*static_cast<const SourcePackage *>(p.get_package());
+
+ announce(spkg.get_name(), "PC", relative(p.get_name(), spkg.get_source()).str());
+
ofstream out(p.get_name().c_str());
if(out)
{
// Prefix is already included in the various paths
- //out<<"prefix="<<pkg.get_config().get_option("prefix").value<<"\n\n";
- out<<"source="<<pkg.get_source()<<"\n\n";
-
- out<<"Name: "<<pkg.get_name()<<'\n';
- out<<"Description: "<<pkg.get_description()<<'\n';
- out<<"Version: "<<pkg.get_version()<<'\n';
-
+ //out<<"prefix="<<pkg.get_prefix()<<"\n\n";
+ out<<"source="<<spkg.get_source()<<"\n\n";
+
+ out<<"Name: "<<spkg.get_name()<<'\n';
+ out<<"Description: "<<spkg.get_description()<<'\n';
+ out<<"Version: "<<spkg.get_version()<<'\n';
+
out<<"Requires:";
- const PkgRefList &reqs=pkg.get_requires();
- for(PkgRefList::const_iterator i=reqs.begin(); i!=reqs.end(); ++i)
- if(i->get_package()->get_use_pkgconfig())
- out<<' '<<i->get_name();
+ const PackageList &reqs=spkg.get_requires();
+ for(PackageList::const_iterator i=reqs.begin(); i!=reqs.end(); ++i)
+ if((*i)->get_use_pkgconfig())
+ out<<' '<<(*i)->get_name();
out<<'\n';
- const BuildInfo &binfo=pkg.get_exported_binfo();
+ const BuildInfo &binfo=spkg.get_exported_binfo();
out<<"Libs:";
for(StringList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
out<<" -L"<<*i;