#!/bin/sh
# Set initial variables:
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-nmap
VERSION=3.75
ARCH=alpha
BUILD=1
TARGET=$ARCH-alphaslack-linux

mkdir -p $PKG
( cd $TMP
tar xjf $CWD/nmap-$VERSION.tar.bz2
cd nmap-$VERSION
./configure --prefix=/usr --enable-ipv6 $TARGET
make
make prefix=$PKG/usr install
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/nmap.png > $PKG/usr/share/pixmaps/nmap.png
strip $PKG/usr/bin/*
chown -R root.bin $PKG/usr/bin
gzip -9 $PKG/usr/man/man1/*
mkdir -p $PKG/usr/doc/nmap-$VERSION
cp -a CHANGELOG COPYING HACKING INSTALL $PKG/usr/doc/nmap-$VERSION
( cd docs
  mkdir -p $PKG/usr/man/it/man1
  cat nmap_italian.1 | gzip -9c > $PKG/usr/man/it/man1/nmap.1.gz
  mkdir -p $PKG/usr/man/lt/man1
  cat nmap_lithuanian.1 | gzip -9c > $PKG/usr/man/lt/man1/nmap.1.gz
  mkdir -p $PKG/usr/man/pt/man1
  cat nmap_portuguese.1 | gzip -9c > $PKG/usr/man/pt/man1/nmap.1.gz
  mkdir -p $PKG/usr/man/es/man1
  cat nmap_spanish.1 | gzip -9c > $PKG/usr/man/es/man1/nmap.1.gz
  cp -a  nmap-fingerprinting-article.txt nmap.deprecated.txt nmap.usage.txt nmap_doc.html $PKG/usr/doc/nmap-$VERSION )
chmod 644 $PKG/usr/doc/nmap-$VERSION/*
chown -R root.root $PKG/usr/doc/nmap-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/nmap-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/nmap.build.log
