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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#!/bin/sh
#
# This script needs to be built by configure.
#
# This is a script to install ROMIO. It can be invoked with
# make install
#
# (if you used -prefix at configure time) or,
#
# make install prefix=/usr/local/romio (or whatever directory you like)
#
# in the top-level romio directory
#
PREFIX=@prefix@
ROMIO_HOME=@ROMIO_HOME@
ARCH=@ARCH@
RANLIB=@RANLIB@
TOP_BUILD_DIR=@top_build_dir@
# LAM Do we want to install or uninstall?
WANT_INSTALL=1
#
# Default paths (set at configure time)
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
includedir=@includedir@
#sysconfdir=@sysconfdir@
libdir=@libdir@
#sharedlib_dir=@sharedlib_dir@
mandir=@mandir@
htmldir=@htmldir@
# datarootdir required as of autoconf 2.60
datarootdir=@datatrootdir@
#datadir=@datadir@
docdir=@docdir@
## Location of sources
#top_srcdir=@top_srcdir@
#
# File access mode
MODE=0644
XMODE=0755
replace=1
verbose=0
failmode=soft
# Shell procedures to copy files and create directories
#
# We could use install, but install is too different and too hard to
# test. So here are the routines to copy file, make directories, and
# replace #...# and @...@ in files
CP=cp
#
MkDir() {
if [ ! -e $1 ]; then mkdir $1 ; fi
}
CopyFile() {
if [ -z "$3" ] ; then
mode=$MODE
else
mode=$3
fi
if [ -d $2 ] ; then
dest=$2/`basename $1`
else
dest=$2
fi
if [ $replace = 0 -a -f $dest ] ; then
if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fi
elif [ -d $1 ] ; then
echo ">>> $1 is a directory; not copied <<<"
errs=`expr $errs + 1`
if [ $failmode = "hard" ] ; then exit 1 ; fi
elif [ ! -f $1 ] ; then
echo "**File $1 does not exist (or is not a regular file)!"
errs=`expr $errs + 1`
if [ $failmode = "hard" ] ; then exit 1 ; fi
else
if [ $verbose = 1 ] ; then echo "Copying $1 to $dest" ; fi
# We don't delete the file in the event that we are copying the
# file over itself (we SHOULD check for that separately, by checking
# that directories are distinct)
#if [ -f $dest ] ; then $Show rm -f $dest ; fi
$Show $CP $1 $dest
rc=$?
if [ $rc != 0 ] ; then
echo "**Error copying file $1 to $dest **"
errs=`expr $errs + 1`
if [ $failmode = "hard" ] ; then exit $rc ; fi
else
echo "rm -f $dest" >> $UNINSTALLFILE
fi
$Show chmod $mode $dest
rc=$?
if [ $rc != 0 ] ; then
echo "**Error setting mode on file $dest**"
errs=`expr $errs + 1`
if [ $chmodefailmode = "hard" ] ; then exit $rc ; fi
fi
fi
}
#
# A version of copy file that preserves file dates
CopyFileP() {
CP="cp -p"
CopyFile $1 $2 $3
CP=cp
}
#
for arg in "$@" ; do
case "$arg" in
-prefix=*)
PREFIX=`echo $arg | sed -e 's/-prefix=//'`
prefix=$PREFIX
;;
# LAM Added -uninstall option
-uninstall)
WANT_INSTALL=0
;;
*)
echo "romioinstall: Unrecognized argument $arg ."
exit 1
;;
esac
done
if test -z "$prefix" ; then
echo "Usage: make install prefix=/usr/local/romio (or whatever directory you like)"
echo "in the top-level romio directory"
fi
# Uninstall filename
if [ -z "$UNINSTALLFILE" ] ; then
UNINSTALLFILE="$sbindir/romiouninstall"
MkDir `dirname $UNINSTALLFILE`
fi
# LAM top-level switch to install or uninstall
if test "$WANT_INSTALL" = "1"; then
# Directories
# Files
MkDir $prefix
echo "copying directory $ROMIO_HOME/doc to $docdir"
MkDir $docdir
for file in COPYRIGHT README users-guide.ps.gz ; do
CopyFile $ROMIO_HOME/$file $docdir
done
echo "copying directory include to $includedir"
MkDir $includedir
for file in include/*.h ; do
CopyFile $file $includedir
done
MkDir $libdir
echo "copying directory $TOP_BUILD_DIR/lib to $libdir"
#cp -r $ROMIO_HOME/lib $PREFIX
#chmod 755 $PREFIX/lib
for file in $TOP_BUILD_DIR/lib/* ; do
if [ -f $file ] ; then
CopyFileP $file $libdir
fi
done
# Romio also copies directories in the lib directory.
if [ -z "$mandir" ] ; then
mandir=$PREFIX/man
fi
echo "copying directory $ROMIO_HOME/man to $mandir"
MkDir $mandir
MkDir $mandir/man3
for file in $ROMIO_HOME/man/man3/* ; do
CopyFile $file $mandir/man3
done
if [ -z "$exampledir" ] ; then exampledir=$PREFIX/examples ; fi
echo "copying directory $ROMIO_HOME/test to $exampledir"
MkDir $exampledir
MkDir $exampledir/std
for file in $ROMIO_HOME/test/std/* ; do
CopyFile $file $exampledir/std
done
CopyFile test/Makefile $exampledir
CopyFile test/README $exampledir
for file in test/*.c test/*.f test/runtests ; do
CopyFile $file $exampledir
done
# Ranlib should not be necessary if cp -p is used
#$RANLIB $PREFIX/lib/$ARCH/libmpio.a
# change the include and lib paths in Makefile in the test directory
echo "updating paths in $exampledir/Makefile"
TMPNEWINC=-I$includedir
TMPNEWLIB=$libdir/$ARCH/libmpio.a
NEWINC=`echo $TMPNEWINC | sed 's/\//\\\\\//g'`
NEWLIB=`echo $TMPNEWLIB | sed 's/\//\\\\\//g'`
sed -e 5s/INCLUDE_DIR[\ ]*=\ [/a-z0-9.A-Z_-]*/INCLUDE_DIR\ =\ $NEWINC/ \
-e 6s/LIBS[\ ]*=\ [/a-z0-9.A-Z_-]*/LIBS\ =\ $NEWLIB/ $exampledir/Makefile\
> $exampledir/.romiotmp
mv $exampledir/.romiotmp $exampledir/Makefile
#
MkDir $sbindir
echo "rm -f $UNINSTALLFILE" >> $UNINSTALLFILE
# Add the directory removes to the UNINSTALL file
for dir in $dirlist ; do
echo "if [ -d $dir ] ; then rmdir $dir ; fi" >> $UNINSTALLFILE
done
else
# LAM do all the things for uninstall -- do the opposite of above.
# This whole section is new.
$sbindir/romiouninstall
echo "ROMIO uninstalled"
fi
|