1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#!/bin/sh
set -e
exec 2>&1
set -u
set -x
if [ -z "${HOME-}" ] || ! [ -w "${HOME}" ]; then
export HOME="${AUTOPKGTEST_TMP}"
fi
cd "$AUTOPKGTEST_TMP"
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
else
CROSS_COMPILE=
fi
cat > test.c <<'EOF'
#include <glib.h>
#include <libportal/portal.h>
int main (int argc, char *argv[])
{
XdpPortal *portal = NULL;
portal = xdp_portal_new ();
g_assert_nonnull (portal);
g_assert_true (XDP_IS_PORTAL (portal));
g_object_unref (portal);
return 0;
}
EOF
# Deliberately word-splitting, that's how pkg-config works:
# shellcheck disable=SC2046
"${CROSS_COMPILE}gcc" -o test test.c $("${CROSS_COMPILE}pkgconf" --cflags --libs libportal)
test -x ./test
dbus-run-session -- ./test
|