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

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

SLACKREQ='libX11 iso-codes libicu fcitx-configtool libjson-c'
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
	
	CMAKEFLAGS="$CMAKEFLAGS \
		-DLIB_INSTALL_DIR=/usr/lib64 \
		-DSYSCONFDIR=/etc \
		-DENABLE_GTK3_IM_MODULE=ON \
		-DENABLE_QT=OFF \
	" &&
	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
}


