diff options
Diffstat (limited to 'backends.py')
-rw-r--r-- | backends.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/backends.py b/backends.py index 657b339..a6177e8 100644 --- a/backends.py +++ b/backends.py @@ -334,6 +334,29 @@ class Backend(): confdata = cf.get_configuration_data() do_conf_file(infile, outfile, confdata) + def generate_pkgconfig_files(self): + for p in self.build.pkgconfig_gens: + outdir = self.environment.scratch_dir + fname = os.path.join(outdir, p.filebase + '.pc') + ofile = open(fname, 'w') + ofile.write('prefix=%s\n' % self.environment.get_coredata().prefix) + ofile.write('libdir=${prefix}/%s\n' % self.environment.get_coredata().libdir) + ofile.write('includedir=${prefix}/%s\n\n' % self.environment.get_coredata().includedir) + ofile.write('Name: %s\n' % p.name) + if len(p.description) > 0: + ofile.write('Description: %s\n' % p.description) + if len(p.version) > 0: + ofile.write('Version: %s\n' % p.version) + ofile.write('Libs: -L${libdir} ') + for l in p.libraries: + ofile.write('-l%s ' % l.name) + ofile.write('\n') + ofile.write('CFlags: ') + for h in p.headerdirs.keys(): + ofile.write(os.path.join('-I${includedir}', h)) + ofile.write(' ') + ofile.write('\n') + class NinjaBuildElement(): def __init__(self, outfilenames, rule, infilenames): if isinstance(outfilenames, str): @@ -408,6 +431,7 @@ class NinjaBackend(Backend): tempfilename = outfilename + '~' outfile = open(tempfilename, 'w') self.generate_configure_files() + self.generate_pkgconfig_files() outfile.write('# This is the build file for project "%s"\n' % self.build.get_project()) outfile.write('# It is autogenerated by the Meson build system.\n') outfile.write('# Do not edit by hand.\n\n') |