| 1 | #!/bin/sh |
| 2 | # autopkgtest check: Build and run a program against libfreeaptx, to verify that |
| 3 | # the headers and pkg-config file are installed correctly |
| 4 | |
| 5 | set -e |
| 6 | |
| 7 | if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 8 | CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" |
| 9 | else |
| 10 | CROSS_COMPILE= |
| 11 | fi |
| 12 | |
| 13 | cat <<EOF > libfreeaptx_test.c |
| 14 | #include "freeaptx.h" |
| 15 | |
| 16 | int main(void) |
| 17 | { |
| 18 | struct aptx_context *dec; |
| 19 | dec = aptx_init(0); |
| 20 | return 0; |
| 21 | } |
| 22 | EOF |
| 23 | |
| 24 | # deliberately word-splitting pkg-config output: |
| 25 | # shellcheck disable=SC2046 |
| 26 | "${CROSS_COMPILE}gcc" -o libfreeaptx_test libfreeaptx_test.c \ |
| 27 | $("${CROSS_COMPILE}pkg-config" --cflags --libs libfreeaptx) |
| 28 | echo "build: OK" |
| 29 | [ -x libfreeaptx_test ] |
| 30 | ./libfreeaptx_test |
| 31 | echo "run: OK" |