pkgconfig.sh (991B)
1 #!/bin/sh 2 # 3 # Copyright The Mbed TLS Contributors 4 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 5 # 6 # Purpose 7 # 8 # Test pkgconfig files. 9 # 10 # For each of the build pkg-config files, .pc files, check that 11 # they validate and do some basic sanity testing on the output, 12 # i.e. that the strings are non-empty. 13 # 14 # NOTE: This requires the built pc files to be on the pkg-config 15 # search path, this can be controlled with env variable 16 # PKG_CONFIG_PATH. See man(1) pkg-config for details. 17 # 18 19 set -e -u 20 21 if [ $# -le 0 ] 22 then 23 echo " [!] No package names specified" >&2 24 echo "Usage: $0 <package name 1> <package name 2> ..." >&2 25 exit 1 26 fi 27 28 for pc in "$@"; do 29 printf "testing package config file: ${pc} ... " 30 pkg-config --validate "${pc}" 31 version="$(pkg-config --modversion "${pc}")" 32 test -n "$version" 33 cflags="$(pkg-config --cflags "${pc}")" 34 test -n "$cflags" 35 libs="$(pkg-config --libs "${pc}")" 36 test -n "$libs" 37 printf "passed\n" 38 done 39 40 exit 0