@@ -0,0 +1,2584 @@
+#!/usr/bin/env python%0A# cerbero - a multi-platform build system for Open Source software%0A# Copyright (C) 2012 Andoni Morales Alastruey %3Cylatuya@gmail.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Library General Public%0A# License as published by the Free Software Foundation; either%0A# version 2 of the License, or (at your option) any later version.%0A#%0A# This library is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A# Library General Public License for more details.%0A#%0A# You should have received a copy of the GNU Library General Public%0A# License along with this library; if not, write to the%0A# Free Software Foundation, Inc., 59 Temple Place - Suite 330,%0A# Boston, MA 02111-1307, USA.%0Aimport os%0A%0A%0Aclass PkgConfigWritter(object):%0A%0A%0A    VARIABLES_TPL = '''%5C%0Aprefix=%25(prefix)s%0Aexec_prefix=$%7Bprefix%7D%0Alibdir=$%5Bprefix%7D/%25(rel_libdir)s%0Aincludedir=$%7Bprefix%7D/%25(rel_incldir)s%0Adatarootdir=$%7Bprefix%7D/%25(rel_sharedir)s%0Adatadir=$%7Bdatarootdir%7D%0A'''%0A    BODY_TPL = '''%5C%0A%0AName: %25(name)s%0ADescription: %25(desc)s%0AVersion: %25(version)s%0ARequires: %25(req)s%0ARequires.private: %25(req_priv)s%0ALibs: %25(libs)s%0ALibs.private: %25(libs_priv)s%0ACflags: %25(cflags)s%0A'''%0A%0A    rel_libdir = 'lib'%0A    rel_incldir = 'include'%0A    rel_sharedir = 'share'%0A%0A    def __init__(self, name, desc, version, req, libs, cflags, prefix):%0A        self.name = name%0A        self.desc = desc%0A        self.version = version%0A        self.req = req%0A        self.libs = libs%0A        self.cflags = cflags%0A        self.prefix = prefix%0A        self.libs_priv = ''%0A        self.req_priv = ''%0A%0A    def save(self, name, pkgconfigdir):%0A        variables = self._get_variables()%0A        body = self._get_body()%0A        with open(os.path.join(pkgconfigdir, '%25s.pc' %25 name), 'w+') as f:%0A            f.write(variables)%0A            f.write(body)%0A%0A    def _get_variables(self):%0A        return self.VARIABLES_TPL %25 %7B%0A                'prefix': self.prefix,%0A                'rel_libdir': self.rel_libdir,%0A                'rel_incldir': self.rel_incldir,%0A                'rel_sharedir': self.rel_sharedir%7D%0A%0A    def _get_body(self):%0A        return self.BODY_TPL %25 %7B%0A                'name': self.name,%0A                'desc': self.desc,%0A                'version': self.version,%0A                'req': self.req,%0A                'req_priv': self.req_priv,%0A                'libs': self.libs,%0A                'libs_priv': self.libs_priv,%0A                'cflags': self.cflags%7D%0A

add new tool to create pkgconfig files