### this file is sourced not run
PKGVER=1.20.7
PKGBUILD=1
PKGARCH=i686

# source: BLFS 7.5
TARBALL=gpm-$PKGVER.tar.bz2
MD5SUM=bf84143905a6a903dbd4d4b911a2a2b8 
SRC_URL=http://www.nico.schottelius.org/software/gpm/archives/$TARBALL
BUNDLE=

SLACKREQ=
SLACKDESC="gpm32: gpm32 $PKGVER (Mouse daemon)  
gpm32:  
gpm32: The GPM (General Purpose Mouse daemon) package contains a mouse server 
gpm32: for the console and xterm. It not only provides cut and paste support 
gpm32: generally, but its library component is used by various software such as 
gpm32: Links to provide mouse support to the application. It is useful on 
gpm32: desktops, especially if following (Beyond) Linux From Scratch 
gpm32: instructions; it is often much easier (and less error prone) to cut and 
gpm32: paste between two console windows than to type everything by hand!  
gpm32: 
gpm32: This contains 32-bit version of the library.
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/gpm* &&

	# BLFS 8.2 patch
	patch -Np1 -i ../pkg/gpm-1.20.7-glibc_2.26-1.patch
}

### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share
}

### build
pkg_build() {
	cd /tmp/gpm*

	# BLFS 8.2 patch
	sed -i -e 's:<gpm.h>:"headers/gpm.h":' src/prog/{display-buttons,display-coords,get-versions}.c &&
	
	# Fatdog patch, replace shutdown -h/-r with poweroff/reboot
	sed -i -e 's/shutdown -h now/poweroff/; s/shutdown -r now/reboot/' \
	    src/daemon/processspecial.c &&
	
	CONFFLAGS="$CONFFLAGS --disable-static" &&	
	./autogen.sh &&
	pkg_build_autoconf && 
	
	# extra files to install
	ln -v -sfn libgpm.so.2.1.0 /usr/$LIBDIR/libgpm.so       &&
	#install -v -m644 conf/gpm-root.conf /etc              &&
	#install -v -m755 -d /usr/share/doc/gpm-$PKGVER/support &&
	#install -v -m644    doc/support/*                     \
	#					/usr/share/doc/gpm-$PKGVER/support &&
	#install -v -m644    doc/{FAQ,HACK_GPM,README*}        \
	#					/usr/share/doc/gpm-$PKGVER &&
	pkg_build_slackdesc
}

