#!/bin/bash # gpm.SlackBuild # by Stuart Winter for the Slackware porting Project. # Heavily based on the original Slackware build script. # 01-Jun-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMP # Determine the CFLAGS for the known architectures: case $ARCH in arm) SLKCFLAGS="-O2 -march=armv5te -D_REENTRANT" SLKLDFLAGS="-lm" ;; powerpc) SLKCFLAGS="-O2" ;; sparc) SLKCFLAGS="-O2" ;; *) SLKCFLAGS="-O2" ;; esac # Extract source: #tar xvvf $CWD/$PKGNAM-$VERSION.tar.bz2 tar xvvf $PORTCWD/sources/$PKGNAM*.tar.xz cd $PKGNAM* || exit 1 slackhousekeeping # Create Package framework: mkdir -p $PKG/usr/{share/emacs/site-lisp,include,lib,info,/doc/$PKGNAM-$VERSION,sbin,bin,man/man{1,7,8}} \ $PKG/{lib,etc/rc.d,var/log/setup} # Need a Debian patch: #xz -dc $PORTCWD/sources/*diff* | patch -p1 #cat debian/patches/series | while read ptch ; do # auto_apply_patch debian/patches/$ptch || exit 1 #done # These are taken from Fedora's SRPM: for i in $PORTCWD/sources/*.patch* ; do auto_apply_patch $i || exit 1 done # Configure: autoreconf env CC=gcc \ CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/man \ --build=$ARCH-slackware-linux-gnueabi || failconfig # Build: make $NUMJOBS LDFLAGS=$SLKLDFLAGS || make LDFLAGS=$SLKLDFLAGS || failmake #zcat $CWD/inputattach.c.gz > inputattach.c xz -dc $PORTCWD/sources/inputattach.c.xz > inputattach.c gcc $SLKCFLAGS -o inputattach inputattach.c || falimake # Install into package: # This takes care of the old manual way which is commented below: make install DESTDIR=$PKG || failinstall # Slackware keeps these in /lib: #( cd $PKG/usr/lib ; ln -vsf ../../lib/libgpm.so.1 libgpm.so ) #( cd $PKG/lib ; ln -vsf libgpm.so.1.*.* libgpm.so.1 ) ( cd $PKG mkdir -vpm755 lib mv -fv usr/lib/*.so* lib/ cd usr/lib ln -vsf ../../lib/libgpm.so.2 libgpm.so ) #cat inputattach > $PKG/usr/bin/inputattach #( cd src # cat gpm > $PKG/usr/sbin/gpm # cat prog/disable-paste > $PKG/usr/bin/disable-paste # cat prog/gpm-root > $PKG/usr/bin/gpm-root # cat prog/hltest > $PKG/usr/bin/hltest # cat prog/mev > $PKG/usr/bin/mev # cat prog/mouse-test > $PKG/usr/bin/mouse-test # install -vpm644 headers/gpm.h $PKG/usr/include # install -vpm644 lib/libgpm.a $PKG/usr/lib/ # install -vpm755 lib/libgpm.so.1.*.* $PKG/lib/ ) ( cd conf cat gpm-root.conf > $PKG/etc/gpm-root.conf cat gpm-syn.conf > $PKG/etc/gpm-syn.conf cat gpm-twiddler.conf > $PKG/etc/gpm-twiddler.conf ) ( cd contrib/emacs cat t-mouse.el > $PKG/usr/share/emacs/site-lisp/t-mouse.el ) # Install docs: cp -a BUGS COPYING Changelog Changes MANIFEST README TODO \ $PKG/usr/doc/$PKGNAM-$VERSION ( cd doc for page in *.1 *.7 *.8 ; do CHAPTER=`echo $page | cut -f 2 -d .` mkdir -p $PKG/usr/man/man$CHAPTER cat $page | gzip -9c > $PKG/usr/man/man${CHAPTER}/$page.gz done cat gpm.info | gzip -9c > $PKG/usr/info/gpm.info.gz cp -a \ Announce FAQ HACK_GPM README* \ $PKG/usr/doc/$PKGNAM-$VERSION ) # Install Slackware mouse config tool: zcat $CWD/mouseconfig.gz > $PKG/usr/sbin/mouseconfig chmod 755 $PKG/usr/bin/* $PKG/usr/sbin/* zcat $CWD/setup.mouse.gz > $PKG/var/log/setup/setup.mouse chmod 755 $PKG/var/log/setup/setup.mouse # Patch the mouse configuration utility for ARM-based machines: if [ "${ARCH}" = "arm" ]; then ( cd $PKG/var/log/setup patch --verbose -p0 < $PORTCWD/arm/setupdiff/setup.mouse.diff || failpatch ) || failpatch fi # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs 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