| 1 |
#!/bin/sh |
| 2 |
# autopkgtest check: Builds a small application against libgdk-pixbuf2.0 |
| 3 |
# (deprecated Xlib part), checking it compiles, links and runs successfully. |
| 4 |
# Authors: Rafał Cieślak, Simon McVittie |
| 5 |
|
| 6 |
set -eu |
| 7 |
|
| 8 |
WORKDIR=$(mktemp -d) |
| 9 |
trap 'rm -rf "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM |
| 10 |
cd "$WORKDIR" |
| 11 |
|
| 12 |
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 13 |
CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" |
| 14 |
else |
| 15 |
CROSS_COMPILE= |
| 16 |
fi |
| 17 |
|
| 18 |
cat <<EOF > build_test.c |
| 19 |
#include <stddef.h> |
| 20 |
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h> |
| 21 |
|
| 22 |
int main (void) |
| 23 |
{ |
| 24 |
Display *dpy = XOpenDisplay (NULL); |
| 25 |
gdk_pixbuf_xlib_init (dpy, 0); |
| 26 |
} |
| 27 |
EOF |
| 28 |
|
| 29 |
# Deliberately word-splitting, that's how pkg-config works: |
| 30 |
# shellcheck disable=SC2046 |
| 31 |
"${CROSS_COMPILE}gcc" -o build_test build_test.c -Wall -Werror $("${CROSS_COMPILE}pkg-config" --cflags --libs gdk-pixbuf-xlib-2.0 x11) |
| 32 |
echo "build: OK" |
| 33 |
[ -x build_test ] |
| 34 |
xvfb-run -a -s "-screen 0 1024x768x24" ./build_test |
| 35 |
echo "run: OK" |