# $Id: PKGBUILD 136577 2015-07-09 12:37:16Z bgyorgy $
# Maintainer: Jerome Leclanche <jerome@leclan.ch>

pkgname=lxqt-common
pkgver=0.9.1
pkgrel=3
pkgdesc="Common data to run a LXQt session."
arch=("any")
url="http://lxqt.org"
license=("GPL2")
depends=("bash" "qt5-svg" "hicolor-icon-theme" "xdg-utils")
makedepends=("cmake" "liblxqt" "qt5-tools")
install=$pkgname.install
source=("http://downloads.lxqt.org/lxqt/$pkgver/$pkgname-$pkgver.tar.xz")
sha256sums=("6e572cb10a1619dcfd51bdd33802a71d4556a55ece0bc781c1cb41d972e5734d")


prepare() {
	cd "$srcdir/$pkgname-$pkgver"

	# Make themes' directories' names lowercase again
	# https://github.com/lxde/lxqt-common/commit/15fd2d8
	for i in Ambiance Dark Frost Kde-plasma Light
		do mv themes/$i `echo themes/$i | tr [:upper:] [:lower:]`
	done

	# Adjust default wallpaper to default theme
	# https://github.com/lxde/lxqt-common/commit/3296e2c
	sed -i 's|light/simple_blue_widescreen.png|frost/numix.png|' \
		config/pcmanfm-qt/lxqt/settings.conf.in

	# Enable the "leave confirmation dialog" by default
	# https://github.com/lxde/lxqt-common/commit/2062770
	sed -i '/window_manager/a leave_confirmation=true' config/session.conf

	# Set LibreOffice's plugin env var to kde4 
	# https://github.com/lxde/lxqt-common/commit/a211dd5
	sed -i 's/SAL_USE_VCLPLUGIN=kde$/SAL_USE_VCLPLUGIN=kde4/' startlxqt.in
}

build() {
	mkdir -p build
	cd build
	cmake "$srcdir/$pkgname-$pkgver" \
		-DCMAKE_INSTALL_PREFIX=/usr
	make
}

package() {
	cd build
	make DESTDIR="$pkgdir" install
}
