build script: define pkg-config extra libraries as string

this allows to specify frameworks in addition to libraries
This commit is contained in:
alexey.lysiuk 2020-12-08 10:22:05 +02:00
parent 2aba13ca81
commit d08c067888

View file

@ -131,7 +131,7 @@ class Target(BaseTarget):
self.update_pc_files(builder) self.update_pc_files(builder)
@staticmethod @staticmethod
def update_pc_file(path: str, extra_libs=None): def update_pc_file(path: str, extra_libs: str = None):
with open(path, 'r') as f: with open(path, 'r') as f:
content = f.readlines() content = f.readlines()
@ -146,10 +146,8 @@ class Target(BaseTarget):
patched_line = prefix + os.linesep patched_line = prefix + os.linesep
elif extra_libs and line.startswith('Libs:'): elif extra_libs and line.startswith('Libs:'):
# Append extra libraries to link with # Append extra libraries to link with
patched_line = patched_line.strip('\n') if extra_libs not in line:
for lib in extra_libs: patched_line = line.rstrip('\n') + ' ' + extra_libs + os.linesep
patched_line += f' -l{lib}'
patched_line += os.linesep
patched_content.append(patched_line) patched_content.append(patched_line)
@ -929,9 +927,9 @@ class VorbisTarget(ConfigureMakeStaticDependencyTarget):
def __init__(self, name='vorbis'): def __init__(self, name='vorbis'):
super().__init__(name) super().__init__(name)
self.pkg_libs = { self.pkg_libs = {
'vorbis': ('ogg',), 'vorbis': '-logg',
'vorbisenc': ('vorbis', 'ogg'), 'vorbisenc': '-lvorbis -logg',
'vorbisfile': ('vorbis', 'ogg'), 'vorbisfile': '-lvorbis -logg',
} }
def prepare_source(self, builder: 'Builder'): def prepare_source(self, builder: 'Builder'):