Can create pkg-config files.
This commit is contained in:
parent
0384ca71f7
commit
5d08d94561
24
backends.py
24
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')
|
||||
|
|
|
@ -756,9 +756,9 @@ class Interpreter():
|
|||
name = kwargs.get('name', None)
|
||||
if not isinstance(name, str):
|
||||
raise InterpreterException('Name not specified.')
|
||||
filebase = kwargs.get('filebase', None)
|
||||
filebase = kwargs.get('filebase', name)
|
||||
if not isinstance(filebase, str):
|
||||
raise InterpreterException('Filebase not specified.')
|
||||
raise InterpreterException('Filebase must be a string.')
|
||||
description = kwargs.get('description', None)
|
||||
if not isinstance(description, str):
|
||||
raise InterpreterException('Description is not a string.')
|
||||
|
|
|
@ -5,4 +5,4 @@ libver = '1.0'
|
|||
h = headers('simple.h')
|
||||
|
||||
pkgconfig_gen(libraries : lib, headers : h, version : libver,
|
||||
name : 'libsimple', filebase : 'simple', description : 'This is a simple library.')
|
||||
name : 'libsimple', filebase : 'simple', description : 'A simple demo library.')
|
||||
|
|
Loading…
Reference in New Issue