#!/bin/sh

rm -f libpsi/psiwidgets/Makefile
rm -f src/Makefile

cat >extra.pri <<EOT
DEFINES += HAVE_CONFIG

sharedfiles.path  = $LIBDIR
sharedfiles.files = ../README ../COPYING ../iconsets ../sound ../certs
INSTALLS += sharedfiles

widgets.path = $LIBDIR/designer
widgets.files = ../libpsi/psiwidgets/libpsiwidgets.so
INSTALLS += widgets

INSTALL_ROOT = $PREFIX

!isEmpty(KDE) {
	# desktop icon
	KDESHARE = \$\$KDE/share
	dt.path=\$\$KDE/share/applnk/Internet/
	dt.extra = cp -f -p ../psi.desktop \$(INSTALL_ROOT)\$\$dt.path

	# icon files
	icon1.path=\$\$KDE/share/icons/hicolor/16x16/apps
	icon1.extra = cp -f -p ../iconsets/system/default/icon_16.png \$(INSTALL_ROOT)\$\$icon1.path/psi.png
	icon2.path=\$\$KDE/share/icons/hicolor/32x32/apps
	icon2.extra = cp -f -p ../iconsets/system/default/icon_32.png \$(INSTALL_ROOT)\$\$icon2.path/psi.png
	icon3.path=\$\$KDE/share/icons/hicolor/48x48/apps
	icon3.extra = cp -f -p ../iconsets/system/default/icon_48.png \$(INSTALL_ROOT)\$\$icon3.path/psi.png
	INSTALLS += dt icon1 icon2 icon3
}

EOT

cat >src/config.h <<EOT
#define LIBDIR "$LIBDIR"
EOT
