summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-01-31 14:41:21 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2019-01-31 14:46:21 +0530
commitdb39ddbea74747c9570f7fab754fe1de608c37f3 (patch)
treeefac0fc042c6af4055a0bf67826574714ebf0b99
parent55ea717f03a7ec63e537dd71b096edb32d60fead (diff)
downloadmeson-nirbheek/macos-pkgconfig-fixes.tar.gz
tests: Don't require pkg-config for macOS testsnirbheek/macos-pkgconfig-fixes
Only require it on the CI or if pkg-config is found.
-rw-r--r--test cases/osx/2 library versions/meson.build32
-rw-r--r--test cases/osx/2 library versions/require_pkgconfig.py9
2 files changed, 31 insertions, 10 deletions
diff --git a/test cases/osx/2 library versions/meson.build b/test cases/osx/2 library versions/meson.build
index 26f945a77..0d21a3a78 100644
--- a/test cases/osx/2 library versions/meson.build
+++ b/test cases/osx/2 library versions/meson.build
@@ -1,15 +1,27 @@
project('library versions', 'c')
-zlib_dep = dependency('zlib')
-
-some = shared_library('some', 'lib.c',
- # duplicate the rpath again, in order
- # to test Meson's RPATH deduplication
- build_rpath : zlib_dep.get_pkgconfig_variable('libdir'),
- dependencies : zlib_dep,
- version : '1.2.3',
- soversion : '7',
- install : true)
+if run_command(find_program('require_pkgconfig.py'), check: true).stdout().strip() == 'yes'
+ required = true
+else
+ required = false
+endif
+
+zlib_dep = dependency('zlib', required: required)
+if zlib_dep.found()
+ some = shared_library('some', 'lib.c',
+ # duplicate the rpath again, in order
+ # to test Meson's RPATH deduplication
+ build_rpath : zlib_dep.get_pkgconfig_variable('libdir'),
+ dependencies : zlib_dep,
+ version : '1.2.3',
+ soversion : '7',
+ install : true)
+else
+ some = shared_library('some', 'lib.c',
+ version : '1.2.3',
+ soversion : '7',
+ install : true)
+endif
noversion = shared_library('noversion', 'lib.c',
install : true)
diff --git a/test cases/osx/2 library versions/require_pkgconfig.py b/test cases/osx/2 library versions/require_pkgconfig.py
new file mode 100644
index 000000000..3d228aa63
--- /dev/null
+++ b/test cases/osx/2 library versions/require_pkgconfig.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+
+if 'CI' in os.environ or shutil.which('pkg-config'):
+ print('yes')
+else:
+ print('no')