Bill Roberts | 3cc48e4 | 2024-03-25 08:52:47 -0500 | [diff] [blame] | 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 | # These are the EXPECTED package names. Renaming these could break |
| 22 | # consumers of pkg-config, consider carefully. |
| 23 | all_pcs="mbedtls mbedx509 mbedcrypto" |
| 24 | |
| 25 | for pc in $all_pcs; do |
| 26 | printf "testing package config file: ${pc} ... " |
| 27 | pkg-config --validate "${pc}" |
| 28 | version="$(pkg-config --modversion "${pc}")" |
| 29 | test -n "$version" |
| 30 | cflags="$(pkg-config --cflags "${pc}")" |
| 31 | test -n "$cflags" |
| 32 | libs="$(pkg-config --libs "${pc}")" |
| 33 | test -n "$libs" |
| 34 | printf "passed\n" |
| 35 | done |
| 36 | |
| 37 | exit 0 |