### this file is sourced not run
PKGVER=4.8.7
PKGBUILD=1
PKGARCH=x86_64

### dummy template: collect commonly used qt4 libraries
TARBALL=qt4-common-$PKGVER-$PKGARCH-$PKGBUILD.txz
MD5SUM=
SRC_URL=qt4-$PKGVER-$PKGARCH-$PKGBUILD.txz
BUNDLE=

SLACKREQ='libX11 alsa-lib mesa dbus glib libjpeg-turbo libpng libtiff openssl \
sqlite3 cups gtk2'
SLACKSUG=gst-plugins-base
SLACKDESC="qt4-common: qt4-common $PKGVER (Qt4 common libraries)  
qt4-common:  
qt4-common: This package contains commonly used shared libraries for Qt4. It 
qt4-common: does not contain static libaries or header files; for this get the 
qt4-common: full qt4 libraries.  
qt4-common: 
qt4-common: 
qt4-common: 
qt4-common: 
qt4-common: 
qt4-common: 
"
QT4DIR=./opt/qt-$PKGVER # careful, must always be relative !!
LIBS='libQtCore|libQtDBus|libQtGui|libQtNetwork|libQtSvg|libQtXml|libQtCLucene|libQtHelp|libQtSql\.'

PKG_NOMAKEPKG=yes
PKG_NOBUILD=yes

pkg_prepare() {
	: do nothing
}

pkg_download() {
	: do nothing
}

pkg_package() {
	if  [ -e $OUTPUT_DIR/$SRC_URL ] ; then
		echo extracting $SRC_URL
		mkdir tmp/libqt4
		tar -xf $OUTPUT_DIR/$SRC_URL -C tmp/libqt4

		# clean up unnecessary stuff
		cd tmp/libqt4
		rm -rf install usr $QT4DIR/$LIBDIR/pkgconfig 2> /dev/null
		( cd $QT4DIR; ls | grep -vE "$LIBDIR" | xargs rm -rf )
		( cd $QT4DIR/$LIBDIR; ls | grep -vE "plugins|.*so.*" | xargs rm -rf )
		( cd $QT4DIR/$LIBDIR/plugins; ls | grep -vE "imageformats|sqldrivers" | xargs rm -rf )
		( cd $QT4DIR/$LIBDIR; ls | grep -vE $LIBS | xargs rm )	
		
		# build the package
		pkg_package_dir .
	else
		return 1
	fi
}

pkg_build() { 
	: do nothing
}
