| 1 |
#!/bin/sh |
| 2 |
# autopkgtest check: Build and run a program against libldac, 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 > libldac_test.c |
| 14 |
#include <assert.h> |
| 15 |
#include <ldacBT.h> |
| 16 |
#include <stddef.h> |
| 17 |
|
| 18 |
int main(void) |
| 19 |
{ |
| 20 |
HANDLE_LDAC_BT ldac; |
| 21 |
|
| 22 |
assert(ldacBT_get_handle()); |
| 23 |
|
| 24 |
return 0; |
| 25 |
} |
| 26 |
EOF |
| 27 |
|
| 28 |
# deliberately word-splitting pkg-config output: |
| 29 |
# shellcheck disable=SC2046 |
| 30 |
"${CROSS_COMPILE}gcc" -o libldac_test libldac_test.c \ |
| 31 |
$("${CROSS_COMPILE}pkg-config" --cflags --libs ldacBT-enc) |
| 32 |
echo "build: OK" |
| 33 |
[ -x libldac_test ] |
| 34 |
./libldac_test |
| 35 |
echo "run: OK" |