#!/bin/csh -f
#
#	$Id: ncargtar.csh,v 1.7 1993/05/10 05:04:48 haley Exp $
#
#
# Create a "tar" file containing all the files resulting from an installation
# of NCAR Graphics.
#

#******************************************************#
#                                                      #
# Set pointers to the various pieces of NCAR Graphics. #
#                                                      #
#******************************************************#
set bindir = `ncargpath bin`
if ($status != 0 ) exit
set libdir = `ncargpath lib`
if ($status != 0 ) exit
set incdir = `ncargpath include`
if ($status != 0 ) exit
set mandir = `ncargpath man`
if ($status != 0 ) exit


set vers       = "3.2"

set manlpath   = /home/eos1/harry/ncar/man/manl
set man1path   = /home/eos1/harry/ncar/man/man1
set man3path   = /home/eos1/harry/ncar/man/man3
set man5path   = /home/eos1/harry/ncar/man/man5
set man8path   = /home/eos1/harry/ncar/man/man8
set manlsect   = l
set man1sect   = 1
set man3sect   = 3
set man5sect   = 5
set man8sect   = 8
set manl       = $manlpath:t
set man1       = $man1path:t
set man3       = $man3path:t
set man5       = $man5path:t
set man8       = $man8path:t
set manldir    = $mandir/$manl
set man1dir    = $mandir/$man1
set man3dir    = $mandir/$man3
set man5dir    = $mandir/$man5
set man8dir    = $mandir/$man8

set ncarg      = ncarg
set ncargv     = $ncarg.$vers

set LocalMan   = 0

#******************#
#                  #
# Set binary files #
#                  #
#******************#

set bin_files = (\
    cgm2ncgm cgm_edit cgmtrans cgmtrans.hplj cgmtrans.nolj ctlib ctrans \
    fcaps findg fontc ftrans gcaps graphc ictrans idt med ncargcc ncargcex \
    ncargex ncargf77 ncargfile ncargmv ncargpath ncargrun ncargtar \
    ncargversion ncargworld ncarvversion ncgm2cgm ncgmstat nriftohdf plt \
    pre2ncgm pre2ncgm.prog psblack pswhite rascat rasgetpal rasls rassplit \
    rasstat rasview tgks0a tlocal xwdtohdf)

#*******************#
#                   #
# Set library files #
#                   #
#*******************#

set lib_files = (libcgm.a libncarg.a libncargC.a libncarg_c.a \
                 libncarg_gks.a libncarg_gksC.a libncarg_loc.a \
                 libncarg_ras.a)

#********************#
#                    #
# Set man page files #
#                    #
#********************#

set man1_files = (\
	cgm2ncgm cgm_edit cgmtrans ctrans fcaps findg fontc ftrans gcaps \
	graphc ictrans idt med ncargcc ncargcex ncargex ncargf77 ncargfile \
	ncargrun ncargsrc ncargversion ncgm2cgm nriftohdf pre2ncgm psblack \
	pswhite rascat rasgetpal rasls rassplit rasview xwdtohdf)

