#!/bin/sh
# autopkgtest check: Builds a small application against libgdata, checking
# if it compiles, links and runs successfully.
# Author: Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > build_test.c

#include <gdata/gdata.h>
int main(){
	GDataYouTubeComment *comment = NULL;
#if !defined(GLIB_VERSION_2_36)
	g_type_init();
#endif
	comment = gdata_youtube_comment_new (NULL);
	if (comment == NULL)
		return 1;
	return 0;
}
EOF

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

