1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
#! /bin/csh -f
#
# MKARCH.CSH -- Install the indicated version of the binaries, i.e.,
# archive the current objects and libraries, set BIN to point to bin.FFF,
# and set mkpkg to produce FFF binaries (FFF = ssun, sparc, etc.).
# Based on the IRAF hlib$mkfloat.csh script.
set DIRS = "cdl obm obmsh vximtool xaw3d xgterm ximtool xpm xtapemon"
set new_arch = "$1"
set clean = 1
unalias ls rm cat grep tar cmp diff echo ln mv zcat
unset noclobber
# Get the current platform architecture.
set UNAME=""
if (-e /usr/bin/uname) then
set uname_cmd = /usr/bin/uname
set UNAME=`/usr/bin/uname | tr '[A-Z]' '[a-z]'`
endif
if (-e /bin/uname) then
set uname_cmd = /bin/uname
set UNAME=`/bin/uname | tr '[A-Z]' '[a-z]'`
endif
switch ($UNAME)
case sunos:
if (`$uname_cmd -m | cut -c2-` == "86pc") then
set mach = "sunos"
else
setenv OSVERSION `uname -r | cut -c1`
if ($OSVERSION == 5) then
set mach = "ssun"
else
set mach = "sparc"
endif
endif
breaksw
case linux:
if (`$uname_cmd -m` == "ppc") then
if (-f /etc/redhat-release) then
set mach = "linuxppc"
else
set mach = "mklinux"
endif
else
if (-f /etc/redhat-release) then
set mach = "redhat"
else if (-f /etc/SuSE-release) then
set mach = "suse"
else
set mach = "linux"
endif
endif
breaksw
case freebsd:
set mach = "freebsd"
breaksw
case hp-ux:
set mach = "hp700"
breaksw
case irix:
set mach = "irix"
breaksw
case irix64:
set mach = "irix"
breaksw
case aix:
set mach = "rs6000"
breaksw
case osf1:
set mach = "alpha"
breaksw
case ultrix:
set mach = "ultrix"
breaksw
default:
set mach = "unknown"
breaksw
endsw
# Process command line options.
set cur_arch = `ls -l bin | sed -e 's+^.*bin\.++'`
if ("$1" == "-show") then
echo "System is currently configured for $cur_arch."
exit 0
else if ("$1" == "-arch") then
echo $cur_arch
exit 0
else if ("$1" == "-current") then
set new_arch = $mach
echo "Configuring X11IRAF for $new_arch..."
else if ("$1" == "-noclean") then
set new_arch = $mach
set clean = 0
echo "Configuring X11IRAF for $new_arch..."
else if ($#argv > 1) then
# Get the list of directories to be changed.
shift
if ("$1" == "-d") then
set DIRS = ""
shift
while ("$1" != "")
set DIRS = "$DIRS $1"
shift
end
endif
endif
# See if we're already there...
if ($cur_arch == $new_arch) then
echo "System is already configured for '$mach'."
exit 0
#else if ($new_arch != $mach) then
# echo "Cannot configure for '$new_arch' on a '$mach' system."
# exit 1
endif
# Create the bin/lib directories if needed.
if ($new_arch != "generic") then
if (! -e bin.$new_arch) then
mkdir bin.$new_arch
endif
if (! -e lib.$new_arch) then
mkdir lib.$new_arch
endif
endif
# Archive the current architecture files for later use.
if ($cur_arch != "generic") then
echo "Archive and delete $cur_arch objects..."
if (-e bin.$cur_arch) then
rm -f _files
foreach i (. $DIRS)
find $i \( -name Makefile -o -name '*.[ao]' \) -print >> _files
end
tar -cf - `cat _files` | compress > bin.$cur_arch/OBJS.arc.Z
rm -f _files
if ($clean == 1) then
echo "Cleaning Makefiles..."
rm -f Makefile */Makefile */*/Makefile
echo "Rebuilding Makefiles..."
xmkmf
make Makefiles
echo "Cleaning..."
make clean >& /dev/null
endif
else
echo "Old objects won't be archived, no bin.$cur_arch directory found."
endif
endif
# Restore the old files if they exist.
if ($new_arch != "generic") then
echo "Restore archived $new_arch objects..."
if (-e bin.$new_arch/OBJS.arc.Z) then
if ({ (zcat bin.$new_arch/OBJS.arc.Z | tar -xpf -) }) then
#rm -f bin.$new_arch/OBJS.arc.Z
echo rm -f bin.$new_arch/OBJS.arc.Z
endif
else if (-e bin.$new_arch/OBJS.arc) then
if ({ (cat bin.$new_arch/OBJS.arc | tar -xpf -) }) then
#rm -f bin.$new_arch/OBJS.arc
echo rm -f bin.$new_arch/OBJS.arc
endif
else
echo "No object archive found; full sysgen will be needed."
endif
endif
# Set BIN to point to new directory.
rm -f bin; ln -s bin.$new_arch bin
rm -f lib; ln -s lib.$new_arch lib
|