#!/bin/sh
#
# copy those files that are necessary to use the libscg
# in UAE
# 
# Patrick Ohly, 9.4.2000, GPL
#

#
# check arguments
#
if [ $# -lt 1 ] || [ $# -gt 3 ] || [ "$1" == "--help" ]; then
    echo "usage: $0 <cdrecord dir> <machine type (optional)>"
    exit 0
fi
cdrecorddir=$1
if ! [ -d "$cdrecorddir" ] || ! [ -d "$cdrecorddir"/include ]; then
    echo "$0: $cdrecorddir is not the cdrecord top level directory"
    exit 10
fi
cdrecinc="$cdrecorddir"/include

#
# try to find machine type 
#
if [ "$2"x != x ]; then
    machine="$2"
else
    machine=`ls "$cdrecorddir"/libs`
    if [ `echo "$machine" | wc -l` -gt 1 ]; then
        echo "please specify your machine type - libscg was compiled for:"
        echo "$machine"
        exit 10
    elif [ "$machine"x == x ]; then
        echo "please compile cdrecord for your machine first"
        exit 10
    fi
fi

#
# find our own directory
# hint: this file is in src
#
uaedir=`dirname "$0"`

cp -r -f "$cdrecinc/btorder.h" "$cdrecinc/intcvt.h" "$cdrecinc/mconfig.h" "$cdrecinc/prototyp.h" "$cdrecinc/utypes.h" "$cdrecinc/scg" "$cdrecorddir/incs/$machine/xconfig.h" "$uaedir"/include
cp -f "$cdrecorddir/libs/$machine/libscg.a" "$cdrecorddir/libs/$machine/libschily.a" "$cdrecorddir/libs/$machine/libdeflt.a" "$uaedir"
