#!/bin/sh # autopkgtest check: Build and run a program against gtkmm, to verify that the # headers and pkg-config file are installed correctly. # # Copyright 2012 Canonical Ltd. # Copyright 2019 Simon McVittie # SPDX-License-Identifier: LGPL-2-or-later set -e set -u set -x WORKDIR=$(mktemp -d) trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM mkdir "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.cc "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.gif "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.glsl "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.h "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.jpg "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.png "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.ui "$WORKDIR/gtk-demo" cp demos/gtk-demo/*.xml "$WORKDIR/gtk-demo" cd "$WORKDIR" cat < gtktest.cc #include #include #include #include namespace { void do_quit() { Gtk::Main::quit(); } } int main(int argc, char** argv) { try { Gtk::Main main_instance (&argc, &argv); Gtk::Window window; window.show_all(); Glib::signal_timeout().connect_seconds_once(sigc::ptr_fun(&do_quit), 1); Gtk::Main::run(); } catch(const Glib::Error& error) { std::cerr << error.what() << std::endl; return 1; } return 0; } EOF gtk_demo_deps="gtkmm-3.0 epoxy" gtktest_deps="gtkmm-3.0" glib-compile-resources --target=gtk-demo/demo_resources.c --sourcedir=gtk-demo --generate-source gtk-demo/demo.gresource.xml g++ -o gtk-demo/gtk-demo gtk-demo/*.c gtk-demo/*.cc $(pkg-config --cflags --libs "$gtk_demo_deps") g++ -o gtktest gtktest.cc $(pkg-config --cflags --libs "$gtktest_deps") echo "build: OK" [ -x gtktest ] xvfb-run -a -s "-screen 0 1024x768x24" \ ./gtktest echo "run: OK"