Debian Codegraph @

debian/tests/build

raw
1 #!/bin/sh
2 # autopkgtest check: Builds a small application against libcairo2-dev, checking
3 # if it compiles, links and runs successfully.
4 # Author: Rafał Cieślak <[email protected]>
5
6 set -e
7 set -u
8
9 WORKDIR=$(mktemp -d)
10 cleanup () {
11 rm -fr "$WORKDIR"
12 }
13 trap cleanup 0 INT QUIT ABRT PIPE TERM
14 cd "$WORKDIR"
15
16 if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
17 CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
18 else
19 CROSS_COMPILE=
20 fi
21
22 cat <<EOF > build_test.c
23
24 #include <pango/pango.h>
25 int main (int argc, char *argv[])
26 {
27 PangoFontDescription* pfd = pango_font_description_new();
28 if(!pfd) return 1;
29 pango_font_description_set_size(pfd,12);
30 return 0;
31 }
32 EOF
33
34 # Deliberately word-splitting, that's how pkg-config works:
35 # shellcheck disable=SC2046
36 "${CROSS_COMPILE}gcc" -o build_test build_test.c $("${CROSS_COMPILE}pkg-config" --cflags --libs pango)
37 echo "build: OK"
38 [ -x build_test ]
39 ./build_test
40 echo "run: OK"