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

# source: james
TARBALL=fcitx-4.2.8.6_dict.tar.xz
MD5SUM=8dce1a0d65bf19f2a99b456458f8ac41
SRC_URL=http://download.fcitx-im.org/fcitx/$TARBALL
BUNDLE=

SLACKREQ='libX11 iso-codes libicu fcitx-configtool'
SLACKDESC='fcitx: fcitx 4.2.8.6 (Input Method)  
fcitx:  
fcitx: Fcitx is a input method framework with extension support, which 
fcitx: provides an interface for entering characters of different scripts in 
fcitx: applications using a variety of mapping systems. It offers a pleasant 
fcitx: and modern experience, with intuitive graphical configuration tools and 
fcitx: customizable skins and mapping tables. It is highly modularized and 
fcitx: extensible, with GTK+ 2/3 and Qt4 IM Modules, support for UIs based on 
fcitx: Fbterm, pure Xlib, GTK+, or KDE, and a developer-friendly API.  
fcitx: 
fcitx: 
'

SLACKINSTALL='gtk-query-immodules-2.0 > ./usr/lib64/gtk-2.0/2.10.0/immodules.cache
# patch urxvt and xterm
for p in ./etc/X11/app-defaults/URxvt ./etc/X11/app-defaults/XTerm; do
	if [ -e $p ]; then
		sed -i -e '/inputMethod/d' $p
		echo "*inputMethod: fcitx" >> $p
	fi
done
'
SLACKUNINSTALL='gtk-query-immodules-2.0 > ./usr/lib64/gtk-2.0/2.10.0/immodules.cache'

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/fcitx*
#	tar -xf $CHROOT_DIR/tmp/pkg/fcitx_4.2.8.4-2.debian.tar.xz  &&
#	for p in $(cat debian/patches/series); do
#		patch -Np1 -i debian/patches/$p
#	done
}

### default pkg_package
### build
pkg_build() {
	export PATH="$PATH:/opt/qt4/bin"
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/qt4/lib64"
	export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/qt4/lib64/pkgconfig"
	export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/opt/qt4/include"
	export QT4_PATH="/opt/qt4/bin"
	export QT4_LD_LIBRARY_PATH="/opt/qt4/lib64"
	export QT4_PKG_CONFIG_PATH="/opt/qt4/lib64/pkgconfig"
	export QT4_CPLUS_INCLUDE_PATH="/opt/qt4/include" 

	CMAKEFLAGS="$CMAKEFLAGS -DLIB_INSTALL_DIR=/usr/lib64 -DSYSCONFDIR=/etc"
	pkg_build_cmake &&
	pkg_build_slackdesc &&
	
	# prepare profile and startup files
	mkdir -p /etc/profile.d mkdir -p /etc/xdg/Startup &&
	install -m755 /tmp/pkg/fcitx.sh /etc/profile.d &&
	install -m755 /tmp/pkg/fcitx-xdg /etc/xdg/Startup
}


