summaryrefslogtreecommitdiffstats
path: root/network/putty/putty.SlackBuild
blob: 744e814a2e5cb0c3608053adb38363b610af693c (plain)
#!/bin/sh

# Slackware build script for PuTTY

# Written by <youngmug@animeneko.net>

# Modified by Michael Wagner <lapinours@web.de>
# as putty now uses autoconf.

# Maintained by Binh Nguyen <binhvng@gmail.com>
# from version 0.62

PRGNAM=putty
VERSION=${VERSION:-0.62}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
elif [ "$ARCH" = "alpha" ]; then
  SLKCFLAGS="-O2 -mcpu=ev4"
  LIBDIRSUFFIX=""
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $TMP/$PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Create $PKG tree.
mkdir -p $PKG/usr/{bin,man/man1,doc/$PRGNAM-$VERSION/html}

cd unix
  CFLAGS="$SLKCFLAGS -Wno-strict-aliasing" \
  ./configure \
    --prefix=/usr \
    --libdir=/usr/lib${LIBDIRSUFFIX} \
    --mandir=/usr/man \
    --build=$ARCH-slackware-linux

  # Don't treat all warnings as errors
  sed -i 's/-Werror//' Makefile*

  make
  make install DESTDIR=$PKG
cd ..

find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG/usr/man -type f -exec gzip -9 {} \;

cp -a README LICENCE doc/puttydoc.txt $PKG/usr/doc/$PRGNAM-$VERSION
cp -a doc/*.html $PKG/usr/doc/$PRGNAM-$VERSION/html

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}