#!/bin/sh
# autopkgtest check: Build and run a program against libg3d, to verify that the
# headers are installed correctly
# Source taken from http://leenissen.dk/fann/wp/help/getting-started/
# (C) 2013 Vibhav Pant
# Author: Vibhav Pant <martin.pitt@ubuntu.com>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > g3d_test.c
#include <g3d/g3d.h>
#include <assert.h>

int main(void)
{
        G3DContext *context;

        context  =  g3d_context_new();
        g3d_context_update_progress_bar(context, 40, TRUE);
        g3d_context_free(context);

        return 0;
}
EOF

gcc -o g3d_test g3d_test.c `pkg-config --cflags --libs libg3d` -Wall -Werror
echo "build: OK"
[ -x g3d_test ]
./g3d_test
echo "run: OK"