Keep separator spaces in pkg-config declarations. Closes #3479.
This commit is contained in:
parent
554266d6f2
commit
2b5766980b
|
@ -139,8 +139,10 @@ class DependenciesHelper:
|
|||
if version_reqs:
|
||||
if name not in self.version_reqs:
|
||||
self.version_reqs[name] = set()
|
||||
# We could have '>=1.0' or '>= 1.0', remove spaces to normalize
|
||||
new_vreqs = [s.replace(' ', '') for s in mesonlib.stringlistify(version_reqs)]
|
||||
# Note that pkg-config is picky about whitespace.
|
||||
# 'foo > 1.2' is ok but 'foo>1.2' is not.
|
||||
# foo, bar' is ok, but 'foo,bar' is not.
|
||||
new_vreqs = [s for s in mesonlib.stringlistify(version_reqs)]
|
||||
self.version_reqs[name].update(new_vreqs)
|
||||
|
||||
def split_version_req(self, s):
|
||||
|
|
|
@ -3102,6 +3102,17 @@ endian = 'little'
|
|||
self.init(os.path.join(testdirbase, 'app'))
|
||||
self.build()
|
||||
|
||||
@unittest.skipIf(shutil.which('pkg-config') is None, 'Pkg-config not found.')
|
||||
def test_pkgconfig_formatting(self):
|
||||
testdir = os.path.join(self.unit_test_dir, '31 pkgconfig format')
|
||||
self.init(testdir)
|
||||
myenv = os.environ.copy()
|
||||
myenv['PKG_CONFIG_PATH'] = self.privatedir
|
||||
ro = subprocess.run(['pkg-config', '--libs', 'libsomething'], stdout=subprocess.PIPE,
|
||||
env=myenv)
|
||||
self.assertEqual(ro.returncode, 0)
|
||||
self.assertIn(b'-lgobject-2.0', ro.stdout)
|
||||
self.assertIn(b'-lgio-2.0', ro.stdout)
|
||||
|
||||
class LinuxArmCrossCompileTests(BasePlatformTests):
|
||||
'''
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
project('pkgformat', 'c',
|
||||
version : '1.0')
|
||||
|
||||
gio = dependency('gio-2.0', required: false)
|
||||
if not gio.found()
|
||||
error('MESON_SKIP_TEST glib not found.')
|
||||
endif
|
||||
|
||||
pkgg = import('pkgconfig')
|
||||
|
||||
l = shared_library('something', 'somelib.c')
|
||||
|
||||
pkgg.generate(libraries: l,
|
||||
version: '1.0',
|
||||
name: 'libsomething',
|
||||
description: 'A library that does something',
|
||||
requires: 'gobject-2.0 >= 2.54, gio-2.0 >= 2.54')
|
|
@ -0,0 +1,5 @@
|
|||
#include<stdio.h>
|
||||
|
||||
int some_func() {
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue