#! /bin/csh -fx
###############################################################################
#
# File:           PDIST:MAKE-PSL
# Description:    This file constructs a new fullpsl
# Author:         Harold Carr and Leigh Stoller
# Created:        
# Modified:       
# Mode:           C Shell
# Package:        Tools
#
# (c) Copyright 1982, University of Utah
# %
# % Redistribution and use in source and binary forms, with or without
# % modification, are permitted provided that the following conditions are met:
# %
# %    * Redistributions of source code must retain the relevant copyright
# %      notice, this list of conditions and the following disclaimer.
# %    * Redistributions in binary form must reproduce the above copyright
# %      notice, this list of conditions and the following disclaimer in the
# %      documentation and/or other materials provided with the distribution.
# %
# % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# % THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
# % CONTRIBUTORS
# % BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# % POSSIBILITY OF SUCH DAMAGE.
#
#
###############################################################################
#
# Revisions:
#
# 17-Mar-87 (Harold Carr & Leigh Stoller)
#  General cleaning in preparation for 3.4 release. Nothing interesting.
#
###############################################################################

set imagesize=10000000

if ($MACHINE == Ibmrs) then
  set imagesize=8000000
endif
if ($MACHINE == brock) then
  set imagesize=1000
endif
if ($MACHINE == AMD64) then
  set imagesize=1000
endif
if ($MACHINE == AMD64_ext) then
  set imagesize=1000
endif
if ($MACHINE == macintel64) then
  set imagesize=1000
endif
if ($MACHINE == freeBSD64) then
  set imagesize=1000
endif

pushd $psys
if ( -e $psys/.imago) then
    mv -f $psys/psl.img $psys/old-psl.img
  else
    mv -f $psys/psl $psys/old-psl
endif


setenv SavingPSL yes		# skip user startup before savesystem

$psys/bare-psl << EOF
(setq loaddirectories* '("" "$pl/" "$pll/"))
(on verboseload)
(load init-file)
(load debug useful common)
(load numeric-ops)
(off verboseload)
(savesystem  
 (cond ((unboundp '**low-case) "PSL 3.4") (t "PSL 4.2"))
          "\$psys/psl" '((read-init-file "psl")))
(exitlisp)
EOF

cat > $psys/psl << EOFF
#
$pxk/bpsl  -td $imagesize -f  $psys/psl.img \$*
#
EOFF

chmod +x $psys/psl

@ pslcompstatus = $status
popd

if ( -x $psys/sparsify ) then
    if ( -e $psys/.imago) then
        $psys/sparsify $psys/psl.img
      else
        $psys/sparsify $psys/psl
    endif
endif

@ status = $pslcompstatus

# End of file.
