blob: 07a73b3daef0e0f1835a0c06528afb95f45d689c [file] [log] [blame]
Minos Galanakis2c824b42025-03-20 09:28:45 +00001#!/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
19set -e -u
20
21if [ $# -le 0 ]
22then
23 echo " [!] No package names specified" >&2
24 echo "Usage: $0 <package name 1> <package name 2> ..." >&2
25 exit 1
26fi
27
28for 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"
38done
39
40exit 0