set man3_files = (\
	agback agbnch agchax agchcu agchil agchnl agcurv agdshn aggetc aggetf \
	aggeti aggetp aggetr agpwrt agrstr agsave agsetc agsetf agseti agsetp \
	agsetr agstup agutol anotat ardbpa ardrln areas areas_params aredam \
	argeti argtai arinam arpram arscam arseti autograph autograph_params \
	bivar cfux cfuy cgm clsgks cmfx cmfy cmux cmuy colconv conop1 conop2 \
	conop3 conop4 conpack conpack_params conran conran_family \
	conran_family_params conraq conras conrec conrec_family \
	conrec_family_params conrecqck conrecquick conrecsmooth conrecspr \
	conrecsuper cpback cpchcf cpchcl cpchhl cpchil cpchll cpcica cpclam \
	cpcldm cpcldr cpcltr cpcnrc cpdrpl cpezct cpfx cpfy cpgetc cpgeti \
	cpgetr cplbam cplbdr cpmpxy cppkcl cppklb cprect cprset cpscae cpsetc \
	cpseti cpsetr cpsprs cpsps1 cpsps2 cpux cpuy cufx cufy curve curve3 \
	curved dandr dashchar dashdb dashdc dashline dashline_params dashsmth \
	dashsupr displa ezcntr ezhftn ezisos ezmap ezmap_params ezmapa ezmxy \
	ezmy ezsrfc ezstrm ezvec ezxy ezy fence3 fl2int frame frst3 frstd \
	frstpt ftitle fx fy gaccum_tran_matrix gacolr gactivate_ws gactm \
	gacwk gagetc gageti gagetr gasetc gaseti gasetr gca gcell_array \
	gclear_ws gclks gclose_gks gclose_seg gclose_ws gclrwk gclsg gclwk \
	gcopy_seg_ws gcreate_seg gcrsg gcsgwk gdawk gdeactivate_ws gdel_seg \
	gdsg gesc gescape getset getsi getusv geval_tran_matrix gevtm gfa \
	gfill_area gflas1 gflas2 gflas3 gflas4 gflash ginq_asfs \
	ginq_char_expan ginq_char_ht ginq_char_space ginq_char_up_vec \
	ginq_clip ginq_colr_rep ginq_cur_norm_tran_num ginq_fill_colr_ind \
	ginq_fill_int_style ginq_fill_style_ind ginq_line_colr_ind \
	ginq_linetype ginq_linewidth ginq_marker_colr_ind ginq_marker_size \
	ginq_marker_type ginq_max_norm_tran_num ginq_name_open_seg \
	ginq_norm_tran ginq_op_st ginq_set_seg_names ginq_text_align \
	ginq_text_colr_ind ginq_text_font_prec ginq_text_path gks gopen_gks \
	gopen_ws gopks gopwk gpl gpm gpolyline gpolymarker gqasf gqchh \
	gqchsp gqchup gqchxp gqclip gqcntn gqcr gqfaci gqfais gqfasi gqln \
	gqlwsc gqmk gqmksc gqmntn gqnt gqops gqopsg gqplci gqpmci gqsgus \
	gqtxal gqtxci gqtxfp gqtxp grid gridal gridall gridall_params gridl \
	gsasf gschh gschsp gschup gschxp gsclip gscr gsel_norm_tran gselnt \
	gset_asfs gset_char_expan gset_char_ht gset_char_space \
	gset_char_up_vec gset_clip_ind gset_colr_rep gset_fill_colr_ind \
	gset_fill_int_style gset_fill_style_ind gset_line_colr_ind \
	gset_linetype gset_linewidth gset_marker_colr_ind gset_marker_size \
	gset_marker_type gset_seg_tran gset_text_align gset_text_colr_ind \
	gset_text_font_prec gset_text_path gset_vp gset_win gsfaci gsfais \
	gsfasi gsln gslwsc gsmk gsmksc gsplci gspmci gssgt gstxal gstxci \
	gstxfp gstxp gsvp gswn gtext gtx gupd_ws guwk hafton halfax halftone \
	histgr histogram histogram_params hlsrgb hstopc hstopi hstopl hstopr \
	hsvrgb idbvip idsfft init3d isgeti isgetr isosrf isosrfhr isosurface \
	isosurface_params isseti issetr kfmx kfmy kfpx kfpy kmpx \
	kmpy kpmx kpmy kumx kumy kupx kupy labelbar labelbar_params labmod \
	lastd lbfill lbgeti lbgetr lblbar lbseti lbsetr line line3 lined \
	mapaci mapbla mapdrw mapeod mapfst mapgci mapgrd mapgrm mapgtc \
	mapgti mapgtl mapgtr mapint mapiq mapiqa mapiqm mapit mapita mapitm \
	maplbl maplmb maplot mappos maproj maprs maprst mapsav mapset mapstc \
	mapsti mapstl mapstr maptra maptri maptrn mapusr mapvec mpgetc mpgeti \
	mpgetl mpgetr mpsetc mpseti mpsetl mpsetr mxmy ncarg_cbind ncarg_gks \
	ncarg_gks_cbind ngdots ngmisc ngpict ngwsym opngks pcdlsc pcgetc \
	pcgeti pcgetr pchiqu pcloqu pcmequ pcmpxy pcpnwi pcsetc pcseti \
	pcsetr perim perim3 periml plchhq plchlq plchmq plotchar \
	plotchar_params plotif plotit point point3 points psym3 pwrit \
	pwrite_family pwritx pwrity pwrz pwrzi pwrzs pwrzt reset rgbhls \
	rgbhsv rgbyiq scrolled_title scrolled_title_params set set3 seti \
	setusv sfgetc sfgeti sfgetp sfgetr sflush sfnorm sfsetc sfseti \
	sfsetp sfsetr sfsgfa sfwrld slgeti slgetr slseti slsetr softfill \
	softfill_params spps spps_converters spps_params srface stgeti \
	stgetr stinit stitle stream streamlines streamlines_params strmln \
	strset stseti stsetr stuixy stumsl stumta stumxy supcon supmap \
	surface surface_params threed tick3 tick4 tick43 ticks vect3 \
	vectd vector vectors vectors_params velvct velvec vvectr vvgetc \
	vvgeti vvgetr vvinit vvrset vvsetc vvseti vvsetr vvudmv vvumxy \
	wtstr yiqrgb)

