#!/bin/sh

# Works under Linux only, not cross-platform

valac --pkg gmodule-2.0 main.vala plugin-interface.vala -o main
if [[ `uname` == Linux ]]; then
	libext=so
	exeext=
else
	libext=dll
	exeext=.exe
fi
valac --pkg gmodule-2.0 -C plugin.vala plugin-interface.vala
if [[ `uname` == Linux ]]; then
	gcc -shared -fPIC $(pkg-config --cflags --libs glib-2.0 gmodule-2.0) \
		-o libplugin.$libext plugin.c
else
	gcc -shared -fPIC $(pkg-config --cflags --libs glib-2.0 gmodule-2.0 gobject-2.0) \
		-o libplugin.$libext plugin.c $(pkg-config --libs glib-2.0 gmodule-2.0 gobject-2.0)
fi
./main$exeext
