#!/bin/tcsh -f

# Install public-domain packages distributed with Starlab.
# Specify the installation directory as the first argument on
# the command line.  An argument of "x" should install in the
# same directory as the top-level configure/make.

set log = install.log
set plist = (`cat package-list`)

#--------------------------------------------------------------

set package = $plist[1]
echo Making $package
echo Making $package				>! $log

if (! -d $package) then
    if (-e $package.tar.gz) then
	tar xzf $package.tar.gz
    endif
endif

if (-d $package) then
    cd $package
    ./configure					>> ../$log
    make clean					>> ../$log
    make					>> ../$log

    cd src
    mv gifdiff gifsicle gifview $STARLAB_PATH/sbin
    cd ../..
endif

#--------------------------------------------------------------

# Next three are all built the same way...

if (! -d inc) mkdir inc
if (! -d lib) mkdir lib

foreach package ($plist[2] $plist[3] $plist[4])

    echo Making $package
    echo Making $package			>> $log

    if (! -d $package) then
        if (-e $package.tar.gz) then
    	tar xzf $package.tar.gz
        endif
    endif

    if (-d $package) then
        cd $package
        make clean				>> ../$log
        make depend				>> ../$log
        make					>> ../$log

        cp -p *.h ../inc
        mv lib*.a ../lib			>& /dev/null
	if (-e banner) mv banner $STARLAB_PATH/sbin
        cd ..
    endif
end

#--------------------------------------------------------------