set man5_files = (\
	fontcap graphcap ncargintro ncarv_spool ras_formats ras_palette)

set man8_files = (ncargmv ncargtar)

#**********************************************************#
#                                                          #
#  On some systems, all man pages installed to "man/manl"  #
#                                                          #
#**********************************************************#

if ( $LocalMan == 1 ) then
  set manl_files = (${man1_files} ${man3_files} ${man5_files} ${man8_files})
endif

echo ' '
echo -n 'Creating "tar" file for installed version of NCAR Graphics ... '

#
# If the previous "tar" file exists, can't proceed.
#
if (-e ncarg.tar.file) then
  echo ""
  echo "Can't overwrite existing file <ncarg.tar.file>."
  exit 1
endif

#
# Save a pointer to the current directory and move to the root directory.
#
set curdir = `pwd`
cd /

#
# Initialize the file list.
#
/bin/rm -f /tmp/ncargtmp$$

#
# Add files from the "bin" directory.
#
foreach file ($bin_files)
  if (-e $bindir/$file && -e $bindir/$file.$vers) then
    echo -n ".$bindir/$file " >> /tmp/ncargtmp$$
    echo -n ".$bindir/$file.$vers " >> /tmp/ncargtmp$$
  endif
end

#
# Add files from the "lib" directory.
#
if (-d $libdir/$ncarg)  echo -n ".$libdir/$ncarg "  >> /tmp/ncargtmp$$
if (-d $libdir/$ncargv) echo -n ".$libdir/$ncargv " >> /tmp/ncargtmp$$
foreach file ($lib_files)
  if (-e $libdir/$file && -e $libdir/$file.$vers) then
    echo -n ".$libdir/$file " >> /tmp/ncargtmp$$
    echo -n ".$libdir/$file.$vers " >> /tmp/ncargtmp$$
  endif
end

#
# Add files from the "include" directory.
#
if (-d $incdir/$ncarg)  echo -n ".$incdir/$ncarg "  >> /tmp/ncargtmp$$
if (-d $incdir/$ncargv) echo -n ".$incdir/$ncargv " >> /tmp/ncargtmp$$

#
# Add files from the "man" directory.
#

if ( $LocalMan == 1 ) then
  foreach file ($manl_files)
    set file2 = $file.$manlsect
    if (-e $manldir/$file2) then
      echo -n ".$manldir/$file2 " >> /tmp/ncargtmp$$
    endif
  end
else 

  foreach file ($man1_files)
    set file2 = $file.$man1sect
    if (-e $man1dir/$file2) then
      echo -n ".$man1dir/$file2 " >> /tmp/ncargtmp$$
    endif
  end
  
  foreach file ($man3_files)
    set file2 = $file.$man3sect
    if (-e $man3dir/$file2) then
      echo -n ".$man3dir/$file2 " >> /tmp/ncargtmp$$
    endif
  end
  
  foreach file ($man5_files)
    set file2 = $file.$man5sect
    if (-e $man5dir/$file2) then
      echo -n ".$mandir/$file2 " >> /tmp/ncargtmp$$
    endif
  end
  
  foreach file ($man8_files)
    set file2 = $file.$man8sect
    if (-e $man8dir/$file2) then
      echo -n ".$man8dir/$file2 " >> /tmp/ncargtmp$$
    endif
  end
endif

#
# Create the "tar" file.
#
tar cf $curdir/ncarg.tar.file `cat /tmp/ncargtmp$$`

#
# Get rid of the file list.
#
/bin/rm -f /tmp/ncargtmp$$

#
# Done.
#
echo 'Done.'
echo ' '
echo 'The file "ncarg.tar.file" is the desired "tar" file.  All the files'
echo 'in it have path names relative to the current directory; because of'
echo 'this, if a "tar x ... ncarg.tar.file" is to be used to restore NCAR'
echo 'Graphics, it must be executed from the root directory "/".  Such a'
echo 'command may be issued from another directory to check the contents'
echo 'of the "tar" file without overwriting the current version of NCAR'
echo 'Graphics.'
