#!/bin/bash ulimit -s unlimited shopt -s extglob # gpm.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. # # Copyright 2008, 2009, 2010, 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.!(*sign|*asc|*sig) cd $PKGNAM-$VERSION || exit 1 slackhousekeeping zcat $CWD/gpm-1.20.1-lib-silent.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/gpm-1.20.5-close-fds.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/gpm-1.20.1-select-1.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/gpm.types.diff.gz | patch -p1 --verbose || exit 1 zcat $CWD/gpm.gcc7.diff.gz | patch -p1 --verbose || exit 1 sh autogen.sh # This is *supposed* to prevent linking libgpm.so with -lncurses, # but for some reason it doesn't have the desired effect here. # Any ideas? The patch is supposed to resolve a circular dependency # between libgpm.so and libncurses.so. I don't notice any ill effects # here, but perhaps the problem would occur if prelinking was used. # Also, ncurses has not shown an ldd link to libgpm for several releases, # so perhaps any problem that existed was fixed on their end. # NOTE: Since this isn't preventing gpm from linking to ncurses, I'm # commenting this patch out until we understand better if it's even # useful for anything. Half a patch seems worse than no patch. #zcat $CWD/gpm-1.20.1-weak-wgetch.patch.gz | patch -p1 --verbose || exit 1 # Since we just patched configure.ac, run this again to carry the change # into configure: autoconf # Configure: CFLAGS="$SLKCFLAGS -fcommon" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --build=${SLK_ARCH_BUILD} || failconfig # Build: make $NUMJOBS || make || failmake # Install into package framework: make install DESTDIR=$PKG || failinstall # Emacs ships better versions of these: rm -rf $PKG/usr/share/emacs chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/libgpm.so.* mkdir $PKG/lib${LIBDIRSUFFIX} mv $PKG/usr/lib${LIBDIRSUFFIX}/libgpm.so.* $PKG/lib${LIBDIRSUFFIX} rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libgpm.so ( cd $PKG/usr/lib${LIBDIRSUFFIX} ln -vsf ../../lib${LIBDIRSUFFIX}/libgpm.so.? libgpm.so ) zcat $CWD/inputattach.c.gz > inputattach.c gcc $SLKCFLAGS -o inputattach inputattach.c || exit install -vpm755 inputattach $PKG/usr/bin/ # We don't include an RC script here because the RC script is created # by the setupmouse script. mkdir -p $PKG/etc/rc.d ( cd conf install -vpm644 gpm-twiddler.conf gpm-syn.conf gpm-root.conf $PKG/etc/ ) mv $PKG/usr/share/{info,man} $PKG/usr # Add documentation: mkdir -vpm755 $PKG/usr/doc/$PKGNAM-$VERSION cp -fav \ BUGS COPYING* Changelog Changes MANIFEST README* TODO \ doc/{Announce,FAQ,HACK_GPM,README*,changelog} \ $PKG/usr/doc/$PKGNAM-$VERSION # Install setup scriupts: zcat $CWD/mouseconfig.gz > $PKG/usr/sbin/mouseconfig chmod 755 $PKG/usr/bin/* $PKG/usr/sbin/* mkdir -p $PKG/var/log/setup zcat $CWD/setup.mouse.gz > $PKG/var/log/setup/setup.mouse chmod 755 $PKG/var/log/setup/setup.mouse # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links