#!/bin/sh

# Author: Manuel A. Fernandez Montecelo <mafm@debian.org>
#
# autopkgtest check: Build and run a program against the library, to verify that
# the headers and pkg-config file are installed correctly


set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

SRCFILE=testcwidget.cc
SRCFILEGZ=testcwidget.cc.gz
BINFILE=testcwidget

gunzip -c /usr/share/doc/libcwidget-dev/examples/$SRCFILEGZ > $SRCFILE

g++ -o $BINFILE $SRCFILE -std=c++11 `pkg-config --cflags --libs cwidget` -I /usr/include/cwidget
echo "build: OK"

[ -x $BINFILE ]
# interactive, cannot invoke and close from command line
#./$BINFILE
echo "run: OK"
