#!/bin/bash

# nget.build
# Build nget for ARMedslack
# by Stuart Winter <stuart@armedslack.org>
# 03-Jan-05

VERSION=$1

# Extract source:
cd $SLACKTRACKSCRATCHDIR
tar zxvvf $CWD/sources/$PACKAGE-*.tar.gz
cd $PACKAGE-*
slackhousekeeping

# Configure:
CFLAGS="$ARCH_CFLAGS" \
CXXFLAGS="$ARCH_CFLAGS" \
./configure \
   --prefix=/usr \
   --sysconfdir=/etc \
   --with-popt=/usr/lib \
   --with-zlib || failconfig

# Build:
make || failmake

# Install:
make install || failinstall

# Rename some useful files, that whilst aren't docs, are useful to be
# included within the docs, such as the ngetrc sample file and the 
# fixnames.sh file that converts older versions of nget cache file
# names to new versions
mv .ngetrc ngetrc-sample

# Install documentation:
mkdir -p /usr/doc/$PACKAGE-$VERSION
cp -a COPY* Change* FAQ README TODO fixnames.sh ngetrc-sample \
     /usr/doc/$PACKAGE-$VERSION

# Install package description:
cd / && slackdesc
