build: generate weston-ivi.ini for tests

The ivi-shell / hmi-controller cannot run without a properly populated
config file. Generate a config file especially for tests, which includes
paths to the build dirs.

The generated file will be used by following patches adding ivi-shell
tests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/.gitignore b/.gitignore
index aa24f9a..5be35ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,3 +95,5 @@
 weston.1
 weston-drm.7
 weston.ini.5
+
+/tests/weston-ivi.ini
diff --git a/Makefile.am b/Makefile.am
index 119085b..2aac21a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,15 @@
 		-e 's|@bindir[@]|$(bindir)|g' \
 		-e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
 		-e 's|@libexecdir[@]|$(libexecdir)|g' \
+		-e 's|@plugin_prefix[@]||g' \
+		$< > $@
+
+tests/weston-ivi.ini : $(srcdir)/ivi-shell/weston.ini.in
+	$(AM_V_GEN)$(SED) \
+		-e 's|@bindir[@]|$(bindir)|g' \
+		-e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
+		-e 's|@libexecdir[@]|$(libexecdir)|g' \
+		-e 's|@plugin_prefix[@]|$(abs_top_builddir)/.libs/|g' \
 		$< > $@
 
 all-local : weston.ini ivi-shell/weston.ini
@@ -42,7 +51,10 @@
 	-DLIBEXECDIR='"$(libexecdir)"'		\
 	-DBINDIR='"$(bindir)"'
 
-CLEANFILES = weston.ini ivi-shell/weston.ini $(BUILT_SOURCES)
+CLEANFILES = weston.ini				\
+	ivi-shell/weston.ini			\
+	tests/weston-ivi.ini			\
+	$(BUILT_SOURCES)
 
 bin_PROGRAMS += weston
 
@@ -920,7 +932,7 @@
 # tests subdirectory
 #
 
-TESTS = $(shared_tests) $(module_tests) $(weston_tests)
+TESTS = $(shared_tests) $(module_tests) $(weston_tests) $(ivi_tests)
 
 shared_tests =					\
 	config-parser.test			\
@@ -941,6 +953,9 @@
 	subsurface.weston			\
 	devices.weston
 
+ivi_tests =
+
+$(ivi_tests) : $(builddir)/tests/weston-ivi.ini
 
 AM_TESTS_ENVIRONMENT = \
 	abs_builddir='$(abs_builddir)'; export abs_builddir;
@@ -965,6 +980,7 @@
 	$(setbacklight)			\
 	$(shared_tests)			\
 	$(weston_tests)			\
+	$(ivi_tests)			\
 	matrix-test
 
 test_module_ldflags = \
diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in
index e05e8da..06af7e2 100644
--- a/ivi-shell/weston.ini.in
+++ b/ivi-shell/weston.ini.in
@@ -1,8 +1,8 @@
 [core]
-shell=ivi-shell.so
+shell=@plugin_prefix@ivi-shell.so
 
 [ivi-shell]
-ivi-module=hmi-controller.so
+ivi-module=@plugin_prefix@hmi-controller.so
 ivi-shell-user-interface=@abs_top_builddir@/weston-ivi-shell-user-interface
 
 #developermode=true