NAME="gpm"
DESC="General Purpose Mouse daemon"
VERSION="1.20.7"
FILES=(
  "https://anduin.linuxfromscratch.org/BLFS/gpm/gpm-$VERSION.tar.bz2"
  "https://www.linuxfromscratch.org/patches/blfs/12.0/gpm-$VERSION-consolidated-1.patch"
  "gpm.service"
  "gpm.path"
)
HASHES=(
  "bf84143905a6a903dbd4d4b911a2a2b8"
  "3659543dc3c9074f768f80c32a9e9aa1773f147068c49cf7f560ff73a0674524"
  "14d4f7fd80d65f9a6d20ca59df7ac143f21bd7d96e8758fc26d4b7cbc8e1aaf3"
  "1b8712650c70fd139f844fa754e288bfe05a8ed8044d118fda75a47d66034d23"
)
DEPENDS=()

PACKAGE() {
  tar xf $NAME-$VERSION.tar.bz2
  cd $NAME-$VERSION

  patch -Np1 -i ../gpm-$VERSION-consolidated-1.patch
  ./autogen.sh && ./configure --prefix=/usr --sysconfdir=/etc 
  make && make DESTDIR="$ROOTDIR" install 

  rm -fv "$ROOTDIR/usr/lib/libgpm.a"
  ln -sfv libgpm.so.2.1.0 "$ROOTDIR/usr/lib/libgpm.so"
  install -v -m644 conf/gpm-root.conf "$ROOTDIR/etc"
  install -v -m755 -d "$ROOTDIR/usr/share/doc/gpm-$VERSION/support"
  install -v -m644    doc/support/* \
                    "$ROOTDIR/usr/share/doc/gpm-$VERSION/support"
  install -v -m644    doc/{FAQ,HACK_GPM,README*} \
                    "$ROOTDIR/usr/share/doc/gpm-$VERSION"

  install -D -m0644 "$ROOTDIR/gpm.path" "$ROOTDIR/usr/lib/systemd/system/gpm.path"
  install -D -m0644 "$ROOTDIR/gpm.service" "$ROOTDIR/usr/lib/systemd/system/gpm.service"

  cd .. && rm -r $NAME-$VERSION
}
