description="General Purpose Mouse: mouse server for the console and xterm."
url="http://unix.schottelius.org/gpm"

packager="Grat-OS Team"
maintainer="Grat-OS Team"

name=gpm
version=1.20.7
release=2

grat_os_version=1.0-RC1

source=(https://repo.grat-os.fr/files/grat-os-${grat_os_version}.tar.xz
        http://anduin.linuxfromscratch.org/BLFS/$name/$name-$version.tar.bz2
        http://www.linuxfromscratch.org/patches/blfs/10.1/$name-$version-consolidated-1.patch)

build() {

  cd $name-$version

  patch -Np1 -i ../$name-$version-consolidated-1.patch
  sed -i -e 's:<gpm.h>:"headers/gpm.h":' src/prog/{display-buttons,display-coords,get-versions}.c

  ./autogen.sh
  ./configure --prefix=/usr \
        --sysconfdir=/etc \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info

  make
  make ROOT=$PKG install

  ln -sv libgpm.so.2.1.0 $PKG/usr/lib/libgpm.so.1
  ln -sv libgpm.so.2.1.0 $PKG/usr/lib/libgpm.so
  install -v -m644 conf/gpm-root.conf $PKG/etc

  # service
  cd ../grat-os-${grat_os_version}
  make DESTDIR=$PKG install-gpm

}
