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

# source: james
TARBALL=fcitx-$PKGVER.tar.gz
MD5SUM=0b6c36e9af829186b758ebccdcb41b0b
SRC_URL=https://github.com/fcitx/fcitx/archive/${PKGVER}.tar.gz
BUNDLE=

SLACKREQ='libX11 iso-codes libicu fcitx-configtool qt4-common'
SLACKDESC="fcitx: fcitx $PKGVER (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. 
fcitx: It supports Xlib, GTK+ 2/3, Qt4/5 and others.
fcitx: 
fcitx: https://fcitx-im.org/wiki/Fcitx
fcitx: https://github.com/fcitx/fcitx
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
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	echo nameserver 8.8.8.8 > /etc/resolv.conf # needs to download stuff
	
	# qt4
	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 &&

	rm -f /etc/resolv.conf
}


